Displaying categories via a list field
4 posts by 1 authors in: Forums > CMS Builder
Last Post: May 12, 2009 (RSS)
By sidcam - May 10, 2009
I'm reading a bunch of threads on the forum, but am not quite getting my answer.
I've created a multi-record section editor titled "news_stories" with a list field named "category" for all the various types of news stories (headline, business, etc). The goal is for the website to have a top level page that then links to List Pages (and Detail Pages) for each of the category options.
Ideally I would love to only have one set of list page/detail page files on the server to maintain, but as I'm following threads on this forum, it appears I need to create a list page/detail page for each category (i.e. List Pages would be ...news/headline/index.php; ...news/business/index.php). Is that correct?
If so, when I'm in, "Admin>Section Editors>News Stories", it only gives me one option for List Page Url and Detail Page Url. How do I get around that?
If I can do this with only one set of page, what do I put in the "where" of those pages that allows the page to be used to display multiple categories AND how do I pass that information through to the page so it knows what to display? i.e.
list($news_storiesRecords, $news_storiesMetaData) = getRecords(array(
'tableName' => 'news_stories',
'where' => 'Category = "HOW DOES THIS BECOME A VARIABLE"',
'perPage' => '5',
));
I'm assuming the specific URL's on the top level page that link to the the Detail Page for each category would just have to somehow include the category information, correct?
I've created a multi-record section editor titled "news_stories" with a list field named "category" for all the various types of news stories (headline, business, etc). The goal is for the website to have a top level page that then links to List Pages (and Detail Pages) for each of the category options.
Ideally I would love to only have one set of list page/detail page files on the server to maintain, but as I'm following threads on this forum, it appears I need to create a list page/detail page for each category (i.e. List Pages would be ...news/headline/index.php; ...news/business/index.php). Is that correct?
If so, when I'm in, "Admin>Section Editors>News Stories", it only gives me one option for List Page Url and Detail Page Url. How do I get around that?
If I can do this with only one set of page, what do I put in the "where" of those pages that allows the page to be used to display multiple categories AND how do I pass that information through to the page so it knows what to display? i.e.
list($news_storiesRecords, $news_storiesMetaData) = getRecords(array(
'tableName' => 'news_stories',
'where' => 'Category = "HOW DOES THIS BECOME A VARIABLE"',
'perPage' => '5',
));
I'm assuming the specific URL's on the top level page that link to the the Detail Page for each category would just have to somehow include the category information, correct?
Re: [sidcam] Displaying categories via a list field
By sidcam - May 10, 2009
Ok, just figured out I need to put "?category=headline" etc in the URL. Wasn't expecting it to be that easy...
Sid
Sid
Re: [sidcam] Displaying categories via a list field
By sidcam - May 11, 2009
In the example of the last emails, my main page needs to display 3 titles of each news category. i.e.
list($news_storiesRecords, $news_storiesMetaData) = getRecords(array(
'tableName' => 'news_stories',
'where' => 'Category = "Headline"',
'limit' => '3',
));
list($news_storiesRecords, $news_storiesMetaData) = getRecords(array(
'tableName' => 'news_stories',
'where' => 'Category = "Business"',
'limit' => '3',
));
etc, etc.
Will I really need to have table calls for each category at the top of the page and if so, what do I need to put in my code within the page so it knows what category it should be using?
list($news_storiesRecords, $news_storiesMetaData) = getRecords(array(
'tableName' => 'news_stories',
'where' => 'Category = "Headline"',
'limit' => '3',
));
list($news_storiesRecords, $news_storiesMetaData) = getRecords(array(
'tableName' => 'news_stories',
'where' => 'Category = "Business"',
'limit' => '3',
));
etc, etc.
Will I really need to have table calls for each category at the top of the page and if so, what do I need to put in my code within the page so it knows what category it should be using?
Re: [sidcam] Displaying categories via a list field
By sidcam - May 12, 2009
And I finally found this answer on the Forum too. Didn't realize that the instance name below didn't have to be exactly the same as the table name.
list($instance_nameRecords, $instance_nameMetaData) = getRecords(array(
list($instance_nameRecords, $instance_nameMetaData) = getRecords(array(