![]() |
Problem using anchor tag (solved) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Problem using anchor tag (solved) (/showthread.php?tid=23930) |
Problem using anchor tag (solved) - El Forum - 10-26-2009 [eluser]stormlead[/eluser] hi1 i just got my first problem solved and was into new one again, Now i got the css linked and to move further i just wanted to link to a new page. for which i wrote Code: <?php echo anchor('system/application/views/welcome_message.php','click here');?> Can any one tell me how to properly link a document. Problem using anchor tag (solved) - El Forum - 10-26-2009 [eluser]rogierb[/eluser] you can only link to a controller. Not to a view file Code: <?php echo anchor('my_controller/my_method/var_1','click here');?> Problem using anchor tag (solved) - El Forum - 10-26-2009 [eluser]stormlead[/eluser] @rogier ok i got it we can't linka view, but still my problem is the error anchor function undefined. i.e. But i get a an error saying call to undefined function. Problem using anchor tag (solved) - El Forum - 10-26-2009 [eluser]stormlead[/eluser] Also now if i remove the anchor function and write as below Code: <a href="system/application/controllers/next.php" style="text-decoration:none;" class="style1"> click here</a> Fatal error: Class 'Controller' not found in C:\wamp\www\CodeIgniter_1.7.2\system\application\controllers\next.php on line 3 the code for my controller next is Code: <?php Problem using anchor tag (solved) - El Forum - 10-26-2009 [eluser]BrianDHall[/eluser] Code: <a href="/next" style="text-decoration:none;" class="style1"> click here</a> Problem using anchor tag (solved) - El Forum - 10-26-2009 [eluser]BrianDHall[/eluser] Oh duh, silly me - I just reread and found your problem. anchor() is an optional helper, you must load it if you want to use it: http://www.codeignitor.com/user_guide/helpers/url_helper.html Problem using anchor tag (solved) - El Forum - 10-26-2009 [eluser]stormlead[/eluser] @Brian i did not understand where we have to load the url helper. and i am really not getting how to link a page. Please help through this following are the codes which i am writting welcome.php Code: <?php Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> and in controller for next.php the code is Code: <?php Problem using anchor tag (solved) - El Forum - 10-26-2009 [eluser]stormlead[/eluser] i have loaded the helper and the anchor is working but now anchor returns this url http://localhost/CodeIgniter_1.7.2/index.php/system/application/controllers/next which give 404 error. i want to link the click here to welcome_message.php which is in views . Please help me for doing this. Problem using anchor tag (solved) - El Forum - 10-26-2009 [eluser]stormlead[/eluser] P Problem using anchor tag (solved) - El Forum - 10-26-2009 [eluser]jedd[/eluser] Show the anchor line. (I think this has already been covered.) |