title: CakePHP multi-site file system organization with shared functions
body: <p>I have a CakePHP 1.3 mutli-site installation in the server. Each site has its own folder, and they all load the CakePHP core libraries from one same place. This is how it looks like:</p>
  
  <ul>
  <li>[cake] (cake's core libraries)</li>
  <li>[sites]
  <ul>
  <li>[site 1]
  <ul>
  <li>[app]</li>
  <li>[plugins]</li>
  <li>[vendors]</li>
  <li>.htaccess</li>
  <li>index.php</li>
  </ul></li>
  <li>[site 2] <em>(also with its own app, plugins and vendors folders)</em></li>
  <li>[site 3] <em>(also with its own app, plugins and vendors folders)</em></li>
  <li><em>etc</em></li>
  </ul></li>
  </ul>
  
  <p>I find myself many times in the situation where I want to implement some functions that I would like to use in all of the apps, but so far I just replicate the code inside each site. I would like to be able to declare those functions in one place and be able to call them from any site. I believe <strong>vendors</strong> could have something to do with this, but I've been looking in the cookbook and I can't figure out how to use that in my case.</p>
  
  <p>Any help would be much appreciated! </p>
  
  <p><strong>UPATE</strong></p>
  
  <p>So by looking at the vendors, it seems to me (maybe I'm wrong) that it would work in my case if the functions in those vendors files don't need to directly interact with other CakePHP classes (for example Session, Auth, etc). I'll give an example of one of the things I'm trying to do, maybe that helps to understand better what I'm trying.</p>
  
  <p>Each of the sites has its own login system (using cake's <strong>Auth</strong>). One of the things I want to do is, when a user logs in (the login() function in UsersController is called), have there a function that does some processing with the username of the user, and then calls the <strong>Session->flash()</strong> function to insert there a message (the message changes depending on that processing the function makes). So this function needs to use the <strong>User</strong> model and the <strong>Session</strong> model.</p>
  
  <p>Can I do this using vendors, so I declare this one function (i.e. <strong>processLogin()</strong>) in a vendor, and all the sites can use that function? If so, how? If not, is there any other way to do this?</p>