url numbers instead of labels

6 posts by 2 authors in: Forums > CMS Builder
Last Post: February 6, 2012   (RSS)

Re: [rez] url numbers instead of labels

By (Deleted User) - February 3, 2012

Hi rez,

The viewer and detail pages for a table can be set in Admin->Section Editors->TABLE->Viewer Urls - once set here the link to a record from that table can be set with $record['_link'] which will automatically add the appropriate record number to the end of a link.

To add a more detailed name (in this case, the title of a record), set Filename Fields to 'title' - this will set the url to "viewerPage.php?Title-Taken-From-Title-Field-120" where "120" is the record number.

Let me know if this helps,

Tom

Re: [Tom P] url numbers instead of labels

By rez - February 3, 2012

That is the setup I'm using. Unfortunately, that title field is populated from another table using num for value and label for name.

The "viewerPage.php?Title-Taken-From-Title-Field-120

Looks like
"viewerPage.php?52-120

Not very friendly. I have to use num. How can use the label in the link instead of num?

Thanks

Re: [rez] url numbers instead of labels

By (Deleted User) - February 3, 2012

Hi rez,

If I've got this right, you're building the link using a list of "num from foreign table"=>"name from foreign table" called "title".

Using just "title" to refer to the field will use the value of that field (in this case, 'num from foreign table') - cmsb uses pseudo-fields to show the label for a value when referring to another table.

You can use this pseudo field in the viewer settings by calling "title:label" which will refer to the label of the value instead of the value itself.

Pseudo fields can also be used for the general viewers.

Let me know if this helps,

Tom

Re: [Tom P] url numbers instead of labels

By rez - February 4, 2012

The viewer works great with label. My problem is the url. Can I use the label in the url? I want the title in the url. Currently it is showing the num. I need a friendly url.

If I could put title:label in the viewer url section of cmsb admin, that would be great but doesn't seems to work.

Re: [rez] url numbers instead of labels

By (Deleted User) - February 6, 2012

Hi rez,

You're right, the :label isn't handled correctly by the viewer url field! My mistake.

This functionality could be added with a plugin.

If anyone has written one that already does this, please let us know!

Otherwise we'd have to look at building a custom plugin.

Tom