Get the application's url to a box on a page (not curl)

As some may know some cmses can place boxes on their pages. So if i create an application, you know, using $application = new \Phalcon\Mvc\Application($di); and i could in its controller/action create another application maybe with the same di (or not, not important know) and capture its output into a box

$this->view->setVar("fancybox", $applicationbox->handle()->getContent());

Is this a bad approach in whatever terms? Memory? Something else? Is there a better approach for such getting contents quite independently from another route and get its contents? Forwarding seem to me not a good option.

You can move the functionality to a class and call it on both parts,

$this->view->setVar("fancybox", Myclass::getFancySomething());


5.6k
edited Sep '15

Thank you for your answer Andres. It's late in the area i live i thing heavily now.

I was logged out 2 times before i was able to present my point.

So very briefly this time. I would need something like that i get full processed controller/action/params (not forgetting POST) like in URL but not using curl. I can only imagine new $appllication2 adding new or old $di to it , trying to use somewhere $router->handle("/employees/edit/17") if i can. But even it works, for 10 such boxes/applications it can be much resources.

So i try to find out whether is there a better or more optimised approach.

You know Myclass::getFancySomething() - there is no initialize here if Myclass is MyclassController, maybe some events wont be fired if getFancySomething() is getFancySomethingAction()