hi, here's the issue i have a number of pages with the term "q=" in it for the search results, but i want to focus/scroll users automatically to an element, and not load top the page. quesiont is, is there a quick way of doing this on .htaccess/php or similar? please help, and thanks in advance.
You can do soo, with simply using html: If I had a page and it's url was: site.com/google.php?q=term And I had the following code tags around the content I want to specifically focus/scroll users I'd add: <A NAME="results">You've scrolled to the results content!</A> Code (markup): Then call it by: site.com/google.php?q=term#results and it will scroll down to that. Please, refer to the following for more info: http://www.htmlcodetutorial.com/linking/_A_NAME.html Or. Can be achieved much faster/dynamically using jQuery.
hi there, thanks for the reply but i was after something more dynamic as i have a lot of pages and don't want to add "#results" manually to edit all links. is there a way of redirecting something like "site.com/google.php?q=term" to "site.com/google.php?q=term#results" because all pages end in something different, but all include "q=" i was after a solution to recognise that and automatically redirect those links?
// Inside top of google.php if (false === strpos($_SERVER["REQUEST_URI"], "#results") && array_key_exists('q', $_GET) && $_GET['q'] !== "") { header("Location: ".$_SERVER["REQUEST_URI"]."#results"); die; } // ... rest of google.php goes here Untested, but hopefully you get the idea.