Welcome Guest, Not a member yet? Register   Sign In
vars in config / route.php

Hi I am creating a website in more languages. I have 9 maingroups in 4 languages.

I want to create (if possible) something like this:


But I want to put the string 'women|men|shoes|kids|bodywear|eyewear' as a varibele. But I cannot find if it is possible to do something like so:

foreach ($tree as $node) {

$pages = implode('|' , $maingroups)
$route[$pages] = 'maingroups';

Can someone help? Thanks and kind regards.

Yes, you can use variables, etc in your routes file to build your routes.

I don't know where you're getting $tree from. When the routes file has been read in, you don't have access to much of the CodeIgniter code so it would all depend on where that variable was coming from. Without that info I can't say if that exact code is possible.

Have you tried it?


Then the index method of the maingroups controller would look like:
public function index($type = null)
  echo $type; //$type will be women, or men, or shoes, etc.

Theme © iAndrew 2016 - Forum software by © MyBB