problem of link [solved problem] - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10) +--- Thread: problem of link [solved problem] (/showthread.php?tid=66607) Pages:
1
2
|
problem of link [solved problem] - alf78fr - 11-11-2016 Hello here my difficulty: I want to establish a link towards another view with this code: PHP Code: <H2 class="centrage"><A href="<?php echo site_url('Curriculum'); ?>">Contactez moi !</A></H2> I have an error 404 here the file //controllers/Homepage.php ( principal controller) PHP Code: <?php and here the file /config/config.php PHP Code: <?php I use codeigniter 3 thank you for your assistance RE: problem of link - Gustavo Martins - 11-11-2016 In simple english, your link is trying to access the controller 'Curriculum'!! Since 'Curriculum is a method of 'Homepage' controller, your link should be: PHP Code: <h2 class="centrage"><a href="<?php echo site_url('homepage/curriculum'); ?>">Contactez moi !</a></h2> RE: problem of link - dave friend - 11-11-2016 Try this Code: <H2 class="centrage"><A href="<?php echo site_url('homepage/curriculum'); ?>">Contactez moi !</A></H2> Or, since the "URL Helper" seems to be loaded Code: <H2 class="centrage"><?php echo anchor('homepage/curriculum', "Contactez moi !"); ?></H2> RE: problem of link - Wouter60 - 11-11-2016 Make sure you autoload the url helper in config.php. The link should be: PHP Code: <h2 class="centrage"><?php echo anchor('homepage/curriculum','Contactez moi !');?></h2> So, include the controller name, followed by the method in the controller. Only use lowercase in links to controller/methods. Also avoid uppercase for html tags. RE: problem of link - alf78fr - 11-12-2016 hello thank you for your assistance. but method: PHP Code: <h2 class="centrage"><?php echo anchor('homepage/curriculum','Contactez moi !');?></h2> give me URL following: http://127.0.0.1/codeigniter/homepage/curriculum is the error 404 RE: problem of link - alf78fr - 11-12-2016 otherwise if I employ PHP Code: <h2 class="centrage"><?php echo anchor('curriculum','Contactez moi !');?></h2> I have like answer "Not Found The requested URL /codeigniter/curriculum was not found on this server. Apache/2.4.17 (Win64) PHP/7.0.0 Server at 127.0.0.1 Port 80 RE: problem of link - dave friend - 11-12-2016 I have a suspicion so please humor me: What happens if you use this? PHP Code: <h2 class="centrage"><a href="http://127.0.0.1/codeigniter/index.php/homepage/curriculum">Contactez moi !</a></h2> RE: problem of link - alf78fr - 11-12-2016 that functions impeccably I have the good file RE: problem of link - dave friend - 11-12-2016 Quote:that functions impeccably Comme je l'attendais. My next guess is that you do not have an .htaccess file in place. (Documentation Here). It will allow you to construct URL's without "index.php" in them. If you use .htaccess (requires mod_rewrite) the examples first shared should work. RE: problem of link - alf78fr - 11-13-2016 I have the file .htaccess Code: RewriteEngine on and the option “rewrite_module” activated in apache |