I am using wysiwygPro editor and i want to be able to display the menu titles coming from the database.
This is an example layout:
$editor->links = array(
array('title'=>'Home', 'URL'=>'/'),
array('title'=>'About Us','URL'=>'/about/', 'children'=>array(
array('title'=>'Company History','URL'=>'/about/history.php'),
array('title'=>'Franchise Information','URL'=>'/about/franchise.php'),
array('title'=>'Shareholders Information','URL'=>'/about/shareholders.php'),
)),
array('title'=>'Services', 'URL'=>'/services/'),
array('title'=>'Contact Us', 'URL'=>'/contact/'),
);
So this is my SELECT query with the array. But i cant seem to get it right.
$menuQ = mysql_query("SELECT menu_id, title FROM menu ORDER BY menu_id ASC") or trigger_error("Query: $menuQ\n<br />MySQL Error: " .mysql_error());
if(mysql_num_rows($menuQ) > 0){
echo 'array(';
while ($menuR = mysql_fetch_array($menuQ, MYSQL_ASSOC)) {
//echo $menuR['title'].'<br/>';
$mylinks[] = array('title'=>''.$menuR['title'].'', 'URL'=>'/?mid='.$menuR['menu_id'].'');
}
echo ');';
$editor->links = array($mylinks);
}
can anyone correct me please?
thanks