Archive pour mars 2008

Flash map of the world

27/03/2008  |  Publié dans ailleurs, flash

My friend Tranou has spent way too long doing an interactive map of the world, with official UN country codes for all the countries, etc, with colors, As he is a nice guy, he’s offering his raw map as a zip archive so you can build upon it. It’s here.

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!)

Moving to CakePHP

12/03/2008  |  Publié dans ailleurs, cakephp

Un blog anglophone sur lequel je viens de tomber : Moving to Cake. Le point de départ est intéressant :

  • 153,235 Physical Source Lines of Code
  • 912 PHP Files
  • 394 Classes
  • 1,330 HTML Files
  • Project CVS Checkout Size: 438M (includes images directories)
  • 135 Database Tables
  • 7 Databases

Gulp… POPnews, c’est tout petit par rapport. En revanche, ça me fait penser à un certain projet pour le boulot qui occupe correctement mes journées et dont on a pratiquement abandonné l’idée de le refaire, même avec le plus beau des frameworks… A la différence que le projet dont eux partent était tout de même codé à l’aide d’un framework maison pseudo-MVC. Je leur souhaite bien du courage… Et vous, quelle est votre expérience en matière de portage vers CakePHP d’une application existante ?

Il y a une route

04/03/2008  |  Publié dans ailleurs, cakephp

Felix Geisendörfer aka the_undefined a publié hier une petite présentation très utile concernant les derniers ajouts à la gestion des routes sous CakePHP. Il faut utiliser la dernière version du SVN pour en profiter, mais j’ai déjà pu expérimenter les bienfaits du reverse routing : en gros, quelle que soit le schéma d’URL que vous avez défini dans route.php, les liens générés dans vos views en utilisant le helper $html->link le reflèteront bien, sans besoin de mise à jour.

Archives

Liens au pif

  • Cakebaker
  • Chez Trân
  • blogcatalog
  • Google Group CakePHP Fr
  • photos de bubu
  • POPnews
  • Julien Bourgeois
  • Web Development 2
  • Debuggable
  • Pseudocoder
  • pictures of the north country
  • snook.ca
  • Mark Story
  • Formation CakePHP
  • Yahoo Pipe des sites CakePHP FR
  • Derniers commentaires

    • Guillaume: Merci pour cette précision, Pierre, je vais aller voir ça.
    • Pierre Martin: Bonjour Guillaume, et merci encore une fois pourle lien vers mon article ! Juste...
    • Guillaume: De loin, on ne voyait pas très bien :)
    • Gabriiiel: Roy nous a remis un trophée… :D
    • Pierre MARTIN: Il y a aussi cet article de teknoid contenant un lien vers un plugin de recherche...
  • Derniers trackbacks