Welcome Guest, Not a member yet? Register   Sign In
Confused with my view layer
#1

[eluser]Crabby[/eluser]
Hi guys

One thing that still confuses me is organising my views.

I'm developing an application where each section will have a different layout so the only way I can think of doing it, is to have a seperate layout template for each section is this correct, I seem to end up with lots of view files?

For example:

My home page is a three column layout with various movable modules.

I have a blog template that has a two column layout that lists the articles in the main content section and dynamic data (which have seperate views) down the right hand side such as archives, categories etc.

forum, that has a menu down the left and a search bar at the top.

There's various other layouts, so my view layout has to be pretty flexible could anybody advise on the best way to achieve this?

Any help would be much appreciated

Thanks in advance

Crabby
#2

[eluser]ejangi[/eluser]
Hi,

I'm not 100% sure I understand what you're looking at and what you're after, but here's a couple of suggestions:
- You can put views into folders within the views folder. Check out "Storing Views within Sub-folders".
- If you're looking to cut down duplication of headers and footers etc... you can use something like this.

I hope this helps somehow!
#3

[eluser]John_Betong[/eluser]
Hi Crabby,

What you want is hindsight as to the best way to use your views!

AXON Idea Processor - A Visualization Tool for Thinkers

I recently came across the above program which could easily create a detailed wire-frame site layout. There is free Lite version that has a limitation of saving files with less than 30 entitities. The first version was created way back in Dec 1992.

I am looking forward to see the ideas that this thread produces.

Cheers,

John_Betong
 
#4

[eluser]Crabby[/eluser]
Hi guys

Thanks for your replies, I'll check out the links.

I find it really hard to explain, but I just want to know the best way to have flexible layouts I guess....

I have an outer template

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
&lt;title&gt;&lt;?=title?&gt;&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
<div id="header">&lt;?=$header?&gt;</div>
<div id="content">&lt;?=$content?&gt;</div>
<div id="footer">&lt;?=$footer?&gt;</div>
&lt;/body&gt;
&lt;/html&gt;

and with in the $content variable there could be varied layouts IE my blog layout;

//blog layout (inner template)
Code:
<div id="articles">
&lt;? foreach $articles as $article?&gt;
.....
&lt;? endforeach ?&gt;
</div>
<div id="side_bar">
  &lt;?=$blog_categories?&gt;
  &lt;?=$blog_archives?&gt;
</div>

//blog categories
Code:
<div class="blog_menu" id="blog_categories">
&lt;? foreach $categories as $category?&gt;
.....
&lt;? endforeach ?&gt;

//blog archives
Code:
<div class="blog_menu" id="blog_archives">
&lt;? foreach $dates as $date?&gt;
.....
&lt;? endforeach ?&gt;

I'm not sure I like the way I'm doing it
#5

[eluser]sandwormusmc[/eluser]
I would say equate the views in CI to "views" in databases. The views in CI are the ways you are presenting your data physically yanked from the DB by the model and programmatically processed by your controllers.

Whenever you need to actually present new data (i.e. the data for a blog page would be different than, say, for a photography page), use a different view. Outside of that, tie the look & feel aspect of your site to CSS.

I've used the asset helper (http://codeigniter.com/wiki/Asset_Helper/) with some success in order to be able to use CI functions within CSS files. It may an ugly hack, but outside of reconfiguring Apache to parse PHP in CSS files (not an option in my case), I kept my CSS files as views and loaded those from my main header file. Sorry probably got a little OT there ... Tongue
#6

[eluser]Crabby[/eluser]
Thanks for your reply, this looks interesting http://ellislab.com/forums/viewthread/49910/




Theme © iAndrew 2016 - Forum software by © MyBB