News section categories record display on different page.
12 posts by 3 authors in: Forums > CMS Builder
Last Post: April 23, 2013 (RSS)
By gkornbluth - April 23, 2013
Hi Jac,
If I understand you correctly, only the record that is selected in the list page will be the one that appears on the detail page.
So, if an Announcement listing is selected on the list page then that is the one that will show on the detail page.
And, if a record for a conference listing is selected, then the conference listing will be the one shown on the detail page.
Jerry Kornbluth
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
By gregThomas - April 23, 2013
Hi Jac,
As there are three different links that the section can be used for, you're going to have to abandon the _link system and manually encode them instead, but this is fairly straightforward to do. Here is an example using your news system:
<a href="/newsdetail.php?<?php echo urlencode($record['title']).'-'.$record['num']; ?>"><?php echo $record['title'] ?></a><br/>
The link goes to the newsdetail.php page, and I've URL encoded the title and added the record number into the link. I've also added the title to the link text.
I also changed the getRecord function on your detail page so that it would retrieve the article that is in the url:
// load record from 'news'
list($newsRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'where' => whereRecordNumberInUrl(0), // load first record
'loadUploads' => true,
'allowSearch' => false,
'limit' => '1',
));
The link back to the list page on the detail page should look something like this:
<a href="/newslist.php"><< Back to list page</a>
So the back link just points back to the newslist page.
If you want to use these links in your other pages (e.g. announcements), you'd just copy the code above and change the php pages they link too.
Let me know if you have any questions.
Cheers!
Greg
PHP Programmer - interactivetools.com