0

I have a link ?view=foo. If selected, a div id="view" gets added into which a file is included. div gets closed and a link #view is added to jump back to the beginning of the included file. All fine. Thing is, the #view link doesn't do anything. Is this because the div is dynamic? Doesn't seem to make any difference if I add the div as part of the static mark-up though. URL rewriting? Split, Explode? What -- if any -- would be the best approach to make the #view link work? Sample code below.

if (isset ($_GET['view']) && ($_GET['view'] != '')) {
    $view = $_GET['view'];
    echo '<div id="view">';
    include ($view);
    echo '</div>';
    echo '<a href="#view">Top</a>';
}

EDIT: Fixed by adding hastag just above dynamic stuff. Thanks anyway.

Jon Hanna
  • 110,372
  • 10
  • 146
  • 251
  • I fail to see how that is related -- other then the query string. The issue in the mentioned post is about getting the full URL... whereas I'm asking about in-page (#hash) navigation while the URL contains a query string. Hmm... –  Oct 21 '15 at 02:34
  • You don't need to modify your title to say "Solved". Also you can delete your own answer if you think it is no longer useful to anyone. – Sheepy Oct 22 '15 at 02:36

0 Answers0