News section categories record display on different page.

12 posts by 3 authors in: Forums > CMS Builder
Last Post: April 23, 2013   (RSS)

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">&lt;&lt; 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

Greg Thomas







PHP Programmer - interactivetools.com