Sunday, July 3, 2011

Re: get site url in cakephp

try with Router::url('/', true);
--
Lep pozdrav, Tilen Majerle



2011/7/3 Jerin <jerin.kalexander@gmail.com>
Hi , how to get site url in controller and view.The same built in
function available in CI.My objective is to get "localhost/
project_name" in development mode and "domainname.com" in production
in both view and controller. Is it possible in Cake.
I can write like this.

$data =  explode('/',$_SERVER['REQUEST_URI']);
echo $_SERVER['SERVER_NAME']."/".$data['1'];
But i think this is not a better way..

Thanx in advance.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: