Re: RE: pages_controller

2011-02-27 Thread OldWest
Wish I would have made it to this post earlier : ) ... I ran into the same 
issue and complicated it beyond belief! But it's as simple as stated above.

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


RE: pages_controller

2011-02-27 Thread Krissy Masters
LOL...right!

Thanks man. So simply overlooked.

K


-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: pages_controller

2011-02-27 Thread AD7six


On 26 feb, 22:58, "Krissy Masters"  wrote:
> Maybe because I never used it in my journey with Cake so far, but 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?

$this->layout = 'x';

in your view files. you don't need to change the pages controller at
all for that.

AD

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


RE: pages_controller

2011-02-26 Thread Krissy Masters
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


Element('block_header',
array('cache' => forever)); ?>
Element('crumb_block',
array('cache' => forever)); ?>

Sidebar->getSidebar(); ?>
 <= my side gets dropped in here
 
<= my view html gets dropped in here


Element('block_footer', array('cache' =>
if I feel like it)); ?>




Ok changed my mind 


Element('block_header',
array('cache' => forever)); ?>
Element('crumb_block',
array('cache' => forever)); ?>

 
<= my view html gets dropped in here 
Sidebar->getSidebar(); ?>
 <= my side gets dropped in here



Element('block_footer', array('cache' =>
if I feel like it)); ?>


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?
all left data, navigation
all your code

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+unsubscr...@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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: pages_controller

2011-02-26 Thread Ryan Schmidt
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: pages_controller

2006-09-15 Thread John Zimmerman
On 9/15/06, Chris Lamb <[EMAIL PROTECTED]> wrote:

On Fri, 15 Sep 2006 00:04:59 -0700, John Zimmerman wrote:> I have modified the default pages controller to add a few tweaks by> first copying it to my app directory.  I then renamed it to> static_controller.php, modifying the code and the views directory
> appropriately.Did you consider extending PageController instead? Being able to stillcall $this->display() is quite useful from a maintainability aspectimho, as this function is quite well known to most Cake'ers.
For my projects I found it much
more maintainable to separate the two controllers.  I wanted to  use
the 'Pages" name for a content management system, so it made sense for
me to just create the static_controller for static pages.
 > The way the default pages controller (which is now my 'static'
> controller) is setup it is not meant to have multiple actions defined.
What's wrong with multiple actions OOI? They will always return 404 ifyou do not have a view for them.With
multiple actions inside of the default pages controller requires you to
write a route entry for each action beyond the display action (as far
as I can tell).  Otherwise the pages/* route will try to send your
parameters to the display action.
I found it much cleaner to separate the two controllers rather than have 1 controller that required another route modification.Also
having that route modification (i.e. pages/dynamic ) or whatever your
new action would be called would cause a static page called '
dynamic.thtml' to no be displayed.  That is fairly minor, but is a
collision none the less.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: pages_controller

2006-09-15 Thread [EMAIL PROTECTED]

Chris Lamb: Nice. It worked when I modified the roues.php :) it was not
necessary to call the display function in test function. I had problems
passing variables through the url, so I discarded the idea of modifying
the original pages controller, and did it the same way as John did.

John Zimmerman: I just tried your suggestion and that worked very well.
(renamed pages_controller to static_controler and created my own "new"
pages controller.)

Thanks guys. I was totally stuck with that problem! It is really nice
when people have the patience to help us newbie's.

Best regards.
Asbjørn Morell.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: pages_controller

2006-09-15 Thread Chris Lamb


Afternoon.

On Fri, 15 Sep 2006 00:04:59 -0700, John Zimmerman wrote:

> I have modified the default pages controller to add a few tweaks by
> first copying it to my app directory.  I then renamed it to
> static_controller.php, modifying the code and the views directory
> appropriately.

Did you consider extending PageController instead? Being able to still
call $this->display() is quite useful from a maintainability aspect
imho, as this function is quite well known to most Cake'ers.


> The way the default pages controller (which is now my 'static'
> controller) is setup it is not meant to have multiple actions defined.

What's wrong with multiple actions OOI? They will always return 404 if
you do not have a view for them.


Regards,

lamby


-- 
 Chris Lamb, Cambs, UK  WWW: http://chris-lamb.co.uk
  Q. Why is top posting bad? GPG: 0x634F9A20
  A. Because it breaks the logical sequence of discussion


signature.asc
Description: PGP signature


Re: pages_controller

2006-09-15 Thread John Zimmerman
I think you might be happier if you split the functionality into two different controllers.I have modified the default pages controller to add a few tweaks by first copying it to my app directory.  I then renamed it to static_controller.php, modifying the code and the views directory appropriately.
I then created my own new 'pages_controller.php' which is actually a content management system.The way the default pages controller (which is now my 'static' controller) is setup it is not meant to have multiple actions defined.
On 9/14/06, Chris Lamb <[EMAIL PROTECTED]> wrote:
Evening.On Thu, 14 Sep 2006 14:43:17 -0700, [EMAIL PROTECTED] wrote:> I have added my own function to the pages_controller:>> function test() {
>   $this->set('abc', 'something');> }> The controller does load the correct view! (test.thtml) But the $abc> var is Undefined!What's happening is that the routes are configured so that all URLs in
the form "/pages/" actually call the display() function inpages_controller, regardless of what  is.You can confirm this by putting " die('in test function') " inside
test() - it won't get called.As for a solution. try adding another route in core/routes.php:$Route->connect('/pages/test', array('controller' => 'pages', 'action'=> 'test'));And then modify pages_controller.php:
function test() {$this->set('abc', 'something');$this->display()}Might be a nicer way of doing it, however.Regards,--lamby-- Chris Lamb, Cambs, UK  WWW: 
http://chris-lamb.co.uk  Q. Why is top posting bad? GPG: 0x634F9A20  A. Because it breaks the logical sequence of discussion


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: pages_controller

2006-09-14 Thread Chris Lamb


Evening.

On Thu, 14 Sep 2006 14:43:17 -0700, [EMAIL PROTECTED] wrote:

> I have added my own function to the pages_controller:
> 
> function test() {
>   $this->set('abc', 'something');
> }
 
> The controller does load the correct view! (test.thtml) But the $abc
> var is Undefined!

What's happening is that the routes are configured so that all URLs in
the form "/pages/" actually call the display() function in
pages_controller, regardless of what  is.

You can confirm this by putting " die('in test function') " inside
test() - it won't get called.


As for a solution. try adding another route in core/routes.php:

$Route->connect('/pages/test', array('controller' => 'pages', 'action'
=> 'test'));

And then modify pages_controller.php:

function test() {
$this->set('abc', 'something');
$this->display()
}


Might be a nicer way of doing it, however.


Regards,

--lamby


-- 
 Chris Lamb, Cambs, UK  WWW: http://chris-lamb.co.uk
  Q. Why is top posting bad? GPG: 0x634F9A20
  A. Because it breaks the logical sequence of discussion


signature.asc
Description: PGP signature