1

Hello all im new to codeigniter and new to the hole template system. så i hope some one will help me out and maybe look at my code and see if i can do something better so i can learn something new :).

i have try to install this template system williamsconcepts.com/ci/codeigniter/libraries/template/index.html

but i just cant get it to work, so i found this template system maestric.com/doc/php/codeigniter_template

but i dont know how to add a sidebar and footer function to it.

and i have try for 3 days now and just dont know what to do :/. You can not see my project any longer here https://github.com/SimonJ/Hip-hop-project

Best Regards Sjmon

1
  • 3
    Welcome to the site. Please refer to the FAQ. This site is for reviewing working code, not for fixing issues. You're question is better asked on StackOverflow most likely. Feb 1, 2011 at 19:41

1 Answer 1

1

Your question should be asked on Stackoverflow.com - but I'll answer it for you anyway as I know when questions are moved so too are comments and answers.

I haven't used the abvoe two mentioned template libraries, but if you try Phil Sturgeon's template library you might find it easier: http://philsturgeon.co.uk/code/codeigniter-template

Sidebars and footers would be view partials. Basically a view partial is a view stored in a variable. You technically don't need a templating system to do this as you can simple go:

$data['header']  = $thos=>load->view('header', '', TRUE); // Returns a view as data
$data['sidebar'] = $this->load->view('sidebar', '', TRUE); // Returns a view as data
$data['footer']  = $this->load->view('footer', '', TRUE); // Returns a view as data

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

Then in your content view file which in this case is called content.php located in your application/views directory you could go:

<?php echo $header; ?>
<?php echo $sidebar; ?>
<?php echo $footer; ?>

I however do recommend Phil's library as it is a lot nicer than storing views in variables.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.