Radio Group

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm
Location: Comox Valley, BC

Radio Group

Post by Nullig »

Is there a smarty syntax similar to:

$this->smarty->assign('inputcategory', $this->CreateInputText($id, 'cat_name', $cat_name, 50, 255));

for creating a radio group?

Thanks,
Nullig
cyberman

Re: Radio Group

Post by cyberman »

Do you have made a look at apidocs :)?

http://www.cmsmadesimple.org/apidoc/CMS ... RadioGroup
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm
Location: Comox Valley, BC

Re: Radio Group

Post by Nullig »

Thanks.

Nullig
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm
Location: Comox Valley, BC

Re: Radio Group

Post by Nullig »

Trying to use the CreateInputRadioGroup function, but having a problem.

Code: Select all

$catlist = array();
	
$query = "SELECT * FROM ".cms_db_prefix()."module_videocollector_category ORDER BY cat_name";
$dbresult = $db->Execute($query);
	
while ($dbresult && $row = $dbresult->FetchRow())
{
	$onerow = new stdClass();

	$onerow->cat_id = $row['id'];
	$onerow->cat_name = $row['cat_name'];
	$catlist[] = $onerow;

}


$this->smarty->assign('inputcat', $this->CreateInputRadioGroup($id, 'cat_id', $catlist[1], '1'));
In using the above code, the labels for the radio buttons are showing as "cat_id" and "cat_name" and not the values assigned.

Where have I gone wrong?

Thanks,
Nullig
alby

Re: Radio Group

Post by alby »

Nullig wrote: Trying to use the CreateInputRadioGroup function, but having a problem.
Example of CreateInputRadioGroup:

Code: Select all

$view_map = $this->GetValueDB('view_map', $adding);
$view_maps = array('On'=>1, 'Off'=>0);

$ret[]= array($this->Lang('view_map').':',$module->CreateInputRadioGroup('','view_map', $view_maps, $view_map));
Try with:

Code: Select all

........
$catlist[$row['cat_name']] = $row['id'];
........
Alby
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm
Location: Comox Valley, BC

Re: Radio Group

Post by Nullig »

Perfect. Thanks alby.

Nullig
Post Reply

Return to “Developers Discussion”