Welcome Guest, Not a member yet? Register   Sign In
Help for htacces or routing
#2

(This post was last modified: 04-07-2017, 04:13 PM by PaulD.)

Hi,

I think the language part of your question is a seperate issue all by itself.

In response to this:

Code:
- http://localhost/brands
- http://localhost/brands/apple
- http://localhost/brands/apple/macbook-13-retina

Without routes you could easily achieve this in one controller.

controller Brands.php
PHP Code:
public function index($brand=''$product='') {
 
    ...
 
    if (!empty($product)) {
 
         // call your product model and do whatever
 
         // or redirect without a refresh
 
    } else if (!empty($brand)) {
 
         // call your brand model and do whatever
 
    } else {
 
        // show all brands
 
    }


Or with routes you could do
PHP Code:
$route['brands/:any/:any'] = 'catalog/product_lookup/$1/$2';
$route['brands/:any'] = 'catalog/brand_lookup/$1';
$route['brands'] = 'catalog/all_brands'

Hope that helps,

Paul.

PS Routes docs are here: https://www.codeigniter.com/user_guide/g...uting.html
Reply


Messages In This Thread
Help for htacces or routing - by gbwebapps - 04-07-2017, 03:46 PM
RE: Help for htacces or routing - by PaulD - 04-07-2017, 04:08 PM
RE: Help for htacces or routing - by gbwebapps - 04-07-2017, 04:11 PM
RE: Help for htacces or routing - by PaulD - 04-07-2017, 04:20 PM
RE: Help for htacces or routing - by gbwebapps - 04-08-2017, 10:16 AM
RE: Help for htacces or routing - by gbwebapps - 04-12-2017, 01:46 PM



Theme © iAndrew 2016 - Forum software by © MyBB