Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to echo out current URL in Cake's view?

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 135
    Comment on it

    Hello Readers ,

    If you want to echo out the current URL in cakephp then follow the below codes.

    Current URL: http://example.com/controller/action/?query=12

    We can do it this way like.

    <?php echo $this->request->here; ?>
    

    By using this above one line code It will give you the prefect/complete url from the hostname i.e. /controller/action/params

    Or if you want the full URL with host name you can use the code like this.

    <?php echo Router::url( $this->here, true ); ?> 
    

    which will give you the full url with the hostname.

    That's it.

    Happy Coding

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: