Can anybody help me out with this?
I’m trying to loop through arrays to put into a template and show multiple posts on a page using the template. But I cannot get this to work and I don’t know why. I’m very new to OOP and don’t fully understand it. This seems generic and it should be easy to do but I keep having problems.
I can get it to work if I type the arrays in manually, but that doesn’t help me if I pull data from a database and loop through it.
here’s what i’m talking about: from this class:
I can’t get this part to work in the template
`$template->assign(‘items’, array(
array(‘name’ => ‘First’),
array(‘name’ => ‘Second’)
));
I’m trying to use this to display arrays pulled from the database with now luck.
(guess you can only post code once in a post, lets quote it)
>
$names = array(‘test1’, ‘test2’, ‘test3’);
> $names2 = array(‘test2 1’, ‘test2 2’, ‘test2 3’);
>
>
>
$template->assign(‘people’, array(
> array(‘name’ => $names),
> array(‘name2’ => $names2)
> ));
any help….please.