I'm new to Akelos but I'm used to Ruby On Rails and I'd like to do this : I've created a table "Entry" using migrations and I'd like to show all the entries in the db.
So this is my code [code] <?php
class EntryController extends ApplicationController { function index(){ $Entry = $this->find('all'); } }
?>
[/code]
The template (index.tpl) [code]foreach ($Entry as $Person){ echo $Person->title; }[/code]
Could you tell me what's wrong?
CommentAuthorinsanet
from what you show us i would say it should be: $this->Entry = $this->Entry->find('all'); and the rest is ok, it should work this way.
CommentAuthorreyntjensw
Thanks, Now I have this in my controller:
function index(){ $this->Entry = $this->find('all'); }
and this in my view:
foreach ($this as $Person){ echo $Person->title; }
But now I'm getting an undifined method error.
Is there still something wrong?
CommentAuthorinsanet
yes i forgot the model,i edited it just right now. =). see above again
CommentAuthorreyntjensw
There is just 1 more problem and the problem I'm having is that I see this on my screen :
foreach ($this as $Person){ echo $Person->title; }
It isn't executed:s, am I still doing things wrong?
The controller is the same as above and the view looks like this:
foreach ($Entry as $Person){ echo $Person->title; }
Thanks for your help:)
CommentAuthorinsanet
but there is any errors showing up?. this is not gonna work by the way ->foreach ($this as $Person) it should be ->(from the view)foreach ($Entry as $Person) and if you want to do it inside the controller-> foreach ($this->Entry as $Person)
CommentAuthorreyntjensw
I'm feeling extremely dumb, I forgot to put the php tags around it! Thanks for your help, I've got it now!