Hyperlinking Menu Items in CMS Builder
8 posts by 2 authors in: Forums > CMS Builder
Last Post: September 12, 2008 (RSS)
By Laura - September 10, 2008
Re: [Laura] Hyperlinking Menu Items in CMS Builder
By Dave - September 10, 2008
Here's some steps:
First, try adding a field for "externalLink".
Next, try getting it to display under the existing menu links. The code will look something like this (use the variable names you have in the page already):
<?php echo $yourRecord['externalLink'] ?>
Next, add an if statement so if there is an external link that shows, but if not it shows the regular menu link:
<?php if ($yourRecord['externalLink']): ?>
<?php echo $yourRecord['externalLink'] ?>
<?php else: ?>
... old menu link here ...
<?php endif ?>
Give that a try and let me know how far you get or if you need any more help. :)
interactivetools.com
Re: [Dave] Hyperlinking Menu Items in CMS Builder
By Laura - September 11, 2008
(The field added to the database is named externalLink as in your example above)
Original Code:
<!-- category menu -->
<?php foreach ($categoryRecords as $categoryRecord): ?>
<?php echo str_repeat(" ", $categoryRecord['depth']); ?>
<?php if ($categoryRecord['_isSelected']): ?><b><?php endif; ?>
<a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a>
<?php if ($categoryRecord['_isSelected']): ?></b><?php endif; ?>
<br/>
<?php endforeach; ?>
<!-- /category menu -->
Updated Code:
<!-- category menu -->
<?php foreach ($categoryRecords as $categoryRecord): ?>
<?php echo str_repeat(" ", $categoryRecord['depth']); ?>
<?php if ($categoryRecord['externalLink']): ?>
<?php echo $categoryRecord['externalLink'] ?>
<?php else: ?>
<?php if ($categoryRecord['_isSelected']): ?><b><?php endif; ?>
<a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a>
<?php if ($categoryRecord['_isSelected']): ?></b><?php endif; ?>
<?php endif ?>
<?php endforeach; ?>
<br/>
<!-- /category menu -->
Thanks!
Re: [Laura] Hyperlinking Menu Items in CMS Builder
By Dave - September 11, 2008
interactivetools.com
Re: [Dave] Hyperlinking Menu Items in CMS Builder
By Laura - September 11, 2008
[font "Calibri"]The functionality works in that the field with the external hyperlink is added to the menu structure and looks exactly like the other menu items. However, the nesting does not work. I believe it has to do with the depth. In short the menu is not displaying the subcategory and sub-subcategory hierarchy as before. The menu is all one consistent column. When a menu item which has a subcategory is clicked, the subcategory displays directly under the main category. Like so:
[font "Calibri"]
[font "Calibri"]Parent Category
[font "Calibri"]Subcategory
[font "Calibri"]Sub-Subcategory
[font "Calibri"]
[font "Calibri"]Before it displayed as so:
[font "Calibri"]Parent Category
[font "Calibri"]-Subcategory
[font "Calibri"]--Sub-Subcategory
[font "Calibri"]
[font "Calibri"]Thoughts?
[font "Calibri"]Laura
Re: [Laura] Hyperlinking Menu Items in CMS Builder
By Dave - September 11, 2008
That's strange, the code looks perfect to me.
Can you send me CMS and FTP login info (to dave@interactivetools.com, don't post login details to forum) and I'll take a look for you?
Hope that helps!
interactivetools.com
Re: [Laura] Hyperlinking Menu Items in CMS Builder
By Dave - September 12, 2008
I made the following changes (in red):
<!-- category menu -->
<?php foreach ($categoryRecords as $categoryRecord): ?>
<?php echo str_repeat(" ", $categoryRecord['depth']); ?>
<?php if ($categoryRecord['externalLink']): ?><br>
<a href="<?php echo $categoryRecord['externalLink'] ?>"><?php echo $categoryRecord['name'] ?></a>
<?php else: ?>
<?php if ($categoryRecord['_isSelected']): ?><b><?php endif; ?>
<a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a>
<?php if ($categoryRecord['_isSelected']): ?></b><?php endif; ?>
<?php endif ?>
<?php endforeach; ?>
<br/>
<!-- /category menu -->
Let me know if that work for you.
interactivetools.com
Re: [Dave] Hyperlinking Menu Items in CMS Builder
By Laura - September 12, 2008