Hey rogwel did you declare this line
var $helpers = array('Js' => 'Jquery');
in your app_controller?
On 21 nov, 23:16, rogwei <[email protected]> wrote:
> This must be a very basic question, but I don't see the solution
> anywhere. One person raised the question on CakePHP Qs but it was not
> answered. I am trying to set up the Js helper but am getting the
> subject error after following the setup in the manual. The following
> summarizes my setup.
>
> Download library and install in webroot. Path to jquery library:
> /Users/user/Sites/MyAppName/js/jquery-1.4.4.js
>
> Link to library in default layout file. In the <head> tag of
> default.ctp:
> echo $this->Html->script('jquery-1.4.4');
>
> When I view source on the rendered home page view, I can see a link to
> the jquery library and click the link to load the jquery source, so I
> know the library is linked correctly.
>
> Write out buffered scripts. This is the line that causes the error.
> Immediately preceding the </body> tag in default.ctp:
> <?php echo $this->Js->writeBuffer(); ?>
>
> Declare the helper in the controller:
> var $helpers = array('Js' => 'Jquery');
>
> I get the error when visiting the home page of the app (http://
> localhost/~user/MyAppName/).
>
> Can someone please tell me what I am missing?
>
> ********************************************************
> The complete notice and error messages follow.
>
> Notice (8): Undefined property: View::$Js [APP/views/layouts/
> default.ctp, line 47]
> Code | Context
> <?php echo $this->Session->flash('email');?>
>
> <?php echo $this->Js->writeBuffer(); ?>
> $___viewFn = "/Users/user/cake/1.3.x/MyAppName/views/layouts/
> default.ctp"
> $___dataForView = array(
> "page" => "home",
> "subpage" => null,
> "title_for_layout" => "Home",
> "content_for_layout" => " <div class="foos form"
> id="MyAppNameForm" >
> <input id="tfobject" type="text" name="object" value="object
> goes here" maxlength="0" />
> <input id="btnfoo" type="button" name="btnfoo" value="foo
> object" onclick="" />
> </div>",
> "scripts_for_layout" => "",
> "form" => FormHelper
> FormHelper::$helpers = array
> FormHelper::$fieldset = array
> FormHelper::$__options = array
> FormHelper::$fields = array
> FormHelper::$requestType = NULL
> FormHelper::$defaultModel = NULL
> FormHelper::$_inputDefaults = array
> FormHelper::$base = "/~user/MyAppName"
> FormHelper::$webroot = "/~user/MyAppName/"
> FormHelper::$theme = NULL
> FormHelper::$here = "/~user/MyAppName/"
> FormHelper::$params = array
> FormHelper::$action = "display"
> FormHelper::$plugin = NULL
> FormHelper::$data = NULL
> FormHelper::$namedArgs = NULL
> FormHelper::$argSeparator = NULL
> FormHelper::$validationErrors = NULL
> FormHelper::$tags = array
> FormHelper::$__tainted = NULL
> FormHelper::$__cleaned = NULL
> FormHelper::$Html = HtmlHelper object,
> "session" => SessionHelper
> SessionHelper::$helpers = array
> SessionHelper::$__active = true
> SessionHelper::$valid = false
> SessionHelper::$error = false
> SessionHelper::$_userAgent = "eee529c539a2f1d37ce990348ba812dc"
> SessionHelper::$path = "/"
> SessionHelper::$lastError = NULL
> SessionHelper::$security = "medium"
> SessionHelper::$time = 1290386547
> SessionHelper::$sessionTime = 1290398547
> SessionHelper::$cookieLifeTime = false
> SessionHelper::$watchKeys = array
> SessionHelper::$id = NULL
> SessionHelper::$host = NULL
> SessionHelper::$timeout = NULL
> SessionHelper::$base = "/~user/MyAppName"
> SessionHelper::$webroot = "/~user/MyAppName/"
> SessionHelper::$here = "/~user/MyAppName/"
> SessionHelper::$params = array
> SessionHelper::$action = "display"
> SessionHelper::$data = NULL
> SessionHelper::$theme = NULL
> SessionHelper::$plugin = NULL,
> "html" => HtmlHelper
> HtmlHelper::$tags = array
> HtmlHelper::$_crumbs = array
> HtmlHelper::$__includedScripts = array
> HtmlHelper::$_scriptBlockOptions = array
> HtmlHelper::$__docTypes = array
> HtmlHelper::$helpers = NULL
> HtmlHelper::$base = "/~user/MyAppName"
> HtmlHelper::$webroot = "/~user/MyAppName/"
> HtmlHelper::$theme = NULL
> HtmlHelper::$here = "/~user/MyAppName/"
> HtmlHelper::$params = array
> HtmlHelper::$action = "display"
> HtmlHelper::$plugin = NULL
> HtmlHelper::$data = NULL
> HtmlHelper::$namedArgs = NULL
> HtmlHelper::$argSeparator = NULL
> HtmlHelper::$validationErrors = NULL
> HtmlHelper::$__tainted = NULL
> HtmlHelper::$__cleaned = NULL
> )
> $loadHelpers = false
> $cached = true
> $loadedHelpers = array()
> $page = "home"
> $subpage = null
> $title_for_layout = "Home"
> $content_for_layout = " <div class="foos form"
> id="MyAppNameForm" >
> <input id="tfobject" type="text" name="object" value="object
> goes here" maxlength="0" />
> <input id="btnfoo" type="button" name="btnfoo" value="foo
> object" onclick="" />
> </div>"
> $scripts_for_layout = ""
> $form = FormHelper
> FormHelper::$helpers = array
> FormHelper::$fieldset = array
> FormHelper::$__options = array
> FormHelper::$fields = array
> FormHelper::$requestType = NULL
> FormHelper::$defaultModel = NULL
> FormHelper::$_inputDefaults = array
> FormHelper::$base = "/~user/MyAppName"
> FormHelper::$webroot = "/~user/MyAppName/"
> FormHelper::$theme = NULL
> FormHelper::$here = "/~user/MyAppName/"
> FormHelper::$params = array
> FormHelper::$action = "display"
> FormHelper::$plugin = NULL
> FormHelper::$data = NULL
> FormHelper::$namedArgs = NULL
> FormHelper::$argSeparator = NULL
> FormHelper::$validationErrors = NULL
> FormHelper::$tags = array
> FormHelper::$__tainted = NULL
> FormHelper::$__cleaned = NULL
> FormHelper::$Html = HtmlHelper object
> $session = SessionHelper
> SessionHelper::$helpers = array
> SessionHelper::$__active = true
> SessionHelper::$valid = false
> SessionHelper::$error = false
> SessionHelper::$_userAgent = "eee529c539a2f1d37ce990348ba812dc"
> SessionHelper::$path = "/"
> SessionHelper::$lastError = NULL
> SessionHelper::$security = "medium"
> SessionHelper::$time = 1290386547
> SessionHelper::$sessionTime = 1290398547
> SessionHelper::$cookieLifeTime = false
> SessionHelper::$watchKeys = array
> SessionHelper::$id = NULL
> SessionHelper::$host = NULL
> SessionHelper::$timeout = NULL
> SessionHelper::$base = "/~user/MyAppName"
> SessionHelper::$webroot = "/~user/MyAppName/"
> SessionHelper::$here = "/~user/MyAppName/"
> SessionHelper::$params = array
> SessionHelper::$action = "display"
> SessionHelper::$data = NULL
> SessionHelper::$theme = NULL
> SessionHelper::$plugin = NULL
> $html = HtmlHelper
> HtmlHelper::$tags = array
> HtmlHelper::$_crumbs = array
> HtmlHelper::$__includedScripts = array
> HtmlHelper::$_scriptBlockOptions = array
> HtmlHelper::$__docTypes = array
> HtmlHelper::$helpers = NULL
> HtmlHelper::$base = "/~user/MyAppName"
> HtmlHelper::$webroot = "/~user/MyAppName/"
> HtmlHelper::$theme = NULL
> HtmlHelper::$here = "/~user/MyAppName/"
> HtmlHelper::$params = array
> HtmlHelper::$action = "display"
> HtmlHelper::$plugin = NULL
> HtmlHelper::$data = NULL
> HtmlHelper::$namedArgs = NULL
> HtmlHelper::$argSeparator = NULL
> HtmlHelper::$validationErrors = NULL
> HtmlHelper::$__tainted = NULL
> HtmlHelper::$__cleaned = NULL
> include - APP/views/layouts/default.ctp, line 47
> View::_render() - CORE/cake/libs/view/view.php, line 723
> View::renderLayout() - CORE/cake/libs/view/view.php, line 482
> View::render() - CORE/cake/libs/view/view.php, line 428
> Controller::render() - CORE/cake/libs/controller/controller.php, line
> 913
> PagesController::display() - CORE/cake/libs/controller/
> pages_controller.php, line 83
> Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 204
> Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171
> [main] - /Users/user/Sites/MyAppName/index.php, line 84
>
> Fatal error: Call to a member function writeBuffer() on a non-object
> in /Users/user/cake/1.3.x/MyAppName/views/layouts/default.ctp on line
> 47
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en