Welcome Guest, Not a member yet? Register   Sign In
Newbie - Template, Views & Controls
#1

[eluser]Unknown[/eluser]
Hi all!

I'm just starting with Codeigniter and I have one doubt... probably very basic, but it's a doubt.

I created a control, some kind of date picker, with its own view. I want to use inside another view that I want to be the template for the whole site.

I understood that, inside this master view, I can use
Code:
<?php $this->load->view('my_dtpicker_view'); ?>
to load the date time picker view with the html controls.

My original idea was to have one master controller for each area of the site, using the template view.

What I didn't understand yet is how to reuse the code of the date time picker controller inside the master controller. I thought that I would *load* the controller just like I loaded the *view*.

Can anybody explain how to do that?

Maybe this is the right way to do what I want. The point is that I don't want to have any of the code I already wrote inside the date time picker controller, inside this master controller.

Thanks again, I'm sorry if this is anywhere of the forums but I couldn't find anything...
#2

[eluser]WanWizard[/eluser]
Have a look at Modular CI.

It allows you to create modules for each of your widgets, each with their own controllers, models and views if needed. From your master controller you call the module controller, which contains all logic for that module.
You can combine that with a template library (such as the one from Colin Williams or Phil Sturgeon) to make it easy to process tempates (so you don't have to include CI code in your views.




Theme © iAndrew 2016 - Forum software by © MyBB