If you need to print the complete current url you can do following steps.
1. In the view file code will go like this:
<?php echo $this->here; ?>
This syntax'll give you the absolute url starting from hostname i.e. /controller/action/params
2. And if you just need the current URL from hostname. The code will be go like this
<?php echo Router::url( $this->here, true ); ?>
This syntax'll give you the full url
3. The upper two cases are used for cakephp version < 2, If you are using cakephp version 3 then you have write the following code
$this->Url->build(null, true)
This syntax'll give you the full url as in cakephp 3.
0 Comment(s)