-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Partial does not return string, but renders partial automatically #543
Comments
This is not a bug, it's a feature that I do not like the ;) |
According to the documentation for
So I'm not sure which to believe :) |
Maybe the function prototype is wrong but this function doesn't return a string. If you need to get a view as a string you can use getRender in Phalcon\Mvc\View: $this->view->getRender('partials', 'my-view', ['someVar' => $value]); |
Don't like that either, echo $this->partial('thepartialfile', $data) is a very common used feature among other php frameworks |
I also need to "$this->partial()" return a string. Should be in the function of the third parameter "$returnAsString = false". |
@phalcon Is there a chance of getting one more param inside of partial function to return rendered contents as a string? |
@piteer1 I think this is already implemented in 1.3.2 |
@phalcon It seems third argument is NOT supported in 1.3.2. $this->partial('bam/bam', array(), true)
BadMethodCallException: Wrong number of parameters
#0 /path/to/src/app/views/post_treatment/update.js.php(21): Phalcon\Mvc\View\Engine->partial('patient/card', Array, true)
#1 [internal function]: Phalcon\Mvc\View\Engine\Php->render('/Users/khoan/cl...', Array, true)
#2 [internal function]: Phalcon\Mvc\View->_engineRender(Array, 'post_treatment/...', true, true, NULL)
#3 [internal function]: Phalcon\Mvc\View->render('post_treatment', 'update', Array)
#4 /path/to/src/public/index.php(128): Phalcon\Mvc\Application->handle()
#5 {main} |
I think this issue hasn't been merged. |
this workaround does the job |
According to this issue #27 and documentation, partial should return rendered string. Instead it returns
null
and automatically adds it's content to the template without need ofprint/echo
.The text was updated successfully, but these errors were encountered: