• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how can Multiple Template Directories system

#1
[eluser]Blue Sapphire[/eluser]
Hi!
How can I implement multiple templates system. Like in PHPBB, from admin , when admin selects a template, then all front end is converted to that particular template system.

In other words, I want to implement different look and feel of website for different regions, keeping same backend controller.

Can some one guide me in this regards.

Thanks in advance

#2
[eluser]Phil Sturgeon[/eluser]
First off, you need a themes folder. Inside that you can put all your css, images and views for each theme.

themes
-- themename
-- -- css
-- -- imgs
-- -- views
etc...

Then in your admin panel somewhere set up a page that returns a list of all themes. One such way is...

Code:
foreach(glob(APP_DIR.'themes', GLOB_ONLYDIR ) as $theme)
$theme_name = basedir($theme);
$themes[$theme_name] = humanize($theme_name];
}

then use that array in a dropdown or whatever and save the theme name in the db somewhere.

Good luck Smile

#3
[eluser]Blue Sapphire[/eluser]
Thanks for guidance. But my problem is that, how can programmer/developer can make CI compitible for multiple layouts.

Thanks in advance

#4
[eluser]Phil Sturgeon[/eluser]
The last post covered management but not implementation. I remember thinking at the time that may have only been half the picture.

This is the recreated basics, I obviously have this all coded up much nicer.

Code:
$this->load->view('../assets/themes/'.$this->settings->item('default_theme').'/views/layout.php', $data);

Obviously here I am using a my settings library to get the name of the theme we stored in the database before. I use a single layout.php instead of header/footer and pass the page body as a string to this file.

Let me know if you need more!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.