Get XOOPS XOOPSXOOPS FAQFAQ ForumsForums NewsNews ThemesThemes ModulesModules
New Posts New Topics All Posts All Forums Index General Modules Themes Development International XOOPS.org

Search

Donat-O-Meter

Make donations with PayPal!
Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $65.00
Net Balance: $61.80
Left to go: $38.20

Donations
studioC  ($25)May-17
Anonymous ($15)May-16
Anonymous ($25)May-4

Learn XOOPS Core

Local Support

Advertisement

XOOPS Code hosted on SourceForge

Cumulus Tag Cloud

2 2.5 2.5.5 2.6 3.0 90 2013 Abuse alimento AntiHarvesting AntiMalUser AntiSpam API ASP Beats billige black Blocks blue Bytes Captcha cell Christmas chronolabs Client content Conversion demo docek download Dresses editor Elastic ELB evden eve Evening facebook floor free games herre Honeypot Human IP jQuery kantor Karaoke lamps log logger mobile module modules Monster MyAlbum-p nakliyat newbb news online oxygen PageRank Permissions pink Plugin portal Prevention profile project Protector publisher Rights rmcommon Room sale security Server site Smarty Spam SQL stem StopForumSpam Studio support tag tags tdmcreate Theme themes Twitter txmod User userlog website Whitepaper xoops XOOPS2 Xortify ZendFramework

New Users

Registering user

# 136023

qinxian123

Welcome to XOOPS!




Bottom   Previous Topic   Next Topic  Register To Post



#1 Posted on: 2010/6/21 12:13 Adding XoopsFormSelectImage in classes
Hi!

I've a question proposed you.

Why not create a class for collecting the images?

I always add this code:
$image_option_tray = new XoopsFormElementTray(_AM_Ximg_IMAGE''); $image_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH "/modules/" $xoopsModule -> dirname() . "/images/"); $img_image =(empty($img_image))?'noflag.gif':$img_image$image_select = new XoopsFormSelect('''img_image'$img_image); $image_select->addOptionArray($image_array); $image_select->setExtra("onchange='showImgSelected("image", "img_image", "/modules/" . $xoopsModule -> dirname() . "/images/", "", "" . XOOPS_URL . "")'"); $image_tray = new XoopsFormElementTray('''&nbsp;'); $image_tray->addElement($image_select); if (!empty($img_image)){ $image_tray->addElement(new XoopsFormLabel(''"<div style='padding: 8px;'><img src='" XOOPS_URL "/modules/" $xoopsModule -> dirname() . "/images/" $img_image "' name='image' id='image' alt='' /></div>")); }else{ $image_tray->addElement(new XoopsFormLabel(''"<div style='padding: 8px;'><img src='" XOOPS_URL "/images/blank.gif' name='image' id='image' alt='' /></div>")); } $image_option_tray->addElement($image_tray); $sform->addElement($image_option_tray);


when create a select form.

I created this file formselectimage.php:
class XoopsFormSelectImage extends XoopsFormSelect /** * Constructor * * @param string $caption * @param string $name * @param mixed $value Pre-selected value (or array of them). * @param int $size Number of rows. "1" makes a drop-down-box. */ function XoopsFormSelectImage($caption$name$value null$size 1$multiple false) { $this->XoopsFormSelect($caption$name$value$size$multiple); $this->addOptionArray(XoopsLists::getImgListAsArray()); } }

but does not work, why?

Top


Blog| Modules, Themes, Tutorials|Mobile
timgno
Module Developer
Module Developer
Joined:
2007/6/21 13:54
From Italy
Group:
Registered Users
Posts: 1087
(Show More) (Show Less)







You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.

[Advanced Search]