Skip to content

Instantly share code, notes, and snippets.

@lucasff
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucasff/b1cb6494dc169a11e7ec to your computer and use it in GitHub Desktop.
Save lucasff/b1cb6494dc169a11e7ec to your computer and use it in GitHub Desktop.
CakePHP params on JavaScript
<?php
/** @var View $this */
$paths = array();
$paths['sid'] = $this->Session->id();
$paths['domain'] = $_SERVER['SERVER_NAME'];
$paths['basename'] = $this->base;
$paths['basePath'] = Router::url('/');
$paths['controller'] = $this->params['controller'];
$paths['action'] = $this->params['action'];
$paths['url'] = $this->params['url']['url'];
$paths['here'] = $this->here;
$paths['params'] = array(
'controller' => $this->params['controller'],
'action' => $this->params['action'],
'named' => $this->params['named']
);
echo $this->Js->value($paths);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment