 | |  |
 |

Cathy
User
Jun 5, 2008, 10:21 AM
Post #1 of 5
(530 views)
Shortcut
|
|
Creating Menus
|
Can't Post
|
|
Here is the situation I want to create: For each sections DETAIL page I want to include: 1) the content for that particular detail record 2) a submenu for that section that pulls all the records for the section. I have been able to create the template that sort of works. Here's my issue.... If I have these require items:
list($companyRecords, $companyDetails) = getRecords(array( 'tableName' => 'company', 'where' => whereRecordNumberInUrl(1), 'allowSearch' => '0', )); $companyRecord = $companyRecords[0]; // get first record The page displays as seen here: http://www.fametrics.com/test/template2.php?About_Us-3 Where the page content displays fine, BUT the other two pages I have in that section do not show or link in the side navigation. Here's how the other two pages display: http://www.fametrics.com/test/template2.php?About_the_Firm-1 http://www.fametrics.com/test/template2.php?contact-4 If I change the requires to:
list($companyRecords, $companyDetails) = getRecords(array( 'tableName' => 'company', 'allowSearch' => '0', )); $companyRecord = $companyRecords[0]; // get first record ... basically just removing the "where" statement, the side navigation WILL include all three records, and their associated page links are correct, but regardless of the link I click on the last record's content (the Contact Page) displays in the page body. Here's the code for the navigation:
<div class="nav"> <ul> <li>HOME</li> <li>COMPANY</li> <ul> <?php foreach ($companyRecords as $companyRecord): ?> <li> » <a href="<?php echo $companyRecord['_link'] ?>"><?php echo $companyRecord['title'] ?></a></li> <?php endforeach; ?> </ul> <li>OUR SERVICES</li> <li>EVENTS</li> <li>SURVEYS</li> <li>ARTICLES</li> <li>CONTACT</li> </ul> </div> And here is the code for the content section:
<?php echo $companyRecord['title'] ?> <?php echo $companyRecord['content'] ?><br/> <a href="<?php echo $companyDetails['_listPage']; ?>">< Back to list page</a> - <a href="mailto:?subject=<?php echo thisPageUrl() ?>">Email this Page</a> The insert codes don't change either either scenario...just the requires code. As you can see, I am just getting started on all this and links aren't coded, content is generic ,etc. Right now I'm just trying to get a handle on how everything works and works together before I jump in with both feet! Any suggestions on how to solve this problem? Or better yet, tell me I am overlooking some code that automatically inserts a fully working dynamic menu/submenu! __________________________________ InternetOne.net
|
|
|  |
 |

Dave
Staff
/ Moderator

Jun 5, 2008, 11:43 AM
Post #2 of 5
(526 views)
Shortcut
|
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
|
|
|  |
 |

Cathy
User
Jun 5, 2008, 12:21 PM
Post #3 of 5
(521 views)
Shortcut
|
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! __________________________________ InternetOne.net
(This post was edited by Cathy on Jun 5, 2008, 12:38 PM)
|
|
|  |
 |

Dave
Staff
/ Moderator

Jun 5, 2008, 1:05 PM
Post #4 of 5
(513 views)
Shortcut
|
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> » <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
|
|
|  |
 |

Cathy
User
Jun 5, 2008, 1:23 PM
Post #5 of 5
(507 views)
Shortcut
|
PERFECT! Worked like a charm. Thanks Dave! __________________________________ InternetOne.net
|
|
|  |
|