I have everything working except the select list. This is the code I am using
Code: Select all
//create array of all the active pages
$myquery = "SELECT * FROM cms_content WHERE active=1";
$myresult = $db->Execute( $myquery );
$pagearray = array();
while ($myresult && $myrow = $myresult->FetchRow())
{
$pagearray[$myrow['content_name']] = $myrow['content_id'];
}
$selpages = explode(',',$row['pages']);// this creates an array of page ids that are stored in the database in a field called pages
$selpagearray = array();
for ($i=0; $i <sizeof($selpages); $i++)
{
$query2 = 'SELECT content_name FROM cms_content WHERE content_id = '.$selpages[$i];
$row2 = $db->GetRow($query2);
$selpagearray[$row2['content_name']] = $selpages[$i]; // build array of pages that should be selected
}
$this->$smarty->assign('inputpages', $this->CreateInputSelectList($id,'pages[]',$pagearray,$selpagearray));
$this->smarty->assign('pagestext', $this->Lang('pages'));
array(5) { ["Home"]=> string(2) "15" ["test form"]=> string(2) "16" ["podcast"]=> string(2) "17" ["events"]=> string(2) "18" ["gallery"]=> string(2) "23" }
array(2) { ["Home"]=> string(2) "15" ["podcast"]=> string(2) "17" }
and this is the error I am getting
Catchable fatal error: Object of class Smarty_CMS could not be converted to string in /home/bible/SQ32P4N3/htdocs/modules/YMABII/action.editContent.php
it doesn't seem to matter what array I put into the function I still get the same error. Could someone please tell me where I am going wrong or give me a working example?
Thank you
Rachael