Saturday, February 26, 2011

RE: pages_controller

Not sure what you're getting at?

The view is the "guts" of the page. View gets dropped into the layout. Index
page has a fat header with 400px high. Im not going to code that into every
view div header this view and internal pages do not have a fat header so why
put that inside the view every time? Imagine changing the image in every
page or just 1 layout header?

2 layouts left_default or right_default by saying this->layout which ever I
want I can change the page look do not have to go into each view and re-code
the cols

Example layout

<div id="container">
<div id="header"><?php echo $this->Element('block_header',
array('cache' => forever)); ?></div>
<div id="sub_nav"><?php echo $this->Element('crumb_block',
array('cache' => forever)); ?></div>
<div id="content">
<div id="l_230"><?php echo $this->Sidebar->getSidebar(); ?>
</div> <= my side gets dropped in here
<div id="r_710"> <?php echo $content_for_layout; ?></div>
<= my view html gets dropped in here
</div>
</div>
<div id="footer"><?php echo $this->Element('block_footer', array('cache' =>
if I feel like it)); ?></div>


Ok changed my mind

<div id="container">
<div id="header"><?php echo $this->Element('block_header',
array('cache' => forever)); ?></div>
<div id="sub_nav"><?php echo $this->Element('crumb_block',
array('cache' => forever)); ?></div>
<div id="content">
<div id="1_710"> <?php echo $content_for_layout; ?></div>
<= my view html gets dropped in here
<div id="r_230"><?php echo $this->Sidebar->getSidebar(); ?>
</div> <= my side gets dropped in here

</div>
</div>
<div id="footer"><?php echo $this->Element('block_footer', array('cache' =>
if I feel like it)); ?></div>


All I had to do was $this->layout = default_left to default_right, never
touched the view could not be easier than that.


If I want to use a different layout use left_side or right side I can just
use either layout. Your not saying code each view with left_col right_side
inside the view? So if you want to change from left to right or see what it
looks like you have to recode the view....

I guess your layouts are just empty?
Your view files, you hardcode code the layout cols inside every view?
<div left_col>all left data, navigation</div>
<div right>all your code</div>

Anyways thanks for just answering a question with a question :)

-----Original Message-----
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of Ryan Schmidt
Sent: Saturday, February 26, 2011 8:39 PM
To: cake-php@googlegroups.com
Subject: Re: pages_controller

On Feb 26, 2011, at 15:58, Krissy Masters wrote:

> the pages controller.
>
> I understand the basic idea of rendering static pages display => some_page
> but how can you define different layouts for each rendered static page?
>
> All I can guess is pages_controller:
>
> function index (){
> $this->layout = 'default_index';
> }
>
> function about() {
> $this->layout = 'default_internal';
> }
>
> And just skip the display function. link directly to the action
controller
> = > pages , action => index
> Am I wrong?

Why do your static pages have different layouts? I would have expected your
static pages (and your dynamic pages too, for that matter) to use the same
global layout, and only need a separate view file.

--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help
others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at
http://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: