How to make a back link to list page the same which came?
16 posts by 7 authors in: Forums > CMS Builder
Last Post: December 10, 2011 (RSS)
By esteban - February 15, 2010
How to make a back link on article page to list page the same which came? I have few list page, on each list page have links to 2 articles, articles have a back link POWRÓT < [= Back]. I would make a link on article page which will enable me to return to the page from which I came not to the first.
On this site works: http://goo.gl/TXIr
Thanks for any solution.
Re: [esteban] How to make a back link to list page the same which came?
By Chris - February 15, 2010 - edited: February 16, 2010
So the problem is that users might be on page 3 of your list page (which uses pagination,) click a link to a detail page, and you want to provide a link back to page 3 of your list page instead of page 1?
This is a little tricky, but I have a solution for you.
On your list page, change the "_link" code from this:
<a href="<?php echo $record['_link'] ?>">
...to this:
<a href="wydarzenia-art.php?page=<?php echo @$_REQUEST['page'] ? htmlspecialchars($_REQUEST['page']) : 1 ?>&num=<?php echo $record['num'] ?>">
...replacing the code in red with the name of your record variable.
And then change the link in your detail page from:
<a href="wydarzenia-lista.php">
...to this:
<a href="wydarzenia-lista.php?page=<?php echo htmlspecialchars(@$_REQUEST['page']) ?>">
I hope this helps! Please let me know if you have any questions.
Chris
Re: [chris] How to make a back link to list page the same which came?
By esteban - February 15, 2010
there displays a &num=3"> i don't know how improve code and the link is wrong not to the right article.
You wrote: "...replacing the code in red with the name of your record variable. " I do not know how to do it. What is this record variable in my case?
Thanks Chris
Re: [esteban] How to make a back link to list page the same which came?
By Chris - February 16, 2010
Sorry, my fault. I had an extra "> in the code. I've edited my post above to remove it. Please remove the code in red below from your wydarzenia-lista.php page:
<a href="wydarzenia-art.php?page=<?php echo @$_REQUEST['page'] ? htmlspecialchars($_REQUEST['page']) : 1 ?>">&num=<?php echo $record['num'] ?>">
What is this record variable in my case?
It must be already correct since the code is working.
Please let me know if you have any questions.
Chris
Re: [chris] How to make a back link to list page the same which came?
By esteban - February 16, 2010
Re: [esteban] How to make a back link to list page the same which came?
By pod9 - May 21, 2010
Can you give me the generic way to solve this problem?
Re: [pod9] How to make a back link to list page the same which came?
By jarvis - May 21, 2010
<?php
$ref=@$HTTP_REFERER;
echo '<a href="$ref "> <<back </a>'; ?>
Does that help?
Re: [jarvis] How to make a back link to list page the same which came?
By pod9 - May 24, 2010
Re: [pod9] How to make a back link to list page the same which came?
By jarvis - May 24, 2010
- link from Google
- Page 8 0f 15 (for example) of your listings page
Does that help? Best bet is to try it & see if it does what you're after!
Cheers
Re: [jarvis] How to make a back link to list page the same which came?
By pod9 - May 24, 2010