How to Create a URL in Controller like HtmlHelper

Viewed 20347

TLDR: How can I create a URL in the Controller similar to how I can use the HtmlHelper to create URLs in a View?


Problem:

I want to print the url of a controller action, in my controller (because I create my JSON string in my controller, not in a view)

In a View, I can use $this->Html->url(), but what about in a Controller?

Should I use defined constant like APP_DIR + Controller name + Controller action?)

1 Answers
Related