Category Dropdown

Posted on Fri, 18 May 2012


NOTE: The category dropdown is already installed by deafult in the top nav bar.
 

The category page shows an overview of all categories (with thumbnails you created in the Thumbnails editor) and also shows media associated with each category. You can add the Category page to your site in the Navigation editor (SETUP>CONFIGURE>NAVIGATION). It is in the dropdown list of pages.

We also added the Category template to the Template editor, so you can edit the page as you wish.

A couple of site owners requested a click-and-go Category drop-down for their sites. They plan to add it to the top of their page, so the following code should be added to the Main Body template file.

CODE: SELECT ALL
$datafile=$homeL.$dataFolder."categories.txt";

if(is_file($datafile)) string2array(file_get_contents($datafile), $Cats);
if($Cats)
{
  reset($Cats); asort($Cats);               
  while(list($thisid,$thisname)=each($Cats))
  {   
    $categoryOptions[]="<option value=\"".$home."?page=Category&cat=".$thisid."\">".rawurldecode($thisname)."</option>";   
  }
   
  $body.="<form>";
    $body.="<select name=\"URL\" onchange=\"window.location.href=this.form.URL.options[this.form.URL.selectedIndex].value\" style=\"font-family:verdana,arial; font-size:11px; font-weight:bold;\">";
    $body.="<option value=\"\" selected>Select a Category</option>";
    $body.=implode("\n",$categoryOptions);
    $body.="</select>";
  $body.="</form>";
}


Contact support if you have any problems with this code or need help installing it.



Tag cloud

cms tutorials design
Right column custom page. You can add anything you want here or disable it. This page displays on 2-column and 3-column Bootstrap layouts.