title: How to get the root directory of CakePHP?
body: <p>I've got a view with a formular (which isn't created with the form helper).
  For example, I have CakePHP installed in a folder called 'myfolder1'.</p>
  
  <p>So my formular starts with that line:</p>
  
  <pre><code>&lt;form id="ctrlAddForm" method="post" action="/myfolder1/ctrl/add" accept-charset="utf-8"&gt;
  </code></pre>
  
  <p>But if I rename the root folder, I have to edit all formulars (2 yet).
  Is there any constant or function which represents the root directory / name?</p>
  
  <p>I've read about the constant <a href="http://book.cakephp.org/view/35/Advanced-Installation" rel="noreferrer">ROOT</a>. Should I use that variable?</p>
  
  <p><strong>Solution</strong></p>
  
  <ol>
  <li>You can define a constant ROOT_NAME in app\webroot\index.php with <code>basename(ROOT)</code>.</li>
  <li><p>You can use the HTML Helper function <a href="http://book.cakephp.org/view/1448/url" rel="noreferrer">url()</a>. For example in the action attribute of the form tag:</p>
  
  <p><em>$this->Html->url(array('controller' => 'ctrl', 'action' => 'add'));</em></p></li>
  </ol>