CodeIgniter Forums
i can link from my home page - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: i can link from my home page (/thread-40005.html)



i can link from my home page - El Forum - 03-26-2011

[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


i can link from my home page - El Forum - 03-26-2011

[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.