Friday, April 23, 2010

Re: Rendering text from a controller action?

On Apr 23, 10:50 am, Thomas Allen <thomasmal...@gmail.com> wrote:
> In a given action, how can I manually render text? I'm thinking of an
> analog to "render :text" in Rails.

In what sense? Do you mean that you want to output plaintext headers
also? Or, just toss some text back to the browser?

controller:
$this->layout = 'text';
$this->set('the_text', 'foo');

your_text_action.ctp:
echo $the_text;

layouts/text.ctp:
echo $content_for_layout;

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate