At a guess, I'd say that your /posts/index action isn't returning the
data correctly.
This is roughly what it should look like: excuse the dodgy formatting.
class PostsController extends AppController {
... snipped ...
function index() {
$posts = $this->Post->findAll();
if(isset($this->params['requested']) {
return $posts;
}
$this->set('posts', $posts);
}
}
This means the posts index will work both if you go to it directly and
if you use it in a requestAction.
Hope that helps!
Tufty
On Dec 13, 5:58 am, Fabian <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I'm trying to gather data from 2 different models (2 different tables)
> and I want to place them on my layout.
> I read something about using a requestAction so I did the following:
>
> function index()
> {
> $this->set('archives', $this->Archive->findAll());
> $this->set('posts', $this->requestAction('/posts/index'));
>
> }
>
> so on my layout I have
>
> <?php foreach ($archives as $archive): ?>
> <input type="textbox" name="setting1" value="<?php echo
> $archive['archive']['user']; ?>"/>
> <?php endforeach; ?>
>
> <?php foreach ($posts as $post): ?>
> <input type="textbox" name="setting2" value="<?php echo $post['post']
> ['created']; ?>" />
> <?php endforeach; ?>
>
> the first one gets the archive user and that one works, but the second
> one , which I used the table posts created on the 15 min tutorial
> doesn't get the data. Can anyone tell me what I'm doing wrong?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---