url undefined - render not working - Discussion ---
We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

\Phalcon\Mvc\Url --- url undefined - render not working

Hello, Please help me with no information about the reason I did not know why the system was working suddenly started to give this error.

Thank you in advance.

<b>Notice</b>:  Undefined variable: url in <b>/home/biletalsat/public_html/apps/frontend/views/layouts/category-listMethod-Showcase.phtml</b> on line <b>123</b><br />
<br />
<b>Fatal error</b>:  Uncaught Error: Call to a member function get() on null in /home/biletalsat/public_html/apps/frontend/views/layouts/category-listMethod-Showcase.phtml:123

Stack trace:

#0 [internal function]: unknown()
#1 [internal function]: Phalcon\Mvc\View\Engine\Php-&gt;render('../apps/fronten...', Array, false)
#2 [internal function]: Phalcon\Mvc\View-&gt;_engineRender(Array, 'layouts/categor...', false, false)
#3 [internal function]: Phalcon\Mvc\View-&gt;partial('layouts/categor...', NULL)
#4 /home/biletalsat/public_html/apps/frontend/views/index/index.phtml(2): Phalcon\Mvc\View\Engine-&gt;partial('layouts/categor...')
#5 [internal function]: unknown()
#6 [internal function]: Phalcon\Mvc\View\Engine\Php-&gt;render('../apps/fronten...', Array, true)
#7 [internal function]: Phalcon\Mvc\View-&gt;_engineRender(Array, 'index/index', true, true, NULL)
#8 [internal function]: Phalcon\Mvc\View-&gt;render('index', 'index')
#9 /home/biletalsat/public_html/public/index.php(158): Phalcon\Mvc\Application-&gt;handle()
#10 /home/biletalsat/public_html/public in <b>/home/biletalsat/public_html/apps/frontend/views/layouts/category-listMethod-Showcase.phtml</b> on line <b>123</b><br />

I added it to ControllerBase.php;

$this->view->url = $this->url;

Problem solved. But I didn't understand what it was like when it was working without doing so. I was working before adding this command.

How is the url service defined in your bootstrap file?