developing cakephp multilingual website (language management)

On my previous “developing cakephp multilingual website” article I as advising you to do a management for languages db table for site administrator, It seems a lot of readers do not understand what will be the management I am asking to write. Sorry for that, Now I am attaching a zip file to show what to do with “do a management for languages db table for site administrator”, It has 2 screenshot, 1 controller, 1 model of language table and view files for a sample.

There are a lot of extra codes on view files which is required for my projects, You just advised to follow the steps or structures.

Merry Christmas to all

Download Attachment

developing cakephp multilingual website

To develop any multilingual website (Translated database content only) using cakephp framework all basic steps are discussed below. If you want fully multilingual website with translated button text or label text then go forward with Internationalizing your application
To manage multiple language translated content for any specific models specific field cakephp has a core behavior named TranslateBehavior.
Suppose we want a website with multiple number of language support and site administrator can add/edit/delete any language and front-end user can choose any language to visit the website.
Here are the list of steps given below.
Step 1: Create a db language table

CREATE TABLE `languages` (
  `id` int(11) NOT NULL auto_increment,
  `title` varchar(120) NOT NULL,
  `flag` varchar(100) default NULL,
  `code_2_digit` varchar(2) NOT NULL,
  `code_4_digit` varchar(6) NOT NULL,
  `created` datetime NOT NULL,
  `modified` datetime NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

now do a management for languages db table for site administrator
Read More

article title to url slug with cakephp

If you are using cakephp framework for your web application development. Sometimes you need to create SEO friendly url slug from your article / post / page / news etc title.

If a article title is “Article title to url slug with cakephp” then your SEO friendly url slug supposed to be “article-title-to-url-slug-with-cakephp”

To create this kinds of url slug from a string you can use cakephp core utility class Inflector, The Inflector takes a string and manipulate it to handle some common words variations.

To make slug from string using Inflector you can use below written code in your controller:

< ?php

$str = 'Article title to url slug with cakephp';

// Converting string into slug with separator 
$str = Inflector::slug($str,'-');

$str = strtolower($str); //article-title-to-url-slug-with-cakephp

?>

For your multiple use you can create a common method on your application controller like
Read More