Best CodeIgniter 4 anchor() URL Helper function

codeigniter anchor-url helper Function anchor in codeigniter

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 = '')

Parameters:

  • $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.

anchor in codeigniter

Note

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.

See also  Fix - Cannot find module 'request' error in Node.js - cannot find module request

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.

Don’t Miss : PHP 30 days Trial Period Date checking using MYSQL

Here are some examples:

echo anchor('news/local/123', 'Anchor News', 'title="News Anchor"');
// codeigniter anchor Prints: <a href="https://infogrepper.com/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://infogrepper.com/index.php/news/local/123" title="The best news!">Anchor News</a>


echo anchor('', 'Click for Anchor');
// codeigniter anchor Prints: <a href="http://infogrepper">Click for Anchor</a>


Read More :

Leave a Comment