Signets remarquables du 22/10/2008 au 23/10/2008

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.

Le guide du Router::

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 »

Basic SEO and CakePHP (part 1)

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/

  1. 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:

  1. // /views/news/view.php
  2. 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”.

  1. $this->pageTitle = $post[‘Post’][‘title’];

(to be continued… feel free to ad tips in the comments, of course!)

Archives

Liens au pif

  • Web Development 2
  • Chez Trân
  • Google Group CakePHP Fr
  • photos de bubu
  • Julien Bourgeois
  • blogcatalog
  • POPnews
  • Formation CakePHP
  • Cakebaker
  • Le blog de Pierre
  • snook.ca
  • Mark Story
  • Debuggable
  • pictures of the north country
  • mes photos
  • Derniers commentaires

    • Pierre MARTIN: Tu peux essayer de rajouter un champ “counterCache” dans ton modèle....
    • rafaelbandeira3: hey, thanks for the reference of my work! btw, may I ask you to correct my name?...
    • Michael: Salut ! Ayant lu les 2 premiers, il semble évident de recommander aux éventuels...
    • Michael: Article sympa, mais j’y ajouterai 2 ouvrages : http://www.apress.com/book/...
    • Xavier: Bonjour, Merci pour cette critique. Nous comptons mettre à jour le livre blanc assez...
  • Derniers trackbacks