Category Menu

45 posts by 4 authors in: Forums > CMS Builder
Last Post: August 21, 2009   (RSS)

By design9 - June 30, 2009

I am not completely sure how to set up the javascript to link the categories. Can you help me with that? Also, will I need a field in the backend so the user can input the url that they want the category linked to? The only other thing I am having a hard time with is figuring out how to get the individual category name from the dropdown to automatically feed into the all page or the specific pages. Example: On the all page, I want the category name to feed in and then list all the listings for that category and so on.

Thanks!

April

By design9 - July 6, 2009 - edited: July 6, 2009

[font "Verdana"]I can figure out something with the javascript...just wasn't sure if there were any forum topics on this...didn't see any. My main thing is figuring out how [font "Verdana"]to get the individual category name from the dropdown to automatically feed into the all page or the specific pages. Example: On the all page, I want the category name to feed in and then list all the listings for that category and so on. I have already set up a multi-page section where I enter my advertisers, etc and that is working great. Just need to figure out how pull the category topics and have certain advertisers only feed in under that category.

[font "Verdana"]This is what I have so far:

http://www.carolinaparent.com/marketplace/marketplace.php


[font "Verdana"]Thanks!

[font "Verdana"]April

Re: [apdance9] Category Menu

By ross - July 7, 2009

Hi April

I think I understand what you mean with the page that displays a category and then all the items for that category under it, but that's a completely different thing than the drop down menu so I think we should try focusing on one at a time :).

I just want to make sure though that we are talking about the same things.

It sounds to me like you want each item in that drop down to link to a page like this one:

http://www.carolinaparent.com/marketplace/marketplace.php

But when you link to there from the drop down, only the category you picked will show up.

The link by itself will just show all categories.

Does that sound about right? Let me know :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By design9 - July 8, 2009

Yes...When you click on the category it will only show that category and those advertisers.

Also, I figured out the javascript for the dropdown menu and it works great! I can post it if it may be helpful for others to see it.

Thanks!

April

Re: [apdance9] Category Menu

By ross - July 8, 2009

Hi there.

Great :).

What you'll definitely want to do is make sure this:

http://www.carolinaparent.com/marketplace/marketplace.php

is a list page so when you go to just the URL, it brings up all your records. If you were to go to this URL instead:

http://www.carolinaparent.com/marketplace/marketplace.php?category=Ross

That will automatically run a search and only show you records whose category is Ross. Does that make sense?

Let me know what you think :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By design9 - July 9, 2009

Hi Ross,

Thanks so much for all your help! That works perfectly for seperating the categories. My only last issue is on the ALL page that shows all categories and all listings...how do I get the specific listing to fall under the category title and get the category title to pull in? I want to put them into a table format. See example: http://www.carolinaparent.com/marketplace/marketplacefinal.php

EX: So, for the Camps block...only the camp invention would show up there and under the health block...only the 123 smile Dental and Lee Family Medicine would show there instead of all listings.

Would I need to use an if statement????

Thanks!

April

Re: [apdance9] Category Menu

By ross - July 9, 2009

Hi April

Great!

I actually thought that marketplacefinal.php was your final page but if it isn't, there is a way to make the categories appear one time each and then list all the items for them underneath.

The first thing you'll need to do is have that page sorted on the category field. You can do that in the section editor or right on the page.

After that, you'll have to create a variable just outside of your foreach loop called $lastCategory

Get that part all setup for now and then attach a copy of your page for me.

THanks
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By design9 - July 13, 2009

Thanks Ross!

I figured it out and it works great! This is the code I am using:

<?php $lastCategory = ""; ?>
<?php foreach ($marketplaceRecords as $record): ?>
<?php if ($record['cats'] != $lastCategory): ?>
<?php $lastCategory = $record['cats']; ?>
<b><?php echo $record['cats'] ?></b>
<?php endif ?><br /><br />

<a href="<?php echo $record['_link'] ?>"><b><?php echo $record['title'] ?></b>

<?php endforeach; ?>

This is my question now:

I plan to have 3 multi record sections.

<?php foreach ($marketplaceRecords as $record): ?>
<?php foreach ($marketplace_classifiedsRecords as $record): ?>
<?php foreach ($marketplace_couponsRecords as $record): ?>

Each of sections use ['title'] for the field name to list the business name.
One for ads, one for coupons, and one for classifieds. I understand how to put multi records on a single page, but I am wondering if it is possible to combine those into the catgory code (above) so they will all pull into the same table instead of me having 3 seperate sections/tables on the page.

Thanks!

April

Re: [apdance9] Category Menu

By ross - July 14, 2009

Hi April

Glad you got that working :).

Getting your three sections all listing in that same table can be done I believe but it will be a little tricky.

What you would need to do is use some PHP to combine all three of your arrays ($marketplaceRecords, $marketplace_classifiedsRecords, $marketplace_couponsRecords) and then do the foreach loop with that new array. One really important thing is that all three sections would likely need to have the same fields. I know you mentioned they all have the 'title' field but do they all have the same other fields?

Does that make sense?

Let me know what you think :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/