We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

[HELP] Rendering template from helper

Hey, what's up!

I have been trying to render a stand-alone template from my custom helper, here's my code:

https://gist.github.com/Baruch4413/c2780c5d37a64d6636fa80cadb271987

(The code has been simplified)

No matter what path I set up for the view object, I always end up with an error message like this: *View '/path/to/view' was not found in any of the views directory

I've tried several things now, including using other methods for rendering (getRender, render, partial), setting up different view directories to the view object (Relative, absolute).

Question is: Is it possible to render a template from a helper? If so, how to do it?

Thanks in advance.



145.0k
Accepted
answer
edited Mar '17

Yes it is, you just need to provide correct path. Post your structure, where is this listinghelper etc things. Also you should use getRender or something like this, partial is for other tasks.