Search code examples
phpcodeigniterhta

Mixing of static and dynamic pages in CodeIgniter


I'm trying to mix static and dynamic content in a CodeIgniter 3.1 tailored website. I'm using the tutorial example given for the static content:

$route['default_controller'] = 'pages/view';
$route['(:any)'] = 'pages/view/$1';

I'm afraid this would be quite messy for the purpose, since (:any) is too generic and I don't want to use something like "/static/(:any)" route.

Any suggestions on how to achieve a solution that let me have a static and controller named friendly URL?

Every idea is welcome and very much appreciated.


As my question seems to be difficult to understand, I'll try to ask it once again:

Is there a way to combine static content with the above code (from codeigniter tutorial) and the usual approach http://example.com/controller/index_named_method dynamic content handling?

Can you give an example?

Should I change $route['(:any)'] for every static webpage's name i.e.: $route['(home|contact|links)'] ?

Thanks in advance


Solution

  • Well, I must say that I got to an answer myself; as said in my previous post editing, mixing static and dynamic content using index() method in your Controller taking advantage of the tutorial example can be accomplished adding a route with all your controllers name like this:

    $route['(books|flowers|links)'] = '$1';

    Thanks to those who helped.