Welcome Guest, Not a member yet? Register   Sign In
Multi theme Website
#1

[eluser]Blue Sapphire[/eluser]
Hi!
How can a multi theme website be developed in CI. Currently only one theme can be loaded. And there is no functionality for dynamically loading/setting other theme then default.

Iam talking this in lines of PHPBB forum. As all you know, from PHPBB admin, an administrator can set any available theme by selecting from drop down menu of themes. And after setting another theme, website automatically loads that selected theme [not default].

Can this functionality be made in CI.

Thanks in advance
#2

[eluser]Sarfaraz Momin[/eluser]
The best example you have is webber. Download the latest version for www.drsoft.com and check how it is done in it. Its worth the money they charge. Its built on top of CI so you would understand how they have done it.

Have a good day !!!
#3

[eluser]Jelmer[/eluser]
Hey Blue Sapphire,

I don't allow my users to do it, so I don't have any tips on that front. But in my system the site administrator can switch between designs. The way I allow for multiple designs is by putting every design in its own folder and name the views the exact same way (or at least the wrapper that loads any other stuff):
Code:
views/template 1/wrapper.php
views/template 2/wrapper.php
views/template 3/wrapper.php

and then load your view by:
Code:
$this->load->view($user_prefs['template'].'/wrapper', $data);

Now just figure out how to save/load the $user_prefs and your systems allows for multiple themes...
#4

[eluser]cescopag[/eluser]
[quote author="Jelmer" date="1224968638"]Hey Blue Sapphire,

I don't allow my users to do it, so I don't have any tips on that front. But in my system the site administrator can switch between designs. The way I allow for multiple designs is by putting every design in its own folder and name the views the exact same way (or at least the wrapper that loads any other stuff):
Code:
views/template 1/wrapper.php
views/template 2/wrapper.php
views/template 3/wrapper.php

and then load your view by:
Code:
$this->load->view($user_prefs['template'].'/wrapper', $data);

Now just figure out how to save/load the $user_prefs and your systems allows for multiple themes...[/quote]

I've done something similar. I have a splash screen where the user can choose the theme, then I store it in the session data. I've made a custom function within my main controller that I use to load each view:

Code:
function __loadView($view, $data = array(), $render = FALSE) {
    if ($this->session->userdata('theme')) {
         $theme = $this->session->userdata('theme');
    } else {
         $theme = 'default';
    }
    return $this->load->view($theme.'/'.$view, $data, $render);
}

In my controller instead of using $this->load->view(...) I just use $this->__loadView(...)
#5

[eluser]fatnic[/eluser]
Wouldn't it just be simpler to use a different stylesheet?
Code:
$data['stylesheet'] = 'style1.css';
$this->load->view('view', $data);
and in the view file load in the stylesheet dynamically.
Code:
<link type="text/css" rel="<?= $stylesheet ?>" />
#6

[eluser]AndrewR[/eluser]
@fatnic No, because in a lot of instances, themes will use different HTML markup as well.
#7

[eluser]Thorpe Obazee[/eluser]
I believe InkType is multi-themed. I am just not sure.
#8

[eluser]JayTee[/eluser]
[quote author="AndrewR" date="1225062365"]@fatnic No, because in a lot of instances, themes will use different HTML markup as well.[/quote]
Have you ever seen the crazy things people do on css zen garden? http://www.csszengarden.com/ It's all the same markup with wildly different results by only changing the stylesheet and image source.

Most other 'themed' apps (like EE's control panel for example) have their theme changed based on a strict set of markup with different set of images and stylesheets.

I'd go with Jelmer's suggestion otherwise - dynamic templates based on the user's preference would probably be the easiest to implement.
#9

[eluser]AndrewR[/eluser]
[quote author="JayTee" date="1225095656"][quote author="AndrewR" date="1225062365"]@fatnic No, because in a lot of instances, themes will use different HTML markup as well.[/quote]
Have you ever seen the crazy things people do on css zen garden? http://www.csszengarden.com/ It's all the same markup with wildly different results by only changing the stylesheet and image source.

Most other 'themed' apps (like EE's control panel for example) have their theme changed based on a strict set of markup with different set of images and stylesheets.

I'd go with Jelmer's suggestion otherwise - dynamic templates based on the user's preference would probably be the easiest to implement.[/quote]
Yes, and I've actually contributed to one. However, you'd be hard pressed to find theme developers who will adhere to existing markup. Most will find it easier to write their own markup.

I think that going the WP route, and just having folders with your own markup/styles/images is the best way. Just define which theme in the database, and then have that theme name the directory name, and load the views with that variable of the theme name.




Theme © iAndrew 2016 - Forum software by © MyBB