Tuesday, 3 June 2014

Define Variable Path in Php & jQuery

How to define path in Php

1: define it in core.php file in cakephp

define('HTTP_ROOT','http://'.$_SERVER['HTTP_HOST'].'/');


2: define third-party url in expression engine

define('HTTP_THIRD_PARTY','https://'.$_SERVER['HTTP_HOST'].'/system/expressionengine/third_party/');

3. defines route path in cakephp 

Router::connect('/', array('controller' => 'Homes', 'action' => 'index'));

Router::connect('/admin', array('controller' => 'users', 'action' => 'login', 'prefix' => 'admin', 'admin' => true, 'layout' => 'default'));


How to define path in jQuery

var host = window.location.host;
var proto = window.location.protocol;
var ajax_url = proto+"//"+host+"/";

0 comments:

Post a Comment