Category Menu Code

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

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...

Re: [pcolvin] Category Menu Code

By Jason - November 12, 2010

Hi,

You won't need those two lines of code is everything else is working well.

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/