codeigniter anchor-url helper Function anchor in codeigniter
In this post we will show you codeigniter anchor, hear for codeigniter anchor we will give you demo and example for implement.
hear we use codeigniter anchor as url helper Function anchor in codeigniter
anchor($set_uri = '', $set_title = '', $set_attributes = '')
- $attributes (mixed) – HTML attributes
- $title (string) – Anchor title
- $uri (string) – URI string
- Returns: HTML hyperlink (anchor tag)
- Return type: string
Creates a typical html anchor link supported your native web site computer address.
The first parameter will contain any segments you want appended to the computer address. like the
site_url() perform on top of, segments are often a string or associate array.
If square measure|you’re} building links that are internal to your application don’t embody the bottom computer address (
http://...). this can be else mechanically from the data laid out in your config file. embody solely the URI segments you want appended to the computer address.
The second section is that the text you’d just like the link to mention. If you allow it blank, the computer address are going to be used. The third parameter will contain an inventory of attributes you’d like else to the link. The attributes are often an easy string or associate associative array.
Here are some examples:
echo anchor('news/local/123', 'Anchor News', 'title="News Anchor"'); // codeigniter anchor Prints: <a href="https://onlinecode.org/index.php/news/local/123" title="News title">Anchor News</a> echo anchor('news/local/123', 'Aanchor News', array('title' => 'The best news!')); // anchor Prints: <a href="https://onlinecode.org/index.php/news/local/123" title="The best news!">Anchor News</a> echo anchor('', 'Click for Anchor'); // codeigniter anchor Prints: <a href="http://onlinecode">Click for Anchor</a>