Posted by Doug Hays on the 11th of January, 2010 at
11:13 pm under CakePHP. This post has no comments.
In order to call CakePHP from non-CakePHP code, we will copy index.php from /app/webroot and put it into our non-CakePHP codebase as cakephp.php.
Then, we’ll create a function requestCakePHP that requires the cakephp.php file:
function requestCakePHP($url)
{
// Set the url parameter for cakephp
$_GET['url'] = $url;
require_once 'cakephp.php';
// Fire up CakePHP and buffer results
ob_start();
$Dispatcher= new Dispatcher ();
$Dispatcher->dispatch($url);
return ob_get_clean();
}
?>
Then, whenever we need to call for some Cake, we just call requestCake with the URL minus the hostname:
echo requestCakePHP("/webpages/view/2");
In the example above, I have a webpages controller, a view action and am viewing webpage #2.
Posted by Doug Hays on the 17th of March, 2009 at
4:02 pm under CakePHP. This post has 145 comments.
I needed to test some CakePHP code on a client’s 1and1 server today, so I dropped my CakePHP app in a subdirectory (called agents2) on his site. But, after doing so, I kept getting “Class ‘Configure’ not found”. Luckily, I stumbled upon this blog post over at kushaura.com which saved me.
The core issue was with my root .htaccess file which needed to be changed to:
RewriteEngine on
RewriteBase /agents2/
RewriteRule ^$ app/webroot/ [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) app/webroot/$1 [L]
And that did the trick.
Thanks, Kushaura.com!
Posted by Doug Hays on the 29th of April, 2008 at
11:20 am under CMS, CakePHP and MySQL. This post has 910 comments.
We have written a very basic CMS system (just like everyone else has) that we use on a handful of our clients’ websites. We wanted a CMS system that was:
- Easy to deploy
- Simple to re-skin when provided an HTML/CSS design
- Search Engine Friendly
- Easy enough that non-technical people could administer the content of the site
- Lightweight enough so that the system could be the foundation of a larger application or website
- Built using CakePHP and MySQL
After looking around the web for 5 minutes, and not finding anything, we decided to build it ourselves. So, here it is, Dingus CMS.
In order to install and use Dingus CMS:
- You’ll need a basic PHP/MySQL/Apache environment. (Note: PHP 5 is recommended and Apache needs mod_rewrite)
- Download the source.
- Extract the source into the document root of your website. Note that the app, cake, docs, etc… directories should be at the root of your site
- Configure the database connection in app/config/database.php
- Run the SQL in sql/dingus_cms_db_setup.sql
- Go to http://localhost and you should be up and running!
Note that Dingus CMS comes with built-in search and site map pages available at http://localhost/search.html and http://localhost/site-map.html
Finally, you may be wondering what a Dingus is. You’ll have to stay tuned for a full explanation.