Welcome Guest, Not a member yet? Register   Sign In
Major Site development
#1

[eluser]LDMajor[/eluser]
Hi all
I am pretty new with CodeIgniter so far i built only 1 site with it

Now i am Upgrading my site and i would like to use CodeIgniter
The Site structure is like a Magazine or so

right blocks left blocks
and a center big block

in my previous site i had a static header and footer so i just did
called the HEADER view

now i got a block of random pics a points table etc

so my question is how do i make the code "clean" what can i do for each block
in stand of copy paste the code in each controller and copy paste the same code in every view file

thanks ahead
Dan.
#2

[eluser]Mirage[/eluser]
You can still use page fragments in the same way you used to.

If you have a need to place something dynamic into the view which you don't want to prep in every controller you should probably use a view helper. Alternatively you can also call on a model or library directly to have the data generated.

HTH,
m
#3

[eluser]LDMajor[/eluser]
[quote author="Mirage" date="1222730406"]You can still use page fragments in the same way you used to.

If you have a need to place something dynamic into the view which you don't want to prep in every controller you should probably use a view helper. Alternatively you can also call on a model or library directly to have the data generated.

HTH,
m[/quote]
i have a little question
if i will make a model
that returns an array
{
$data['rblock']=...
$data['lblock']=...
return $data;
}

and than call the function
$data= fuc();
than $data['rblock'] will get the content from the function?
#4

[eluser]textnotspeech[/eluser]
I'm not sure if this is what you're looking for but I've made a library that auto configs my header view to keep the controllers clean. There's full documentation so you could check it out and see if this is something that interests you. You could use the header implementation as a guide to build your rblocks and lblocks as well.

Header Class Extension

I made this class to avoid having to use template engines, but that may also be something to look into.
#5

[eluser]Mirage[/eluser]
[quote author="LDMajor" date="1222831696"]
i have a little question
if i will make a model
that returns an array
{
$data['rblock']=...
$data['lblock']=...
return $data;
}

and than call the function
$data= fuc();
than $data['rblock'] will get the content from the function?[/quote]

I'd say yes. But if you actually tried it, you'd know the answer. :-)

On the topic of segmenting your views you can just put your header into a separate view file and load it inside the you page view template. That's how I segment repeated page blocks.

somepage.php view
Code:
....
<body>
    <div id="header">&lt;?php $this->load->view('header')?&gt;</div>
    <div>Content</div>
&lt;/body&gt;
..

HTH,
m




Theme © iAndrew 2016 - Forum software by © MyBB