I am using CodeIgniter’s anchor tag to generate links
Here’s the code I am using in my view :
<?=anchor('blog/post/'.$row->id,$row->title);?>
Above code is rendering the url like
<a href="http://localhost/Blog/index.php/blog/post/3">Title</a>
I wanted to know other ways to embed other HTML elements within <a> tags ?
Output on HTML page should look like :
<a href="link" rel="bookmark">
<span class="location">Category</span>
<h3 class="headline">Headline</h3>
<span class="new">New !</span>
<span class="date">Date</span>
</a>
ie. within <a> tags I want to embed <span> and <h3>
Any suggestions ?
Just use the second parameter of the anchor method, like this:
Additionaly I added a third parameter which lets you write the html attributes for the tags like; in this case, the ‘rel’ attribute.