Search the whole CMS

13 posts by 5 authors in: Forums > CMS Builder
Last Post: January 27, 2011   (RSS)

Re: [mdegive] Search the whole CMS

By Jason - November 24, 2010

Hi,

CMS Builder does have built in search capabilities. If you're creating an HTML form to search a table, give your form elements the same name as the field you want to search against.

For example, if you have a field called "city" and you wanted to search it using a text box you could do this:

<input type="text" name="city" />

This is a really basic implementation of a search. For more information on form names you can use to perform different searches, take a look here:
http://www.interactivetools.com/docs/cmsbuilder/viewer_search.html

Hope this helps get you started. If you run into any trouble, please let me know more about exactly what you're trying to accomplish and I can get you some more specific examples.
---------------------------------------------------
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] Search the whole CMS

Well that's really too bad for CMS system it should have this capability, most of them do...

You really did b=not answer my question though!

As I explained I need to search across multiple tables, I understand you had a script called MultiSearch.php, where can I find it?

Re: [mdegive] Search the whole CMS

By Jason - November 24, 2010

Hi,

There is an experimental function in CMS Builder called searchMultipleTables().

I've attached a file called multiSearch.php which provides an example of how the function works.

Please let me know if you have any questions.

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/
Attachments:

multisearch_003.php 4K

Re: [mdegive] Search the whole CMS

By the way, thank you VERY MUCH. That is exactly what I wanted![laugh]

I added an OrderBy option but it is not added to the query:
$searchOptions['orderBy'] = "pub_date DESC, title";

SELECT SQL_CALC_FOUND_ROWS * FROM ( SELECT 'news' as `tablename`, num, `title` as `_title`, `content` as `_summary`, `pub_date` as `field1`, `type` as `field2`, `link_url` as `field3`, '' as `field4`, '' as `field5`, '' as `field6`, '' as `field7`, '' as `field8`, '' as `field9`, '' as `field10`, CONCAT_WS('\t', `title`, `content`) as _content FROM `cms_news` UNION SELECT 'newsletters' as `tablename`, num, `title` as `_title`, `content` as `_summary`, `pub_date` as `field1`, '' as `field2`, '' as `field3`, '' as `field4`, '' as `field5`, '' as `field6`, '' as `field7`, '' as `field8`, '' as `field9`, '' as `field10`, CONCAT_WS('\t', `title`, `content`) as _content FROM `cms_newsletters` UNION SELECT 'press' as `tablename`, num, `title` as `_title`, `content` as `_summary`, `pub_date` as `field1`, '' as `field2`, '' as `field3`, '' as `field4`, '' as `field5`, '' as `field6`, '' as `field7`, '' as `field8`, '' as `field9`, '' as `field10`, CONCAT_WS('\t', `title`, `content`) as _content FROM `cms_press` UNION SELECT 'reports' as `tablename`, num, `title` as `_title`, `content` as `_summary`, `pub_date` as `field1`, '' as `field2`, '' as `field3`, '' as `field4`, '' as `field5`, '' as `field6`, '' as `field7`, '' as `field8`, '' as `field9`, '' as `field10`, CONCAT_WS('\t', `title`, `content`) as _content FROM `cms_reports` UNION SELECT 'white_papers' as `tablename`, num, `title` as `_title`, `content` as `_summary`, `pub_date` as `field1`, '' as `field2`, '' as `field3`, '' as `field4`, '' as `field5`, '' as `field6`, '' as `field7`, '' as `field8`, '' as `field9`, '' as `field10`, CONCAT_WS('\t', `title`, `content`) as _content FROM `cms_white_papers` ) as combinedTable WHERE (`_content` LIKE '%linley%') LIMIT 10 OFFSET 10

Re: [mdegive] Search the whole CMS

By Chris - December 16, 2010

Hi mdegive,

I'm afraid I can't think of a simple way to add that feature. I believe it would require some custom programming, which is something our consulting department could take care of for you. Please let me know if that's something you're interested in and I can get you a quote.
All the best,
Chris

Re: [mdegive] Search the whole CMS

I can code it myself, but I thought your others users would benefit from that feature. Should be pretty simple to add at the end of the select

Re: [mdegive] Search the whole CMS

Here is what I added in the query section:
if ($where) { $query .= "WHERE $where"; }

//MMD orderBy
if (@$searchOptions['orderBy']!="")
$query .= " ORDER BY ".$searchOptions['orderBy']." ";
//MMD orderBy END

$query .= getMysqlLimit($searchOptions['perPage'], @$_REQUEST['page']);

Works GREAT! Can you add that to your next release?

Re: [mdegive] Search the whole CMS

By Chris - December 17, 2010

Hi mdegive,

You know, I considered precisely that code, but I didn't think it would have the intended effect, since I thought you'd want to order the subqueries.

Thanks! I've committed this to our development branch.
All the best,
Chris

Re: [chris] Search the whole CMS

By pod9 - January 25, 2011

Hi, I am just building a site which needs to have a search function on it. There needs to be a single search box which users can type any text in and it searched the whole of cmsb. Please can you let me know how to do this from the ground up? james
Pod9