Category Menu Code

6 posts by 3 authors in: Forums > CMS Builder
Last Post: November 12, 2010   (RSS)

I think I'm must be missing something that is right under my nose but can seem find it.

I trying to work with the Category Menu in the Section Editor. I have read this article http://www.interactivetools.com/forum/gforum.cgi?post=64259#64259 and several others.

When using the code generator for the Category Menu, should it be generating code as in the above article? I found another post that makes it sound like it should, but for me it is just giving the standard list or detail code.

I can use the code from the article above and get most of it to work, but it does not display or bold the selected item as I'm thinking it should.

Any help or suggestions would be appreciated.

Re: [pcolvin] Category Menu Code

Quick update. I have the code from the post working but cannot get it to identify the selected record.

I added a line to display the _isSelected but it never changes from zero.

<?php if ($categoryRecord['_isSelected']): ?><strong><?php endif; ?>
<a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a>
<?php if ($categoryRecord['_isSelected']): ?></strong><?php endif; ?>
<?php echo $categoryRecord['_isSelected'] ?>


The value of _isSelected is showing up behind each link as it should. I just can't get the link that has been selected to show up as such.

Re: [pcolvin] Category Menu Code

By Chris - November 11, 2010

Hi pcolvin,

Can you View Source to see if your <strong> tags are being generated or not? It could be that the CSS for your A is overriding your STRONG — if so, you may need to put your STRONG inside your A, instead of the other way around.

If you're looking for more information on how to get started with Category Menus, check out my [url http://www.interactivetools.com/forum/gforum.cgi?post=77230]Sub-categories Tutorial[/url].

I hope this helps! Please let me know if you have any questions.
All the best,
Chris

Re: [chris] Category Menu Code

Chris,

Thanks for the help. I'll give the tutorial a read a second time to see if I'm missing something.

Right now the site has no real CSS setup yet. It's very plain at right now with only a few .php files in the root for testing.

It appears to me that the tags are not being generated. In fact, I don't think the IF statement is ever coming up true to add the tag.

I have attached the .php file I'm using and here is a link to the file on the site www.sctfpa.org/categoryList.php. As you will see, it does not respond to clicking on any of the links in the menu. The code I'm using should be, with the exception of what I added for testing, be the same as in the previous post.

Thanks
Attachments:

categorylist_005.php 3K

Re: [pcolvin] Category Menu Code

Chris,

I found the problem. Of course after going through the tutorial again. [:)]

After commenting out the two lines in code to load the records, it began to work as it should.

<?php

require_once "cmsAdmin/lib/viewer_functions.php";

list($categoryRecords, $selectedCategory) = getCategories(array(
'tableName' => 'category',
// 'selectedCategoryNum' => '', // defaults to getNumberFromEndOfUrl()
// 'categoryFormat' => 'showall', // showall, onelevel, twolevel

));

?>


Do I need to worry about no having those two lines in the code?

Thanks again...