searching & tagged content on index page

13 posts by 4 authors in: Forums > CMS Builder
Last Post: September 19, 2008   (RSS)

By kapelle - September 5, 2008

Hi, here's my setup. I posted a question a few days ago but have decided to go in a different direction and have 2 questions. I have several section editors:

news
articles on music
articles on websites
articles on songwriting
articles on sound equipment
website links
tutorials

1. Is it possible to do a search on the entire website and display the results, or can you only search one section editor at a time?

2. Each section will have several articles, with new content added each week. Let's say I put a new article in each section on a Monday. Is it possible to tag all the articles by date, then have only the articles from every section tagged by the same date (Monday) appear on the index page, like in a "what's new" section?

Re: [kapelle] searching & tagged content on index page

By Jake - September 8, 2008

Hi kapelle,

Thanks for posting!

Let me address your questions one at a time:

1. Is it possible to do a search on the entire website and display the results, or can you only search one section editor at a time?


You can do either type of search - it's up to you! To set up a search page that accesses multiple sections, you'll want to download the multiSearch.php file in this forum post:

http://www.interactivetools.com/iforum/gforum.cgi?post=61466;search_string=multisearch;t=search_engine#61466

For instructions on setting up a regular search for a single section, you can visit this page of the documentation:

http://www.interactivetools.com/docs/cmsbuilder/viewer_search.html

2. Each section will have several articles, with new content added each week. Let's say I put a new article in each section on a Monday. Is it possible to tag all the articles by date, then have only the articles from every section tagged by the same date (Monday) appear on the index page, like in a "what's new" section?


For this, were you looking to always show the latest article from each section, or were you looking to always show the most recent articles, regardless of the section they were added to?
-----------------------------------------------------------
Cheers,
Jake Marvin - Product Specialist
support@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.

Re: [Jake] searching & tagged content on index page

By kapelle - September 8, 2008 - edited: September 8, 2008

I'd like to show the articles no matter what section they were posted to - so if I posted articles this week on Tuesday, Sept. 9 in several section editors, I would have only these articles show up in the "what's new" section on the index page. Then, the next week I'd change the code on the index page to only show the articles posted on Tuesday, Sept. 16, etc.

I know there's the feature to show only the last few articles, or the latest articles, but I don't want that. I'll have a date field and want to be able to say "I only want the article's title and summary from Sept. 9, from anywhere on the website, to show up on the index page" and there would be a link to the article wherever it is on the website.

Re: [kapelle] searching & tagged content on index page

By Michael Blake - September 8, 2008

I may have grasped this wrong but wouldn't a search based on the number of days from today work for this. Perhaps have code take todays date minus 7 and then display all new articles.

Mickey

Re: [kapelle] searching & tagged content on index page

By Dave - September 8, 2008

The multi-table search feature (multiSearch) is pretty basic. So it doesn't let you search like there.

What you'd need to do (and would probably be a better way to organize things anyway) would be to have all your articles in one section with a pulldown for "category". Then you'd have a where like this:

where => " category = 'music' AND DATE_FORMAT(yourDateField, '%Y-%m-%d') = '2008-09-08' ",

It's a bit advanced, and need that mysql code above, but it should work.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] searching & tagged content on index page

By kapelle - September 8, 2008 - edited: September 8, 2008

thanks! I got the search working.

So, instead of having separate section editors for the different subjects like I normally do, I'll have all the different subjects in ONE section editor as separate categories? With different articles under these separate categories?

If that's the case, what code would I use to put separate categories on separate pages? - instead of Admin > Code Generator > select section as I normally put each section editor on a different page, how do I now put the different categories on separate pages?

If this is the only way to do it, no problem. But for me it would be easier to do it the regular way of separate section editors (it would be easier I think to keep track of all the content instead of having all the items listed under one category)

To make sure I understand, there's no way to pull all the articles with the same date from all the section editors in the database and put them on the index page in a "what's new" section? I'll have to go the route of putting them all in one category section editor?

Re: [kapelle] searching & tagged content on index page

By Dave - September 9, 2008

You add this code in the code generator under: "Advanced: Only show results that match this MySQL "Where" clause:"

Just enter your category name like this:
category = 'music'

Another way to do the same thing is just add it to the code like this:
where => " category = 'music' ",

And to confirm, no, there's no easy way to pull articles from multiple sections and then filter them by date. There's ways to do it, but they involve pretty complex SQL.

Hope that helps, let me know if you need more help with that.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] searching & tagged content on index page

By kapelle - September 17, 2008

I don't want to bring up dates by category, I want to bring up dates under the entire section editor table. This is what i have now and it's working, but not what I want:

<?php

require_once "/home/content/h/e/a/hearts2god/html/cmsAdmin/lib/viewer_functions.php";

list($resourcesRecords, $resourcesMetaData) = getRecords(array(
'tableName' => 'resources',

where => " category = 'music' AND DATE_FORMAT(date, '%Y-%m-%d') = '2008-09-16' ",

so, I don't want articles dated the 16th from JUST music, I want all the articles in the tableName resources. How would I write that?

Re: [kapelle] searching & tagged content on index page

By Dave - September 18, 2008

How about this?

where => " DATE_FORMAT(date, '%Y-%m-%d') = '2008-09-16' ",

We're just removing the category = 'music' part. Would that work for you?
Dave Edis - Senior Developer
interactivetools.com