More Category Menu Issues...
4 posts by 2 authors in: Forums > CMS Builder
Last Post: August 5, 2010 (RSS)
By whisper - August 5, 2010
I'm finally getting my feet wet with CMSB. I'm working on a backpage, and I've successfully gotten the respective category's articles to display (see http://www.bloxhamschool.com/cmsbabout.php?category=8)
However, I'm running into issues getting the categorymenu at left to behave properly. Ideally, only children of 'About Us' would display in orange on the left menu, with each child's articles being displayed when the menu is exploded. As the site currently sits, ALL categories and subcategories display at the left, and the selected category (currently Headline News)'s articles display/repeat under EVERY category.
Stuck here :(
Also, I'm a bit confused as to how I'll build the rest of the pages for the website. With AM2, I built only 1 categoryindex template, and used category variables to display the correct menus being highlighted, etc etc (eg the cms published the entire site from 1 or 2 templates). With CMSB, I feel like I have created cmsbabout.php, but I will need to create cmsbnews.php, cmsbadmissions.php, etc etc. Is this the case, or am I missing something?
Thanks in advance
However, I'm running into issues getting the categorymenu at left to behave properly. Ideally, only children of 'About Us' would display in orange on the left menu, with each child's articles being displayed when the menu is exploded. As the site currently sits, ALL categories and subcategories display at the left, and the selected category (currently Headline News)'s articles display/repeat under EVERY category.
Stuck here :(
Also, I'm a bit confused as to how I'll build the rest of the pages for the website. With AM2, I built only 1 categoryindex template, and used category variables to display the correct menus being highlighted, etc etc (eg the cms published the entire site from 1 or 2 templates). With CMSB, I feel like I have created cmsbabout.php, but I will need to create cmsbnews.php, cmsbadmissions.php, etc etc. Is this the case, or am I missing something?
Thanks in advance
Re: [whisper] More Category Menu Issues...
By Jason - August 5, 2010
Hi,
Although it is possible to create only one page and have it display different "pages", the page can very quickly become very large and hard to deal with if you ever have to make changes. The best approach is to have a different list page for each section (about,news,etc). As for keeping the same menu, you can put all of your menu code in an "include" file and then just attach this file to each page where you want the menu to display. This way if you ever have to make changes to the menu, you only have to make it in one place.
As for the problems you're experiencing with your menu. The first issue I'm seeing is when you click on a parent category such as About us, it actually reloads the page with a new category number in the url string. It seems like parent categories should not actually be live links, but only clickable so they can display their children categories under them.
Hope this helps point you in the right direction. Please let me know if you have any other questions. If you're still running into difficulty, please attach the .php file you're working with and I can take a look.
Thanks.
Although it is possible to create only one page and have it display different "pages", the page can very quickly become very large and hard to deal with if you ever have to make changes. The best approach is to have a different list page for each section (about,news,etc). As for keeping the same menu, you can put all of your menu code in an "include" file and then just attach this file to each page where you want the menu to display. This way if you ever have to make changes to the menu, you only have to make it in one place.
As for the problems you're experiencing with your menu. The first issue I'm seeing is when you click on a parent category such as About us, it actually reloads the page with a new category number in the url string. It seems like parent categories should not actually be live links, but only clickable so they can display their children categories under them.
Hope this helps point you in the right direction. Please let me know if you have any other questions. If you're still running into difficulty, please attach the .php file you're working with and I can 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/
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] More Category Menu Issues...
By whisper - August 5, 2010
Thanks Jason - I've gotten rid of the link pointing to ?category=
I've attached my template -can you point me in the right direction with
a) how to only have level 2 categories (subcategories) appear at left, and
b) how to have the selected category's articles display when the category is exploded?
Thanks in advance!!
I've attached my template -can you point me in the right direction with
a) how to only have level 2 categories (subcategories) appear at left, and
b) how to have the selected category's articles display when the category is exploded?
Thanks in advance!!
Re: [whisper] More Category Menu Issues...
By Jason - August 5, 2010
Hi
So, are you looking that only categories that are a subcategory of the number in the url string be displayed along the left, and then only article records who's category is equal to one of the sub categories on the left, be displayed under that category?
Is that right?
If so, you can try this code (Note, this is untested, but should point you in the right direction):
Where it says $record['category'], you may have to replace 'category' with the name of the category field in your articles table.
Hope this helps.
So, are you looking that only categories that are a subcategory of the number in the url string be displayed along the left, and then only article records who's category is equal to one of the sub categories on the left, be displayed under that category?
Is that right?
If so, you can try this code (Note, this is untested, but should point you in the right direction):
<?php list($articlesRecords, $articlesMetaData) = getRecords(array(
'tableName' => 'articles',
));
?>
<?php foreach ($categoriesRecords as $categoryRecord): ?>
<div class="button-title"> <img src="/bloxtest/images/arrow-down.jpg" />
<?php if($category['parentNum']==@$_REQUEST['category']):?>
<?php if ($categoryRecord['_isSelected']): ?><b><?php endif ?>
<a href="#"><?php echo $categoryRecord['name'] ?></a>
<?php if ($categoryRecord['_isSelected']): ?></b><?php endif ?>
</div>
<div class="sub-links">
<div>
<ul>
<?php foreach ($articlesRecords as $record): ?>
<?php if($record['category']==$categoryRecord['num']):?>
<li> <a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a></li>
<?php endif ?>
<?php endforeach ?>
</ul>
</div>
</div>
<?php endif ?>
<?php endforeach; ?>
Where it says $record['category'], you may have to replace 'category' with the name of the category field in your articles table.
Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/