CodeIgniter URL helper

<?php
echo site_url('gallery/landscape/777/'); // returns 'http://site.com/gallery/landscape/777/'

echo base_url('/css/style.css'); // same as site_url but without the 'index_page' or 'url_suffix'

echo current_url(); // returns the full URL of the currently viewed page (including segments)

echo uri_string(); // returns '/gallery/landscape/777/' on page 'http://site.com/gallery/landscape/777/'

echo anchor('gallery/listing', 'View gallery listing'); // HTML anchor link

echo mailto('email@site.com', 'Contact author by email'); // email link

echo safe_mailto('email@site.com', 'Contact author by email'); // javascript obfuscated version of email link

$string = auto_link($string); // automatically turns URLs and email addresses contained in a string into links

redirect( site_url('users/login/') ); // redirects to page

?>

Leave a Reply

Your email address will not be published. Required fields are marked *