So I'm using a custom function in a page controller to get some data objects, and then display them in the template. Sounds simple, but I can't get it to work.
Here is my function in the page controller:
function getProducts() {
---$Products = array();
---$ProductIDs = array('10,'22','50');
---foreach ($ProductIDs as $key => $value) {
------$Products[$key] = $this->getProductByID($value);
---}
---return $Products;
}
And in the template...
<% control getProducts %>
---$Title
---$Image
---<hr>
<% end_control %>
But no data appears. However, if I put "return $Products[0]" in the function, it successfully returns a Product object and displays the $Title etc...