Welcome Guest, Not a member yet? Register   Sign In
Template
#1

[eluser]dudzartiaga[/eluser]
Hi Everyone,

I am new to web development and I have simple question regarding Template 1.4.1.

I have 7 regions as shown below. My default controller renders those regions in template and it was good (See index method below). However, I would like to see the same layout, but with different content. Exactly the same except for content region.

I am wondering if there's a way I can achieve what I want without writing again the same command in index method. A one liner code probably or two. Can you show me how?

I tried the override in write_view and I can't make it work or I misunderstood the use of it. See add function below.

Code:
$template['default']['regions'] = array(
   'headerstyles',
   'header',
   'banner',
   'rightfilter',
   'content',
   'scripts',
   'footer',
);

Index method
Code:
public function index()
{
    $this->template->write_view('headerstyles', 'headerStyles');
    $this->template->write_view('header', 'header');
       $this->template->write_view('scripts', 'scripts');
       $this->template->render();
}
Add function. addItem is existing and elements in addItem is rendered but without the other regions.
Code:
public function add()
    {
        $this->template->write_view('content','addItem','',true);
        $this->template->render();
    }

Thank you very much!
#2

[eluser]CroNiX[/eluser]
It might help to tell us what "template 1.4.1" is and where you got it from, since it's not a part of stock CI. There are many template libraries out there.
#3

[eluser]dudzartiaga[/eluser]
It is a Colin Williams's Template plugin. Here's the url. http://williamsconcepts.com/ci/codeignit.../template/




Theme © iAndrew 2016 - Forum software by © MyBB