Help needed with Permalink detail pages please

By gregThomas - August 14, 2014 - edited: August 14, 2014

Hi willydoit, 

Here is some example code using your getRecord function:

  // load record from 'self_catering'
  list($self_cateringRecords, $self_cateringMetaData) = getRecords(array(
    'tableName' => 'self_catering',
    'where' => whereRecordNumberInUrl(0),
    'loadUploads' => true,
    'allowSearch' => false,
    'limit' => '1',
  ));
  $self_cateringRecord = @$self_cateringRecords[0]; // get first record
  if (!$self_cateringRecord) { dieWith404("Record not found!"); } 

  permalinks_301redirectToPermalink($self_cateringRecord);

So what the permalinks_301redirectToPermalink function will do is detect if the user accessed the page via the new permalink. If they didn't, then the user will be redirected to the new permalink. 

This system will also force search engines to update their links to use the new URL as well.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

Thanks Greg,

thats all perectly clear now.