Showing posts with label cakephp. Show all posts
Showing posts with label cakephp. Show all posts

Saturday 30 June 2012

Cakephp Layout - How to set Layout


A layout contains presentation code that wraps around a view. Anything you want to see in all of your views should be placed in a layout.
Layout files should be placed in /app/views/layouts. CakePHP's default layout can be overridden by creating a new default layout at /app/views/layouts/default.ctp. Once a new default layout has been created, controller-rendered view code is placed inside of the default layout when the page is rendered.
When you create a layout, you need to tell CakePHP where to place the code for your views. To do so, make sure your layout includes a place for $content_for_layout (and optionally, $title_for_layout).





Example is below

<html>
<head>
<!-- Include external files and scripts here (See HTML helper for more info.) -->
<?php echo $scripts_for_layout ?>
<title>
<?php echo $title_for_layout ?>
</title>
</head>
<body>
<?php echo $content_for_layout ?>
</body>
</html>



Tuesday 6 September 2011

How to change FCKeditor skin, ToolbarSet, height and width


 How to  change FCKeditor skin, ToolbarSet, height and width


CKEditor is a text editor to be used inside web pages. It's a WYSIWYG editor, which means that the text being edited on it looks as similar as possible to the results users have when publishing it. It brings to the web common editing features found on desktop editing applications like Microsoft Word and OpenOffice.

Because CKEditor is licensed under flexible Open Source and commercial licenses, you'll be able to integrate and use it inside any kind of application. This is the ideal editor for developers, created to provide easy and powerful solutions to their users.

Implement with cakephp, Its an easy just follow the some steps. How to implement?


 How to  change FCKeditor skin, ToolbarSet, height and width.
Suppose in one page you have 3 editor and each need different height, width, skin or toolbarset. for this, Follow the following lines.

1) open file "app/views/helpers/fck.php"
2) go to function "load"
3)set all the vars as below
load($id, $skin='silver', $toolbar = 'Basic', $height='400', $width='300');
4)put the variable $skin as below
 bFCKeditor_$did.Skin         = '$skin';

do all the same
5)open the ctp file for add/edit where u r using calling load function [where u r creating editor]
and pass the arguments as below
 $fck->load('id', 'silver','Basic','200px', '200px' );

Multilingual in Cakephp1.3

Multilingual in cakephp
Just do the following three points

1) In view file user as
echo __('USERNAME'); 

2) IN default.po locale/eng/LC_MESSAGES/default.po
msgid "USERNAME" 
msgstr "User Name"

3) // config/bootstrap.php
define(DEFAULT_LANGUAGE, 'eng');

4)In HTML head add Following
[meta charset="UTF-8"]

Compile .po file
msgfmt message.po.txt -o message.po 




Multilingual Characters save in Database
1. Table Collation should be utf8_general_ci
2. Table's Field Collation should be utf8_general_ci
3. While Save in Db, set character set utf8
4. When Display in Browser, add following tag in Head
<meta charset="UTF-8">