2

I am trying to print some products using partial loops in Zend Framework. I am using this code in my view:

echo $this->partialLoop()->setObjectKey('product') >partialLoop('/_loops/singleProduct.phtml', $this->last_products);

It works, but I don't know how to use that parameter $this->last_products. I tried in singleProduct.php this code:

echo $this->product['name'];

but I've got an error: Notice: Key "product" does not exist in /usr/share/php/libzend-framework-php/Zend/View/Abstract.php on line 270

Actually, what I am triyng to write is $this->last_products['name'], but because I have partialLoop()->setObjectKey('product') I tought this is how it works. What am I doing wrong?

Thank you!

2
  • What sort of thing is $this->last_products? Is it an array? Commented May 30, 2013 at 13:36
  • Yes it an array. I've done a SELECT from DB and put the result there. So if I want to print the name of the product in view I must write echo $this->last_products['name']; Commented May 30, 2013 at 13:47

1 Answer 1

2

You can write it using $this->name

Sign up to request clarification or add additional context in comments.

1 Comment

I need 15 reputation. Help me get there and I'll you give up vote as well :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.