Welcome Guest, Not a member yet? Register   Sign In
How to set this up?
#1

[eluser]jaswinder_rana[/eluser]
Hi:

i am planning on adding a feature to my site where users can select which template they want.

What I am not sure about is where to put templates and directory structure?

I could use include() statements and create it but I was hoping to stick with CI structure. Right now (if nothing works) then my plan was

Code:
-system
--application
---views
----templates
-----template_1
------template_1.php

-public_html
--assets
---modules  (Using http://codeigniter.com/wiki/Asset_Helper/)
----template_1
-----css
-----image
-----js

Is that right way to go?


Also, when users select templates, right now, they select it from drop down which is populated after reading templates directory in views.
Is that right method or should I store template list in table?
#2

[eluser]jaswinder_rana[/eluser]
Please anyone?
#3

[eluser]garrettheel[/eluser]
in /views/ make a new folder for each new theme you want. Then, when you load pages, you can use $this->load->view($theme, 'page');

Otherwise, you could do this with the template library I posted..

http://ellislab.com/forums/viewthread/99892/

Code:
$this->load->library('template');

// name of theme
$this->template->dir = 'dark';

// renders the page views/dark/page.php
$this->template->render('page');
#4

[eluser]jaswinder_rana[/eluser]
Thanks. And that library looks promising and easy to use.

My main problem here is CSS and JS. I understand that they shouldn't be in views folder. So, it means I need to go with similar structure for them. I was hoping to avoid that and check if there's another solution but seems not.

So far, after reading few threads, I have come up with following.

Code:
-system
--application
---views
-----VIEW_1
-----VIEW_2
----themes
-----theme_1
------header.php
------footer.php
-----theme_2
------header.php
------footer.php

-public_html
--assets
---modules  (Using http://codeigniter.com/wiki/Asset_Helper/)
----theme_1
-----css
-----image
-----js
----theme_2
-----css
-----image
-----js

What I am trying to avoid is, having to copy views. In this case, my views will be same and only header and footer will change. So, it doesn't make sense to have views for all themes.

But, I think there might be another way that your library can be used.

- I can go with my method and then change themes
But I can combine it with your template and have different output formats like

Code:
-system
--application
---views

-----HTML
------VIEW_1
------VIEW_2
-----themes
------theme_1
-------header.php
-------footer.php
------theme_2
-------header.php
-------footer.php
------VIEW_1
------VIEW_2

----RSS
-----themes
------theme_1
-------header.php
-------footer.php
------theme_2
-------header.php
-------footer.php

I can't (yet) see cons to this method. As you can see, just throwing the idea around has helped me enhance my original structure a bit.

I just want someone to look at this and suggest if I am going the right way or not


Thanks




Theme © iAndrew 2016 - Forum software by © MyBB