Friday, February 11, 2011

CakePHP URL with HTML Anchor

I'm using cakePHP 1.2, and wondering how I can handle a URL that dynamically builds the page with a slug, but then links to the appropriate area with an HTML anchor. An example:

www.mysite.com/pageSlug#anchor

I would parse out the slug, which would be used to dynamically build the page. Once built, I would need to jump to the anchor. Any suggestions on how I could do this?

Thanks!

  • It should work if you put anchor name in html code as a name attribute for <a> element. The browser will then automatically scroll the page to correct position.

      <a name="anchor"></a>
    

    Just generate your page dynamically and put the above fragment to correct place in your code.

    Or am I missing something?

    Erebus : Just checking if you were awake! Ugh, sorry dumb question.

0 comments:

Post a Comment