extracting the record number from _link

3 posts by 2 authors in: Forums > CMS Builder
Last Post: November 19, 2008   (RSS)

By zaba - November 19, 2008

Hi,
I am wanting to extract the record number that is at the end of the url and us it as a variable. For example when parsed the _link will be something like /folder/file.php?1. I need the number at the end as a variable. I can do this by manually putting in the address and adding the record num like this /folder/file.php?num=<?php echo $theRecord['num'] ?> and using this on the page:

if (isset($_GET['num'])) {
$numfromurl = $_GET['num'];
}
else {
$numfromurl = 1;
}

is their any way of achieving the same effect but still using the <?php echo $theRecord['_link'] ?>.
Thanks

Re: [zaba] extracting the record number from _link

By Dave - November 19, 2008

Hi zaba,

What are you trying to do?

How it works by default is detail viewer pages just load the number on the end of the url. So ?anything-here-123 is the same as ?num=123 is the same as ?123

You can get the number from the end of the url like this:

<?php $num = getNumberFromEndOfUrl() ?>

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com