CodeIgniter Forums

Full Version: i can link from my home page
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Unknown[/eluser]
hi, i am new to codeigniter,

i ve a site that i can link from my home page to other page using the anchor link,

my base url is http://localhost/shop/, error 404 is always showing anything i click on a link. i dont may be is the base url or my anchor which i used as this anchor("welcome/contact us").

pls i need ur help.

your
bola

El Forum

[eluser]sofwan[/eluser]
for using anchor syntax, you need to insert "$this->load->helper('url');" in your controller or load it in your autoload.php, in array helper,
$autoload['helper'] = array("url");

Then, you can write echo anchor("class_name/function_name") in your view, for example in your case : echo anchor("welcome/contact us"). (Your url is not correct ("welcome/contact us"), "contact us", it's a function name, should not has a space, you can replace with anchor ("welcome/contactus") or anchor("welcome/contact_us");

echo anchor("welcome/contact_us")
--> welcome : Name of class in your controller
--> contact_us : Name of function in your controller.

It goes to the function if we click the url, if the function is not available, it shows us error 404.

Thank you.