Category Menu duplicate names problem
10 posts by 2 authors in: Forums > CMS Builder
Last Post: April 14, 2010 (RSS)
By videopixel - April 13, 2010
I have setup my category menu: (example)
Biography
- Personal
- Digital Photography
- Website Design
Links
- Friends
- Digital Photography
- Website Design
The problem is when i choose in the section 'Biography' the category from a pull down menu (breadcrumb format) 'Website Design' or 'Digital Photography' the program takes the category from 'Links'- 'Website Design' or 'Digital Photography' ???
Re: [videopixel] Category Menu duplicate names problem
By Jason - April 13, 2010
Are you having this problem inside CMS Builder or on your page?
If you post the address to the page I'll take a look.
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/
Re: [Jason] Category Menu duplicate names problem
By videopixel - April 13, 2010
Re: [videopixel] Category Menu duplicate names problem
By Jason - April 13, 2010
Please don't post login details on the forum.
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/
Re: [videopixel] Category Menu duplicate names problem
By Jason - April 14, 2010
The problem was in the Section editor. You set the field value for your drop down box to be the name of the category. What was happening is that, for example, Links: Website Design and Blog:Website Design, have the same name (Web Design). It was displaying the first one it found. I switched it so that the value field is "num" which is the unique identifier of each category. It works fine now.
Let me know if you run into any more problems.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Category Menu duplicate names problem
By videopixel - April 14, 2010
Re: [videopixel] Category Menu duplicate names problem
By Jason - April 14, 2010
Can you post the address where you are having the problem as well as the php file?
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/
Re: [Jason] Category Menu duplicate names problem
By videopixel - April 14, 2010
list($blogRecords, $blogMetaData) = getRecords(array(
'tableName' => 'blog',
'perPage' => '6',
));
and then:
<?php foreach ($blogRecords as $record): ?>
<div>
<div id="blog_title"><?php echo $record['title'] ?></div>
<div id="blog_category"><?php echo $record['category'] ?></div>
<div id="blog_excerpt"><?php echo $record['excerpt'] ?></div>
</div>
<?php endforeach ?>
problem is the <?php echo $record['category'] ?> outputs a number instead of the name...
thanks
Re: [videopixel] Category Menu duplicate names problem
By Jason - April 14, 2010
First thing we're going to do is set up an array of all of the categories in the database. Put this code somewhere near the top of your file:
<?php
list($categoryRecords,$categoryMetaData) = getRecords(array(
'tableName' => 'categories',
));
$numToName=array();
foreach($categoryRecords as $record){
$numToName[$record['num']]=$record['name'];
}
?>
Next, where you want to output the name of the category, use the following:
echo $numToName[$record['category']]
This should output the category name instead of the number. Give that a try and let me know if it works.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Category Menu duplicate names problem
By videopixel - April 14, 2010
thanks Jason