Archive for the ‘CakePHP 1.2’ Category

set multilingual pageTitle in a view or element

Sunday, March 22nd, 2009

I have searched for a long time until i found the reason why i couldnt make a pageTitle multilingual in a view or in an element.

First I tried to edit the title in this way and became unhappy because it was written in the content area of my page and not in the titletag.

$this->pageTitle = __('new PageTitle');

The second parameter “true” will avoid displaying the text directly.

$this->pageTitle = __('new PageTitle', true);

So, when you write it in this way, it works!

Installing Prototype/Scriptaculous into your CakePHP App

Saturday, March 21st, 2009

I wanted to install the prototype framework with the scriptaculous effects to my cakePHP Application, but after uploading the prototype files into the webroot/js folder and linking them in the layout, i got a failure message like “Undefined variable: javascript”.

This variable has to be defined in the Applications Helper, so you can put this line of code in your AppHelper class. If you dont know what to do: create a file named “app_helper.php” in your /app folder and insert these lines of code.

class AppHelper extends Helper {
	var $helpers = array('Html','Javascript','Ajax');
}

The $javascript variable is now available and you can insert your javascript files (the prototype framework in my excample) like this in the head of your layout.

		echo $javascript->link('scriptaculous/lib/prototype');
		echo $javascript->link('scriptaculous/src/scriptaculous');

		// Scripts from a view
		echo $scripts_for_layout;