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:
is their any way of achieving the same effect but still using the <?php echo $theRecord['_link'] ?>.
Thanks
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!
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
interactivetools.com
Re: [Dave] extracting the record number from _link
By zaba - November 19, 2008
Hi,
I'll give it a go. What it is I have a text based menu derived from a field in a record. Their are five records. The detail of the page is loaded in the same page dependent upon the text link from the menu. This is all okay, no problem. All I wanted to do was to keep the text link in hover state once the page associated with it is loaded. I was using the number as a variable to cross reference against the record number associated with the menu and if it matched then I would load a different a class so that menu item appeared in the hover state. Thats the only reason and I can't think of an easier way of doing it really. (If that makes sense) I got my way to work, I was just curious.
As an aside though, I am only a few days in, working on 2 projects both incorporating cms builder and so far I love it, what an excellent piece of software. I am sure the more I use it I will be better at it (and pester you guys less). Thanks [;)]
I'll give it a go. What it is I have a text based menu derived from a field in a record. Their are five records. The detail of the page is loaded in the same page dependent upon the text link from the menu. This is all okay, no problem. All I wanted to do was to keep the text link in hover state once the page associated with it is loaded. I was using the number as a variable to cross reference against the record number associated with the menu and if it matched then I would load a different a class so that menu item appeared in the hover state. Thats the only reason and I can't think of an easier way of doing it really. (If that makes sense) I got my way to work, I was just curious.
As an aside though, I am only a few days in, working on 2 projects both incorporating cms builder and so far I love it, what an excellent piece of software. I am sure the more I use it I will be better at it (and pester you guys less). Thanks [;)]