I just wanted to quickly announce our new SEO Plugin for CakePHP. It provides an easy way to add SEO friendly URLs, page titles, and META fields to your CakePHP applications.
Installation
1. Add the MySQL table.
CREATE TABLE IF NOT EXISTS `seo_seos` ( `id` int(11) NOT NULL auto_increment, `related_model_id` int(11) NOT NULL, `related_model_name` varchar(255) NOT NULL, `title` varchar(255) NOT NULL, `description` varchar(255) NOT NULL, `keywords` varchar(255) NOT NULL, `slug` varchar(255) NOT NULL, `created` datetime NOT NULL, `modified` datetime NOT NULL, PRIMARY KEY (`id`), KEY `related_model_id` (`related_model_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
This table will hold the SEO metadata for each model record.
2. Download the code and drop it in your /plugins directory. The code is readily available at GitHub.
3. Add the fields to your forms
<fieldset>
<legend>SEO</legend>
<?php
if ($this->action == 'admin_edit') {
echo $form->input('Seo.id');
}
echo $form->input('Seo.slug');
echo $form->input('Seo.title');
echo $form->input('Seo.description');
echo $form->input('Seo.keywords');
?>
</fieldset>
4. Add the preparation code to beforeRender() in AppController.
function beforeRender() {
$this->SearchEngineOptimizer->prepare();
}
5. Add Seo.Seo to your $actsAs array in desired models or AppModel. Warning: Seo.Seo MUST come BEFORE Containable.
var $actsAs = array('Seo.Seo', 'Containable');
6. Add Seo.SearchEngineOptimizer to your $components array in AppController.
var $components = array('Auth', 'Seo.SearchEngineOptimizer');
7. Add $seo_for_layout to your /views/layouts/default.ctp (or whichever layout files you are using). It should look something like the following.
<title>
<?php echo $title_for_layout; ?> :: <?php echo Configure::read('website.general.name') . ' :: ' . Configure::read('Application.name'); ?>
</title>
<?php echo $seo_for_layout; ?>
8. Finally, add routes to make your URLs extra sexy. For example:
Router::connect('/recipes/*', array('controller' => 'recipes', 'action' => 'view'));
This should allow you to hit: http://mydomain.example/recipes/my-recipe-slug
Enjoy! Please let me know what I did wrong and what I did right. Suggestions and critiques are always welcome!
Mocha Shopping Cart, the leader in CakePHP eCommerce, is currently considering the move to open source. We want to give back to the CakePHP community for all that they have given us. At this time, we are very new to the open source business model and trying to figure out how to make it work. First and foremost, we need to see some traffic and interest before such a decision would ever be made. If you have not had a chance to try Mocha Shopping Cart feel free to sign up for a FREE beta developer account or a FREE stable account and let us know how you feel about it.
Stay tuned for more updates!
I spent a little bit of time testing out two CakePHP e-commerce solutions that I found today: BakeSale and CakeCart. I installed the latest versions of each and attempted to play around as much as I could. BakeSale seems to be the more mature of the two, but I couldn’t get BakeSale to install. I posted some on each of their forums with the issues I had while installing. So far I dont think either are a good solution for professional installations.
My BakeSale Forums Post
My CakeCart Forums Post
The burning question: Does anyone know of a solid E-Commerce solution written in CakePHP?
I am also looking for a forums solution as well. Please Comment!
Ulduar is coming out tomorrow! w00t! I have spent the past 2-3 hours developing a want list. Here it is!