Attilitus
01-05-2007, 03:36 PM
I am sure it is something silly, either that or it can't be done at all.
This is what I mean:
I have a script that allows me to:
In php I can get the right value by putting:
$myarray[$increment]->fieldtodisplay
Which will pull all fields from the result list that I queried in the previous function.
Now whenever I try to add the above variable into a templating system it will only output the first value. The query itself is working fine, it is just the display end of it. For example if I go to the "next page" it will display the correct FIRST ENTRY of that page.
Entry into template is: {$myarray[$increment]->fieldtodisplay}
Is there anyway to get templates to correctly display ALL values of custom arrays?
Here are some examples of what I want to do:
<?php
// define array
$artists = array('Metallica', 'Evanescence', 'Linkin Park', 'Guns n Roses');
// loop over it and print array elements
for ($x = 0; $x < sizeof($artists); $x++) {
echo '<li>'.$artists[$x];
}
?>
</ul>
</body>
</html>
When you run this script, here's what you'll see:
My favourite bands are:
* Metallica
* Evanescence
* Linkin Park
* Guns n Roses
Taken right off of zend.com
echo functions will display the correct value when displayed within the for() loop, but not when outside.
When defining a variable within the for() loop a value is assigned correctly and displayed in the template, but only the last one. (not the list).
I need to have a variable pulled by a template display the entire list. Could anyone point me in the right direction?
I really appreciate any help you guys can give me.
This is what I mean:
I have a script that allows me to:
In php I can get the right value by putting:
$myarray[$increment]->fieldtodisplay
Which will pull all fields from the result list that I queried in the previous function.
Now whenever I try to add the above variable into a templating system it will only output the first value. The query itself is working fine, it is just the display end of it. For example if I go to the "next page" it will display the correct FIRST ENTRY of that page.
Entry into template is: {$myarray[$increment]->fieldtodisplay}
Is there anyway to get templates to correctly display ALL values of custom arrays?
Here are some examples of what I want to do:
<?php
// define array
$artists = array('Metallica', 'Evanescence', 'Linkin Park', 'Guns n Roses');
// loop over it and print array elements
for ($x = 0; $x < sizeof($artists); $x++) {
echo '<li>'.$artists[$x];
}
?>
</ul>
</body>
</html>
When you run this script, here's what you'll see:
My favourite bands are:
* Metallica
* Evanescence
* Linkin Park
* Guns n Roses
Taken right off of zend.com
echo functions will display the correct value when displayed within the for() loop, but not when outside.
When defining a variable within the for() loop a value is assigned correctly and displayed in the template, but only the last one. (not the list).
I need to have a variable pulled by a template display the entire list. Could anyone point me in the right direction?
I really appreciate any help you guys can give me.