Category Menu

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

By design9 - July 14, 2009

Hi Ross,

Yes, I made sure when I set those sections up that they have the same field names. The only thing that I need to go in on that main table is the title and they are all the same. If you could help me to figure out that coding, I would appreciate it!

Thanks!

April

Re: [apdance9] Category Menu

By ross - July 16, 2009

Hi April

Here's some code you can try out:

<?php $mergedArray = array_merge_recursive($news1Records, $news2Records, $news3Records); ?>

<?php foreach ($mergedArray as $record): ?>
<?php echo $record['title']; ?><br/>
<?php endforeach ?>


The first line merges your three different arrays and then the foreach loop displays the title field from each one. Does that make sense? You'll need to change the array names so they match yours but that isn't too big a deal.

I recommend trying this out on a fairly small scale at first. Just get the titles from the records displaying for now and then start piecing in the rest.

Let me know how you make out :).
-----------------------------------------------------------
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 20, 2009

Thank so much Ross!

I was able to make it work and pull it into my table with the categories as well. The only problem I am having now is making the categories show only once. Right now, it shows the category name 3 times when a advertiser is listed under the same category within the different sections ($marketplaceRecords, $marketplace_couponsRecords, $marketplace_classifiedsRecords) See my example: http://www.carolinaparent.com/marketplace/testmarket.php - The pets category shows up 3 different times instead of it only displaying once and listing all the advertisers into that one category area. Is there a way to make that work...that is the last thing I need to have it all working! I have also attached my code for the test page above if you need to look at it.

Thanks for your help!

April
Attachments:

testmarket.php 3K

Re: [apdance9] Category Menu

By ross - July 21, 2009

Hi April

Let's try the unique() function for that one:

<?php $mergedArray = array_merge_recursive($news1Records, $news2Records, $news3Records); ?>

<?php $mergedUniqueArray = array_unique($mergedArray); ?>

<?php foreach ($mergedUniqueArray as $record): ?>
<?php echo $record['title']; ?><br/>
<?php endforeach ?>


That should filter out the duplicates. Give it a shot and let me know how you make out :).
-----------------------------------------------------------
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 21, 2009

Hi Ross,

I tried the code above and it didn't seem to work. It actually only showed one record ( the first record and first category in the first array($marketplaceRecords) and didn't show any other records. See example: http://www.carolinaparent.com/marketplace/testmarket1.php

I still want all the categories to show but show only once and then all the listings to be combined from all 3 sections under that one category. From previous example:http://www.carolinaparent.com/marketplace/testmarket.php the Pets category would show once and all 3 listings would show under that category.

Do you have any other suggestions? Thanks for your help!

April

Re: [apdance9] Category Menu

By ross - July 23, 2009

Hi April

I wonder if the fact we are using different test data is throwing things off because I am getting a whole list of records in my example. For the time being, could you try removing this part:

_recursive

from the code and seeing if that helps? This might end up being something I take a closer look at on your server but for now, try removing that bit of code and letting me know that goes.

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 23, 2009

Hi Ross,
That didn't work for me either. Here is the test page:
http://www.carolinaparent.com/marketplace/testmarket2.php

I even tried an example using some multi sections called $news1Records, $news2Records, $news3Records like your example and I still got the same result with only one record showing. I have attcahed my file if you want to look at the code. I can also email you my server info, if you need to take a look.

Thanks for your help!
April
Attachments:

testmarket2.php 2K

Re: [Dave] Category Menu

By design9 - August 3, 2009

Hi Dave,

I sent you an email with all the information. Please let me know if you need anything else!

Thanks for your help!

April

Re: [apdance9] Category Menu

By Dave - August 3, 2009

Hi April,

Great thanks, I'll get back to you on that today.
Dave Edis - Senior Developer
interactivetools.com