Permalink Viewer URL

5 posts by 3 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: November 11   (RSS)

By rez - November 4 - edited: November 4

  // load detail record from 'announcements'
  list($announcementsRecords, $announcementsMetaData) = getRecords(array(
    'tableName'   => 'announcements',
    'where'       => whereRecordNumberInUrl(0), // If no record # is specified then latest record is shown
    'loadUploads' => true,
    'allowSearch' => false,
    'limit'       => '1',
  ));
  $detailRecord = @$announcementsRecords[0]; // get first record


  list($announcementsRecords, $announcementsMetaData) = getRecords(array(
    'tableName'   => 'announcements',
    'loadUploads' => false,
    'allowSearch' => false,
  ));

This page works:

https://www.website.com/announcements.php

This search works

https://www.website.com/announcements.php?1

This permalink works:

https://www.website.com/announcements

This does not work:

https://www.website.com/announcements?1

Which makes sense, I guess. Nothing is telling the browser if the ?1 is simply part of the announcements name.

How do you handle permalinks and a _link  for a viewer? Is there a way to get the .php out of there for consistency? 

By rez - November 5

Ah, I see. Thanks Tim.

So that's like another folder which breaks all of my relative paths. I could fix it but I guess I actually prefer the .php in this case, unless there is another way.

I noticed in the plugin now that you mention it, to the right of the permalink field is a slash as if one would already be included. I don't know what that means, being there. It seems if I did want to do what you are describing, I couldn't just ad a slash to the permalink field to make this auto happen. I guess that means I would have to do something like this on my pages?

<a href="<?php echo $record['_link'] ?>"><?php echo $record['_link'] ?>/</a> //added a slash

By rez - November 5 - edited: November 5

wait... no, that wouldn't work. That would make the slash at the end, after the num. How do you do this to auto include it?

By daniel - November 11

Hi Rez,

Broadly speaking a URL in the form "https://www.website.com/announcements?1" can work, but it does depend a bit on what you're trying to do, and how you've set things up.

Could you let me know what happens when you go to "https://www.website.com/announcements?1" - e.g. is there an error, is it showing the wrong content, etc.? Also, how did you configure your permalinks plugin to get the "/announcements" permalink working?

Thanks,

Daniel
Technical Lead
interactivetools.com