• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
anchor function for in page links

#1
[eluser]vertmonkee[/eluser]
At the top of my page I will have links to jump to different id's within the same page like this
Code:
<a href="#id-1">First section</a>
<a href="#id-2">Second section</a>
<a href="#id-3">Third section</a>

If I use the anchor function from codeigniter like this

Code:
&lt;?php echo anchor('#id-1', 'First section'); ?&gt;

It creates a link to the full url where as I just want it to move the page down to that id.

If I just put the regular <a> tag in it works fine.

Is there a way to do this with codeigniter or should I just stick with the HTML tags?

Thanks

#2
[eluser]Maglok[/eluser]
The strength of the CI anchor() method lies in that it is based on the concept of in-CI urls. Something you cannot do with plain html as easily. Since you are making an internal link on the same page you can just reference PHP_SELF or even just <a href="#id-1">.

That said I don't use anchor all that much myself. Not a big fan of internal links. Smile


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.