Using a Multi Record on a Category Menu page
10 posts by 3 authors in: Forums > CMS Builder
Last Post: March 14, 2011 (RSS)
By zip222 - March 3, 2011 - edited: March 27, 2011
news list
Ideally I want the News category to stay highlighted.
Re: [zip222] Using a Multi Record on a Category Menu page
By Jason - March 7, 2011
Can you attach show.php as well as the code that outputs your menu?
Thanks
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] Using a Multi Record on a Category Menu page
By zip222 - March 7, 2011
Thanks.
Re: [zip222] Using a Multi Record on a Category Menu page
By Jason - March 7, 2011
I took a look at your code, and I think what's happening is you're not passing any category information in you're url.
You can try passing "page" in your url and then manually setting your WHERE clause to get your news using id and type instead of using whereRecordNumInUrl()
Hope this helps get you started.
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] Using a Multi Record on a Category Menu page
By zip222 - March 7, 2011
Re: [zip222] Using a Multi Record on a Category Menu page
By Jason - March 8, 2011
There are actually quite a few things happening on show.php. From what I can tell, the category being selected is being based on the last number in your URL string.
I would recommend starting out selecting your news/event record not using whereRecordNumInUrl(). Instead use the 'where' option to create your own where clause. Once that's working, you can pass your category number at the end of your url without worrying about how it will affect your record selection.
In order to give an exact example of how this is done, I would need to be able to see more of what's happening on your page and in your database, which isn't something we can handle through support. If you'd like us to take a look at getting this functionality working for you, please send an email to consulting@interactivetools.com and we can go over some options with you.
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] Using a Multi Record on a Category Menu page
By zip222 - March 8, 2011 - edited: March 8, 2011
I have changed the url structure to this:
show.php?type=news&newsid=2&page=4
This viewer code works correctly:
// load news record details
list($news_details, $news_detailsMetaData) = getRecords(array(
'tableName' => 'news_items_template',
'where' => 'num=2',
'limit' => '1',
));
$news_details = @$news_details[0]; // get first record
But if I modify the where statement to utilize the a number from the url it stops working. like this:
// load news record details
$newsnum = @$_GET["newsid"];
list($news_details, $news_detailsMetaData) = getRecords(array(
'tableName' => 'news_items_template',
'where' => "num='%\t$newsnum\t%'",
'limit' => '1',
));
$news_details = @$news_details[0]; // get first record
if i change my where statement to the following it works properly.
'where' => "num='{$newsid}'",
Re: [zip222] Using a Multi Record on a Category Menu page
By Jason - March 8, 2011
A good way to do the where clause would be like this:
'where' => "num = '". mysql_escape($newsid)."' ",
we use mysql_escape to make sure no one is putting malicious code in the url string.
You would only use the "%" in the where clause when using the LIKE operator. Also, the tab characters("\t") are only used for multi-value lists.
Hope this helps clarify. Is everything working now?
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] Using a Multi Record on a Category Menu page
By zip222 - March 8, 2011
jason
Re: [Jason] Using a Multi Record on a Category Menu page
By chop - March 14, 2011