Thursday, April 26, 2012

How to set jqueryObject var in default.ctp and make it works in home.ctp

Hi everybody,

I'm trying to use cakephp and jquery and I have a problem.
I've define the following in my default.ctp

(...)
$this->Js->JqueryEngine->jQueryObject = '$j';
echo $this->Html->scriptBlock('var $j =
jQuery.noConflict();',array('inline' => false));
echo $this->Js->JqueryEngine->jQueryObject;//This is for testing!
echo $scripts_for_layout;
(...)

and in my home.ctp I'm including again the testing sentence
(...)
echo $this->Js->JqueryEngine->jQueryObject;//This is for testing!
(...)

When I open the page in the browser It shows
$j
$

For any reason I can set jQueryObject to $j in default.ctp scope but
not in the (default.ctp+home.ctp) scope. The variable setting is not
keeping between my views. Something is bad but I have spent a lot of
time changing args of scriptBlock method in default.ctp as a lot of
posts mentioned but nothing was happened.
I would appreciate your help.

Thanks,
Emiliano.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: