1
timgno
Adding XoopsFormSelectImage in classes
  • 2010/6/21 17:13

  • timgno

  • Module Developer

  • Posts: 1504

  • Since: 2007/6/21


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?

Login

Username:
Password:

Lost Password? Register now!

Who's Online

77 user(s) are online (46 user(s) are browsing Support Forums)


Members: 0


Guests: 77


more...

Donat-O-Meter

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

Latest GitHub Commits