13/07/2009 |
Publié dans
cakephp
Quelques bonnes adresses CakePHP vues entre le 07/07/2009 et le 13/07/2009:
- Cascading Dynamic Meta Tags and Page Titles in CakePHP 1.2
- Une méthode pour gérer les meta données de page en cascade dans CakePHP, par Jamie Nay.
- code.cakephp.org/cake3/branches/master
- Cake3 ? On n'a pas même pas vu passer la 1.3, et encore moins le 2… Grosse surprise de la CakeFest#3 qui vient de s'achever à Berlin, l'annonce de cette nouvelle version de CakePHP basée sur PHP 5.3 et prenant en compte ses spécificités par Nate Abele lors de sa keynote…
- Uploader (File Upload Plugin)
- Signé Miles Johnson, un plugin très complet et très détaillé pour gérer les uploads de fichiers, et en particulier les images. Un de plus me direz-vous…
- CakePHP Status Dashboard
- Un plugin multifacette de Matt Curry qui permet de mettre en place très simplement un tableau de bord pour un site, avec monitoring système, Google Analytics… On peut faire ses propres widgets et c'est prometteur.
Plus sur ma page delicious CakePHP.
23/10/2008 |
Publié dans
cakephp
Quelques bonnes adresses CakePHP vues entre le 22/10/2008 et le 23/10/2008:
- CakePHP Ajax Chat Plugin - Updated for RC3 and Now Using jQuery :: PseudoCoder.com
- Un plugin de chat en Ajax, codé avec jQuery et compatible RC3, c’est chez PseudoCoder. Demo disponible.
- Optimiser les URL pour le référencement
- Retour de Pierre-Emmanuel Fringeant après quelques semaines de silence, avec un article sur la réécriture d’URL pour le référencement. Par rapport à mon vieil article sur le sujet, Pierre-Emmanuel utilise la méthode du core Inflector::slug pour générer la partie “textuelle” de l’URL (et non le sluggable behavior comme moi) et ajoute la gestion du “duplicate content” et une expression régulière pour contrôler le “slug”.
- MailChimp API Component w/ helper (Articles) | The Bakery, Everything CakePHP
- Une intégration à CakePHP de l’API de l’outil de gestion de newsletter Mailchimp. Un truc que j’envisageais… Cool. Spontanément, j’aurais plutôt fait un behavior ou un datasource, cependant qu’un composant. A regarder plus en détail.
- How to create multirecord forms
- Un tutorial de Marcel Raaijmakers (aka Marcelius) sur la bakery, avec un composant, qui explique comment mettre en place des formulaires permettant d’éditer plusieurs enregistrements simultanément.
Plus sur ma page delicious consacrée à CakePHP.
21/09/2008 |
Publié dans
cakephp
La classe Router permet, à travers le ficher de configuration routes.php, de se mitonner des URLs aux petits oignons pour son application. On peut également utiliser sa méthode url de manière statique et c’est très pratique. Petit échantillon avec deux exemples d’utilisation.
Lire la suite de ce post »
15/03/2008 |
Publié dans
cakephp, seo
(in English, for a change)
Pretty URLs
CakePHP easily produces URLS as http://www.mysite.com/post/view/456. Not too bad. But using the title of the post in the URL can slightly improve the relevancy of the link as seen by Google or other robots. For this, simply use the “Sluggable” Behaviours from Mariano Iglesias. It’s here. It helps generating string as “my-post-about-sea-and-shells” from the fields you want in your model. Very handy. A little bit of route tickering and you’ll have URLs such as http://www.mysite.com/post/view/my-post-about-sea-and-shells/
-
Router::
connect(‘/posts/:id/:slug’,
array(‘controller’ =>
‘posts’,
‘action’ =>
‘view’),
array( ‘pass’ =>
array(‘id’,
’slug’),
‘id’ =>
‘[\d]+’ ));
quick tip : if you want your content to appear in Google News, the URLs of each post must include a three digit number. So you’d better leave the id as it is (and even pad it with extra zeros).
keywords and description
Yes, these are basic concerns: it’s better if each page has its own keywords and description. It may be overlooked by some, but the Google Webmaster Tools will still consider it as a flaw if many of your pages share the same description sentence. As to keywords, they are not taken into account by most robots, but they may be used by some links directories. In CakePHP, the layout (where HTML headers and the keywords and description tags are) is shared between pages (or at least sections, depending on your design), and we can’t imagine changing layout on a per-page basis… There’s one obvious function in the HtmlHelper that can be used to add metatags to your page. Here is how:
-
// /views/news/view.php
-
echo $html->meta
( ‘description’,
$news[‘News’][‘title’].
‘ : ‘.
$text->trim
($news[‘News’][‘body’],
50),
array(‘type’ =&>
‘description’),
false);
// … code to display the news body
The last parameter indicates whether you want the generated code to appear inline or between the head tags where you have echoed the $scripts_for_layout var. By digging into the source code, I found that the method addScript from the view class is used to achieve that, using the $scripts_for_layout variable. So it can be used directly, but to me the meta method is the obvious choice (so obvious it’s not even documented for the moment in the CakePHP documentation).
title
The title of the page is very important. Setting it on a per-page basis in CakePHP is easy. You just have to set it in your view using data passed by the controller. The variable to set is “pageTitle”.
-
$this->pageTitle = $post[‘Post’][‘title’];
(to be continued… feel free to ad tips in the comments, of course!)