Welcome Guest, Not a member yet? Register   Sign In
Noob help required! Please!
#6

[eluser]GamingFusion[/eluser]
for my site i used a very simple template structure.

in the folder i created a folder called "template".

then created the following file inside of it.

template.php
header.php
footer.php

As far as code goes i created my template in dreamweaver(1 file) and then cut the code from the top to the end of my sidebar.php code and pasted it into header.php then i took the code from the start of my footer code to the end of the file and put that into footer.php

also in the header i did some extra stuff for titles and such. for a css file i put this

Code:
<link rel="stylesheet" href="http://localhost:888.com/css/<?php if(!isset($css)){ echo 'styles.css';}else{echo $css . '.css';;} ?>" type="text/css" media="screen" />

which basically says if the variable $css is set then place the value if not then place a default value(which can be a css file or nothing)

for template.php i did this

Code:
<?php
$this->load->view('includes/header.php');

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

$this->load->view('includes/footer.php');
?>

now for loading the content when you load the view in the controller dont load the view file you want to load, load the template file. For example

Code:
function index()
{
     $data['title'] = 'Page Title';
     $data['css'] = 'style';
     $data['content'] = 'main';

     $this->load->view('template/template', $data);
}

now if you watched the video tutorials you will know what that code does.

The content variable is the view file you want to load.(the .php extension is not needed).

if any of that is confusing here a video i a guy using the same system in his video. His video is for a website login/register but the template system is all the same.

http://net.tutsplus.com/videos/screencas...y-6-login/

or pm me


Messages In This Thread
Noob help required! Please! - by El Forum - 11-27-2009, 12:53 PM
Noob help required! Please! - by El Forum - 11-27-2009, 12:56 PM
Noob help required! Please! - by El Forum - 11-27-2009, 01:03 PM
Noob help required! Please! - by El Forum - 11-27-2009, 01:30 PM
Noob help required! Please! - by El Forum - 11-27-2009, 04:19 PM
Noob help required! Please! - by El Forum - 11-27-2009, 11:13 PM
Noob help required! Please! - by El Forum - 11-28-2009, 03:02 AM
Noob help required! Please! - by El Forum - 11-28-2009, 03:14 AM
Noob help required! Please! - by El Forum - 11-28-2009, 01:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB