How to integrate html template in codeigniter

I am new to codeigniter. please tell me how can I integrate or install html theme / template in codeigniter? (my path to the css folder = news / css and the path to the application folder = news / application, where the news is my main folders)

-Thanks.

+4
source share
4 answers

This is a very simple and very powerful way to create templates in a code player, which is also very flexible.
http://news.dice.com/2013/02/18/how-to-build-a-to-do-app-with-codeigniter/

Ignore the title, most of the lesson is about setting up templates in CI.

Please note that I was first introduced to this method from a Jeffrey tutorial on net.tutsplus.com They all deserve to be tested: http://net.tutsplus.com/sessions/codeigniter-from-scratch/

edit - ok, this is good enough for publishing. So, in the tutorial on the template.php page, you will see

$this->load->view($maincontent); 

which is great. but it is much better:

 // load your header views $templatefolder = 'beta/'; if(isset($content01)) $this->load->view($templatefolder.$content01); if(isset($content02)) $this->load->view($templatefolder.$content02); if(isset($content03)) $this->load->view($templatefolder.$content03); // load your footer views 

so instead of calling the "maincontent" view, I added links to $ content1, $ content2, etc. Since we do if isset, none of them are required. this way you can easily send more than one view file to a template. Or not at all if you just show a message, etc. Also note that we have a template folder - this way you can easily reuse the template file for other website templates, even with the same content.

in your controller (similar to the tutorial) it will be

  $data['content01'] = 'codeigniterrawks'; $data['content02'] = 'mypetlion'; // beta template $this->load->view( 'template_beta', $data ); 

notice how simple it is if I want to include the same view files in a different template

  $data['content01'] = 'codeigniterrawks'; $data['content02'] = 'mypetlion'; // alpha template $this->load->view( 'template_alpha', $data ); 
+5
source

I came across this exact question about a week ago, this guide really helped me:

http://net.tutsplus.com/tutorials/php/an-introduction-to-views-templating-in-codeigniter/

To make a CSS url, I added "uri" to my libraries in config / autoload.php (it looks like this:

 $autoload['libraries'] = array('uri', 'database');) 

"type =" text / css "media =" screen "/">

the base_url function automatically returns all the base URLs of your site, i.e.

 http://localhost/news/ 

with an argument added to the end.

The reason for this is that if / when you ever need to migrate servers, you simply change the base_url in the configuration file and automatically update all your templates and sources.

0
source

Try it,

I use it and it is very powerful.

https://github.com/philsturgeon/codeigniter-template

0
source

Try it,

I use this and it is a very easy way. http://dkinfotech.3eeweb.com/CodeIgniter_Template.zip

for more updates http://dkinfotech.3eeweb.com

-1
source

All Articles