Welcome Guest, Not a member yet? Register   Sign In
Question about url structure
#1

[eluser]soundseller[/eluser]
Hi,
I have everything set up and working.

My URLS currently look like this:
Code:
http://mydomain/news_archive/article_02_12_2012.html
I am using:

Code:
$route['news_archive/(:any)'] = "news_archive";

In the controller I use:
Code:
$url_title = $this->uri->segment(2);

And then get the correct article from the database

I would like to sort my articles in sub-folders like this:
Code:
http://mydomain/news_archive/02_12_2012/article.html

How could this be achieved?
Thnx in advance.
#2

[eluser]CroNiX[/eluser]
Code:
$route['news_archive/(.*)/(.*)'] = "news_archive/your_method/$1/$2";

In news_archive:
Code:
public function your_method($folder_name = '', $article_name = '')
{
  //$folder_name = segment 2
  //$article_name = segment 3 (you don't have to use $this->uri->segment(3) as the route will pass it to the method)
}
#3

[eluser]soundseller[/eluser]
Hi CroNiX,
thnx for your fast reply.
Works like a charm Smile

Code:
$route['news-archive/(:any)/(:any)'] = "news-archive";
#4

[eluser]soundseller[/eluser]
Yours works too of course.




Theme © iAndrew 2016 - Forum software by © MyBB