Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1002695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:51:58+00:00 2026-05-16T07:51:58+00:00

I am trying to understand why ZendX_JQuery will not work when used directly in

  • 0

I am trying to understand why ZendX_JQuery will not work when used directly in a layout. It works perfectly fine when in a view:

  • creates the needed code
  • puts the JQuery script in the head tag

But when used inside the layout

  • creates the needed code
  • does not insert the JQuery script in the head tag

Can this be overcome, and how? And, if anyone can answer this, why is it doing this?

To make it perfectly clear, here is what i want to do:

    //layout.phtml file
    <head>
    <?php echo $this->jQuery();?>
    </head>
    <body>
<?php echo $this->ajaxLink("Like",

                    "/mod/instr/like/id/".$this->books['id'],

                    array('update' => '#ajaxed',
                    'beforeSend'=>'fadeout'
                    ));
?>
<?php echo $this->layout()->content; ?>
    </body

It means, that I wish to put a jQuery object inside a layout. I want to put some jQuery related code DIRECTLY inside my layout file, not just the part that allows jQuery to initialized for the views that require it.

Edit:
Ok, so here’s the init function in the Bootstrap

    protected function _initJqueryLoad()
    {

        $view = new Zend_View();
     // $view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper');
$view->addHelperPath("ZendX/JQuery/View/Helper", "ZendX_JQuery_View_Helper");
    $view->jQuery()->addStylesheet('/js/jquery/css/ui-lightness/jquery-ui-1.7.2.custom.css')
        ->setLocalPath('/js/jquery/jquery.js')
        ->setUiLocalPath('/js/jquery/js/jquery-ui-1.7.2.custom.min.js');
ZendX_JQuery::enableView($view);
    }

My layout file contains this in the head:

    <?php echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/admin.css'); ?>
    <?php echo $this->headLink()->prependStylesheet($this->baseUrl().'/css/form.css'); ?>
<?php 
echo $this->headScript()->prependFile('/js/JP.js','text/javascript','');?>
<?php echo  $this->jQuery(); ?>
</head>

So the JQuery should be enabled in every view that uses this layout.
The code that runs in my views, but not in my layouts is:

<div id="ajaxed">
<? 
echo $this->ajaxLink("Like",

                    "/mod/instr/like/id/".$this->books['id'],

                    array('update' => '#ajaxed',
                    'beforeSend'=>'fadeout'
                    ));
                     echo $this->ajaxLink("Don't like",

                    "/mod/instr/hate/id/".$this->books['id'],

                    array('update' => '#ajaxed'));?>


</div>
  • 1 1 Answer
  • 4 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T07:51:59+00:00Added an answer on May 16, 2026 at 7:51 am

    I experience the same problem WITH AJAXLINK.

    The link is generated using this helper in a LAYOUT, but the JQUERY function which should do the AJAX call in the header NOT.

    It works all perfect if I try the same in a VIEW.

    Edit: I ended up in copying the ajax-code manually into the layout without using the ajaxlink-helper.

    And I opened up a bug report here: http://framework.zend.com/issues/browse/ZF-10317

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi all Im trying to understand how blocks work. [UIView animateWithDuration:1 animations:^{ blueViewController.view.alpha =
After trying to understand why client code is not rendered in a page (injected
I've been trying to understand how Ruby blocks work, and to do that I've
I'm trying to understand how the Zend Framework works.Are the models designed to do
Hey guys, I'm starting with Zend, and trying to understand the way it works
I am trying to understand the way the AsyncToken works in actionscript. How can
Im trying to understand when to call autorelease, and what this will actually do
I am trying to understand explicit struct layout and struct overlaying and i am
I was trying to understand how mutexes work. Did a lot of Googling but
I am trying to understand how git works. So I initialized an empty repo

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.