can't get link to work |
Have you tried loading the url helper in your controller (before it loads the view from you index function)?
Then, in the view, put the following code: PHP Code: <?php echo anchor('products/details/' . $product->id, $product->name);?> The url helper will include your base_url path. (03-26-2016, 01:20 AM)Wouter60 Wrote: Have you tried loading the url helper in your controller (before it loads the view from you index function)? PHP Code: <?php
Post your details view code here so we can look at it.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(03-26-2016, 03:33 AM)InsiteFX Wrote: Post your details view code here so we can look at it. PHP Code: <div class="row details">
Like I said: in the index function:
PHP Code: public function index(){ (03-26-2016, 03:43 AM)Wouter60 Wrote: Like I said: in the index function: Just done that and now when I click on the link I get: Access forbidden! You don't have permission to access the requested object. ERROR 403. My routes.php look like this: PHP Code: //$route['(:any)'] = 'products/details';
Check your config.phg file in application/config.
Does it have a value for $config['index_page'] ? If you let .htaccess skip the index.php part of your URL's, you must leave it blank in config.php: $config['index_page'] = ''; (03-26-2016, 04:51 AM)Wouter60 Wrote: Check your config.phg file in application/config. Yes it is left blank in the $config['index_page'] = ""; My .htaccess file is in the root and looks like the following: PHP Code: Options +FollowSymLinks
If you have a folder named "products" in the root of your website, then url routing will fail because the folder has the same name as your Products controller.
Please try to rename this folder to "product_catalog". (03-26-2016, 06:02 AM)Wouter60 Wrote: If you have a folder named "products" in the root of your website, then url routing will fail because the folder has the same name as your Products controller. The products folder is not in the root. I have renamed it anyway to productscat and updated the .htaccess and the products.php file in the VIEWs folder. Still getting the Access Forbidden! Error 403. The link on the products page at http://localhost/thegamingplace is showing as http://localhost/thegamingplace/?products/details/1"> above the photos. When I change the link in products.php in the Views folder back to the original PHP Code: <a href="<?php echo base_url(); ?>products/details/<?php echo $product->id; ?>"> then when I click on the link it shows the correct url http://localhost/thegamingplace/products/details/1 and doesn't give me the ERROR 403 BUT doesn't show the details page it just stays at the products page. When I use the f12 inspect element in the browser it shows the correct link for each product. It's just not loading the details page in place of the products page. |
Welcome Guest, Not a member yet? Register Sign In |