Sub-categories Tutorial

134 posts by 17 authors in: Forums > CMS Builder
Last Post: August 7, 2012   (RSS)

By cjpritchard - May 15, 2012

Hi Jason,

This doesn't seem to work. The faq_categories selector inside the FAQ editor is actually a checkbox (ref: attachment faq_editor.jpg above). Does that make a difference?

Thanks,
Chris

Re: [cjpritchard] Sub-categories Tutorial

By robin - May 15, 2012

Hey Chris,

Using a checkbox list will store the information the same way in the database so it's no problem.

In the section editor for faqs, could you click modify on faq_categories and post what the pop-up looks like? If we can see what your list options looks like we can better see what's not working with your code.

Thanks,
Robin
Robin
Programmer
interactivetools.com

Re: [robin] Sub-categories Tutorial

By cjpritchard - May 15, 2012

Hi Robin,

Attached is a screenshot of that part of the editor.

Thanks,
Chris

Re: [cjpritchard] Sub-categories Tutorial

By Jason - May 16, 2012

Hi Chris,

I spotted a typo in my code that would explain why it's not working.

Try this:

<?php foreach ($faq_categoriesRecords as $categoryRecord): ?>

<h1><?php echo $categoryRecord['category_name'] ?></h1>
<?php $faqsRecords = mysql_select("faqs", "faq_categories LIKE '%\t".intval($categoryRecord['num'])."\t%'"); ?>

<?php foreach($faqsRecords as $record): ?>

<h2><?php echo $record['question'] ?></h2>
<p><?php echo $record['content'] ?></p>

<?php endforeach ?>

<?php endforeach ?>


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/

By cjpritchard - May 16, 2012

Thanks Jason,

That works great. Appreciate the help.

Chris

Re: [Chris] Sub-categories Tutorial

By cmsb - August 6, 2012

Hi, I did this (but changed the names of my categories and articles to something for meaningful for my site), but it's not working.[shocked]

Here's the url of the list page: http://www.mtgrovecemetery.org/articlesList.php?category=1

Shouldn't something be happening when I click on one of the links? For instance, shouldn't the list at least change?

Many Thanks!

Re: [cmsb] Sub-categories Tutorial

By Jason - August 6, 2012

Hi,

It looks like you're category list is working correctly. Can you post the code you're using to select your article records?

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/

By cmsb - August 6, 2012

Hi Jason, I suspect you are asking for code for detail pages? Is that it? I only used the code generator to make that one page -- the one you have the url for. I did not make any other pages. I looked for but did not find a prompt in the tutorial to make detail pages -- is that the step I'm missing?[unsure]

Re: [cmsb] Sub-categories Tutorial

By Jason - August 7, 2012

Hi,

What's happening is that your articles list is not being filtered. Are you using 'allowSearch' => false, in your articles getRecords() call? If so, try removing that.

If not, how are articles associated with categories? Do you have a list field call category in your articles section?

Let me know.

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/