[SOLVED] Redirect - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: [SOLVED] Redirect (/showthread.php?tid=65834) Pages:
1
2
|
[SOLVED] Redirect - davy_yg - 07-29-2016 Hello, Can anyone help me fix this navigation so that it could redirect to google analytics website? views/navigation.php PHP Code: <li><a href="<?php echo site_url('cpages/settings'); ?>"><i class="icon icon-th-list"></i> <span>Settings</span></a></li> Cpages/googleanalytics.php PHP Code: public function googleanalytics() { config/routes.php PHP Code: $route['cpages/googleanalytics'] = 'cpages/googleanalytics'; Views/googleanalytics.php PHP Code: <html> RE: Redirect - Wouter60 - 07-30-2016 Forget the whole thing about routing. Simply put the following code in your navigation.php file: PHP Code: echo anchor('https://accounts.google.com/ServiceLogin?elo=1','Google Analytics'); In order to use the anchor function, you need to load the url helper. It's a good idea doing that in the config/autoload.php file: PHP Code: $autoload['helper'] = array('url'); Besides that, if you want to link to URL's within your own website, you don't need to include site_url at all. This will do: PHP Code: echo anchor('cpages/settings','Settings'); And you DON'T need a routing if the url itself is good enough. A line like you have: PHP Code: $route['cpages/googleanalytics'] = 'cpages/googleanalytics'; Routing is needed if you want your url to point to a different controller/method. So this would make sense: PHP Code: $route['tools/googleanalytics'] = 'cpages/googleanalytics'; RE: Redirect - davy_yg - 07-30-2016 Hello, Can anyone help me fix the appearance that appear in the navigation for google analytics navigation tabs? This is what I try : views/navigation.php PHP Code: <li><a href="<?php echo anchor('https://accounts.google.com/ServiceLogin?elo=1','Google Analytics'); ?>"><i class="icon icon-th-list"></i> <span>Google Analytics</span></a></li> This is the original before revision: PHP Code: <?php <li><a href="<?php echo site_url('cpages/googlenalytics'); ?>"><i class="icon icon-th-list"></i> <span>Google Analytics</span></a></li> ?> Can anyone help me fix the code so that I achieve the same result? Thanks in advance. RE: Redirect - Wouter60 - 07-30-2016 Will this make clear how you should use the anchor function? PHP Code: <?php The anchor function builds the <a href="..."> </a> tags for you, so you should not put those around the link yourself. Just take some time to read the documentation about the anchor function. RE: Redirect - davy_yg - 07-31-2016 views/navigation.php PHP Code: <li><a href="<?php echo anchor('https://accounts.google.com/ServiceLogin?elo=1','Google Analytics'); ?>"><i class="icon icon-th-list"></i> <span>Google Analytics</span></a></li> After I click "Google Analytics" then it starts: http://127.0.0.1/CompanyGiondaCI/index.php/cpages/%3Ca%20href= This is the page: An Error Was Encountered The URI you submitted has disallowed characters. RE: Redirect - Wouter60 - 07-31-2016 Of course you get an error. You didn't do anything with the reply I gave you yesterday at 7:30 am. RE: Redirect - InsiteFX - 08-01-2016 Hello Wall! RE: Redirect - GoodWin - 08-02-2016 (07-31-2016, 06:53 PM)davy_yg Wrote: views/navigation.php Remember <a href="..., if you use a anchor(...) RE: Redirect - davy_yg - 08-02-2016 PHP Code: <li><a href="<?php echo anchor('www.google.com','Google Analytics'); ?>"><i class="icon icon-th-list"></i> <span>Google Analytics</span></a></li> If I click the link, this link appears: htp://127.0.0.1/CompanyGiondaCI/%3Ca%20href= , I wonder why? ( I expect it goes to www.google.com) RE: Redirect - Wouter60 - 08-03-2016 I wonder why you ignore the helpful tips and solutions that other forum members are giving you. You're asking the same questions over and over again. If you don't understand what's wrong with an anchor(..) link between <a href=""> and </a> tags, then you aren't up to working with CodeIgniter yet. First learn to understand php, html, css and javascript. Now, you're asking how to build a house, but you have no idea what bricks and boards are for. No wonder why the number of replies to your posts is declining. It seems that every minute we spend on helping you, is a waste of time. I suggest that you lock yourself up for 3 days and spend all the time you have on reading the CI documentation (which is really good!). I don't mean to be rude, but if that doesn't bring you any further, please drop your ambition to become a CI developer. |