Yes, I meant "display" not "view". I can show what I did for one of my
own sites wit a modified PagesController to fetch content from the
database.
public function display($slug = null)
{
if (empty($slug))
{
$slug = 'index';
}
$data = $this->Page->find(
'first',
array(
'fields' => array(
'Page.title',
'Page.slug',
'Page.content',
),
'conditions' => array('Page.slug' => $slug),
'recursive' => -1
)
);
if (empty($data))
{
$this->cakeError('error404');
}
else
{
$this->set(compact('data'));
$this->_setPageTitle($data['Page']['title']);
if ($slug == 'index')
{
$this->layout = 'index';
$this->render('index');
}
}
}
On Mon, Aug 27, 2012 at 3:28 PM, Mariano C. <mariano.calandra@gmail.com> wrote:
> I have just one "problem". I used Page, cause I need no action, matter of
> fact, i'm using default action (i.e. display) I should ovverride the default
> display() and change on my need. It's possible? How could change it.
>
> Il giorno lunedì 27 agosto 2012 20:18:04 UTC+2, cricket ha scritto:
>>
>> And change your controller:
>>
>> public function view($slug = null)
>>
> --
> 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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>
>
--
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Monday, August 27, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment