Question About Sub Categories and Filtering / Sorting via URL

3 posts by 2 authors in: Forums > CMS Builder
Last Post: February 25, 2011   (RSS)

Re: [Rusty] Question About Sub Categories and Filtering / Sorting via URL

By Jason - February 25, 2011

Hi Rusty,

I think you're pretty close with this one. If you're using the title for the value of the list, then you would want your url to look something like this:
http://www.mysite.com/blog.php?category=news

The reason this is currently working for you is because you're using a multi-value list, not a single value. Here is how you would select your records for a multi value field:

// load records
list($blogRecords, $blogMetaData) = getRecords(array(
'tableName' => 'blog',
'where' => "category LIKE '%\t" . mysql_escape(@$_REQUEST['category']) . "\t%'",
'perPage' => '5',
'allowSearch' => false,
));


This pulls in the category variable from the URL and looks for records where this value is in the category field surrounded by tab characters (\t).

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/

Re: [Jason] Question About Sub Categories and Filtering / Sorting via URL

By Rusty - February 25, 2011

Thanks so much Jason, I'll give that a try! For some reason looking at that now, it looks so familiar, and I can't figure out why I didn't try that earlier. Probably a mental block from too much caffeine.
Rusty