nycsavage Posted August 1, 2011 Share Posted August 1, 2011 I had been asked to create a menu system for my place of work. That was easy, I used JQUERY slider. I have a nicely designed menu system that has headers and hidden subheaders. The hidden subheaders appear when the user clicks the header button (please see http://www.beecycle.co.uk for an example) I am in the process of working my notice to spend more time at home with my baby daughter. The company has noone else to do website updates for them so I started designing a PHP CMS for them to use instead. It would be easy to just create an edit function of the current pages but this is where the problems all start. The MD likes to add new pages every now and then, and although my CMS software that I created can do that, the problem lies in where it places the new page in the menu system. I need the system to decide: 1. If the link is an outside link, if it is, then it needs to display as a header but is really a link. (eg shop link) 2. If the link is a header (and has no subpages) then it needs to display as a header and when clicked show the correct content. (eg education link) 3. If the link is a header (and has subpages) then it needs to display as a header and when clicked show the hidden sublinks. (eg resources link) 4. If the link is a subheader, then it needs to show the subheader link in the corresponding header as a dropdown link (eg anything inside the services header) Does this make sense? The first step is relatively simple $string = $row->type; if ( strpos($string, 'Link') !== false ) { echo "<a href='{$row->url}' class='bodyLink' >{$row->header}</a><br />"; } The second step has been coded like this elseif ( strpos($string, 'Header') !== false ) { echo "<p class='menuHeader' style='cursor:pointer'><a href='{$row->url}' >{$row->header}</a></p>"; } This is where it gets tricky, I cant get my head around how to get it to add subheaders to headers? Subheaders are usually stored in a div layer and the code usually looks like this: <p class="menuHeader" style="cursor:pointer"> Products </p> <div class="msg_body"> <ul> <li> <a href="http://www.beecycle.co.uk/shop/index.php?act=viewProd&productId=39" class="menuText">Beanstalk Pod</a> </li> <li> <a href="http://www.beecycle.co.uk/shop/index.php?act=viewProd&productId=38" class="menuText">Wiggo Pod</a> </li> </ul> </div> <p class="menuHeader"> <a href="http://www.beecycle.co.uk/education.php" class="noStyle">Education</a> </p> Can anyone help me please? Quote Link to comment https://forums.phpfreaks.com/topic/243421-php-cms-jquery-combined-menu-system-problems/ Share on other sites More sharing options...
@ Posted August 5, 2011 Share Posted August 5, 2011 what does the structure of the table that stores the data look like? more specifically i guess do the subheaders have and reference to the headers that they belong to? Quote Link to comment https://forums.phpfreaks.com/topic/243421-php-cms-jquery-combined-menu-system-problems/#findComment-1252451 Share on other sites More sharing options...
nycsavage Posted August 5, 2011 Author Share Posted August 5, 2011 what does the structure of the table that stores the data look like? more specifically i guess do the subheaders have and reference to the headers that they belong to? The structure is quite basic: ID, pageTitle, pageContent, pageURL, subID I figured that if subID is not NULL then make it a subHeader class linked to the ID of the Header tag. Quote Link to comment https://forums.phpfreaks.com/topic/243421-php-cms-jquery-combined-menu-system-problems/#findComment-1252881 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.