Welcome Guest, Not a member yet? Register   Sign In
Templates & assets
#1

[eluser]Paulo Carvalho [/eluser]
Hi, community.
I want to create themes folder and keep it in assets folder located at:


/application
/assets
/themes
/my_theme
/template.php
/css
/js
/images
/uploads
/system


But my problem his how can I get to attach the views to my template in themes?
I am using carabiner to manage assets.
An reversing everything as:


/application/assets
/themes
/my_theme
/template.php
/css
/js
/images
/uploads
/system

does not work either, I cant even load carabiner in this aproach.
Im using simple templating system :
http://maestric.com/doc/php/codeigniter_template
Many thanks for responses in advance!
Paulo Carvalho
#2

[eluser]mast3rpyr0[/eluser]
You can create a controller which can load the views from
Code:
base_url().'assets/themes'
#3

[eluser]Paulo Carvalho [/eluser]
ok, think I have tried that, maybe in a wrong way, could you give me a more specific example, trying to learn my way up in CI.
#4

[eluser]porquero[/eluser]
Hi. I've used the same template system too.
But I found this solution that I think is better:


Controller
Code:
public function action()
{
   $data = array(
     'view' => 'view_name',
     'title' => 'Hello World'
   );

   $this->load->view('template_tpl', $data);

}

View
Code:
php + html

Template View
Code:
php + html
<?php $this->load->view($view); ?>
php + html

In file system
/application/views/template_tpl.php
/application/views/view_name.php

#5

[eluser]Paulo Carvalho [/eluser]
I see what you mean, but want to be able to upload a theme with:
/themes
/my_theme
/css
/js
default.php//template1
3cols.php// template 2
side_bar_right.php template 3

etc.
Now I cant find a way to do this as I can only load css/js from outside application folder, and I cant seem to load templates without being in views folder.
any thoughts, surely must be a solution there, Im just not skilled enough to find it.
#6

[eluser]porquero[/eluser]
Well, with your structure you are broken the used by CI.
I understand that you need render the view in your template.
And think that it could help you:

In the controller load view as variable and literally include the template:

Code:
$view = $this->load->view('template_tpl', $data, true);
include_once '/themes/default.php';

You need use the $view variable to load view result in the template.
I don't test it. I want help you only Smile
#7

[eluser]CroNiX[/eluser]
Look in index.php. You can set the location of the view directory to what you want. $view_folder. Don't know why they call it "folder", that's a gui term Smile




Theme © iAndrew 2016 - Forum software by © MyBB