Creating Menus

10 posts by 4 authors in: Forums > CMS Builder
Last Post: November 25, 2009   (RSS)

Re: [Cathy] Creating Menus

By Dave - June 5, 2008

Hi Cathy,

Try including 2 sets of viewer code. One to load the selected page and one to list ALL pages for the menu. Try this:

// load selected page
list($companyRecords, $companyDetails) = getRecords(array(
'tableName' => 'company',
'where' => whereRecordNumberInUrl(1),
'allowSearch' => '0',
));
$companyRecord = $companyRecords[0]; // get first record

// load all pages for menu (put this second)
list($companyRecords, $companyDetails) = getRecords(array(
'tableName' => 'company',
'allowSearch' => '0',
));


Give that a try and let me know if it fixes it. If it doesn't we may need to change the name of a $variable, but I think that might do the job.

Hope that helps, let me know how it goes.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Creating Menus

By Cathy - June 5, 2008 - edited: June 5, 2008

Dave,

I inserted/replaced the code and now it's doing the thing where the pages are in the navigation with the correct links, but the page content never changes.

Take a look at:
http://www.fametrics.com/test/template2.php?About_Us-3
And click on some of the side links.

Thoughts? Thanks Dave!
__________________________________
Grafix Unlimited

Re: [Cathy] Creating Menus

By Dave - June 5, 2008

Hi Cathy,

Ok, I think I got it. The menu code is overwriting $companyRecord. Try renaming the variable in the menu code:

<div class="nav">
<ul>
<li>HOME</li>
<li>COMPANY</li>
<ul>
<?php foreach ($companyRecords as $record): ?>
<li> &raquo; <a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a></li>
<?php endforeach; ?>
</ul>
<li>OUR SERVICES</li>
<li>EVENTS</li>
<li>SURVEYS</li>
<li>ARTICLES</li>
<li>CONTACT</li>
</ul>
</div>


Let me know if that does it.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Creating Menus

By Cathy - June 5, 2008

PERFECT! [:)] Worked like a charm. Thanks Dave!
__________________________________
Grafix Unlimited

Re: [Cathy] Creating Menus

By tsuluwerks - November 21, 2009

Hi, gang:

I would like to create something similar, though I have set up the CMS Builder differently

All of the site sections and content are in a table called "Navigation". This is to help the client understand where to put new pages for each top-level category (photo attached).

The way that the design is set up, I would like to have the same menu items show up in the bar at the top of the page (see www.financialtoolsfortrades.org/aboutus.php)

This works great for the landing pages. However, once they click through to a secondary page, the submenu items only show the page that you're on (i.e. click through to "contact us").

This is because I'm using a field called "linkname" in the navigation table to create the links.

Is there a way to generate the links to the submenu items dynamically without breaking out the navigation table into five other tables? It would help my client with understanding the heirarchy of the pages as they add in new subpages (the main categories will stay static).

Thanks,
Tracy
Attachments:

navigationimage.jpg 117K

Re: [tsuluwerks] Creating Menus

By Chris - November 24, 2009

Hi Tracy,

Did you get this sorted out? It seems like your submenu items are displaying on your details-about.php page correctly.

Please let me know if you have any questions.
All the best,
Chris

Re: [chris] Creating Menus

By tsuluwerks - November 24, 2009

I found it faster, though not quite as efficient, to set up separate editors and index/detail pages for each section. I'm leveraging includes as much as possible to cut down on future editing time. I'm glad you found this post. It disappeared on me earlier this week.

Re: [tsuluwerks] Creating Menus

By Chris - November 25, 2009

Hi Tracy,

However, once they click through to a secondary page, the submenu items only show the page that you're on (i.e. click through to "contact us").


If you want to reproduce this problem and post the PHP source code for it, I'll see if I can find a solution for you. Otherwise, if you're happy with your alternate solution, keep doing what you're doing! :)
All the best,
Chris

Re: [chris] Creating Menus

By tsuluwerks - November 25, 2009

Thanks, Chris. the entire site is done except for the other issue that I'm having (see post from last night). Thanks for your help!