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 8237081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:21:09+00:00 2026-06-07T19:21:09+00:00

My layouts are placed inside layout/scripts/layout.phtml i have placed the below code inside my

  • 0

My layouts are placed inside layout/scripts/layout.phtml
i have placed the below code inside my head section of layout.phtml

<?php
print $this->headScript()->appendFile($this->baseUrl().'/js/jquery-1.7.2.min.js')
                         ->appendFile($this->baseUrl().'/js/simpla.jquery.configuration.js');
?>

Now I want to append another javascript file from a view. For that I wrote the following code:

 $this->headScript()->appendFile($this->baseUrl().'js/fancybox/jquery.fancybox-1.3.4.pack.js');

Although this appended the file but it appears before my jquery-1.7.2.min.js. What i want is that i want to add jquery.fancybox-1.3.4.pack.js below my jquery-1.7.2.min.js
How can i do this?

  • 1 1 Answer
  • 0 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-06-07T19:21:12+00:00Added an answer on June 7, 2026 at 7:21 pm

    Your view script is rendered before the layout so the calls to appendFile() in your layout result in those scripts (jquery-1.7.2 and simpla.jquery) being appended after the one you appended in the view script.

    To fix this, use prependFile() in your layout at least for the main jQuery script.

    Your layout might look like this:

    <?php
    print $this->headScript()
               ->appendFile($this->baseUrl().'/js/simpla.jquery.configuration.js')
               ->prependFile($this->baseUrl().'/js/jquery-1.7.2.min.js');
    

    No need to change the view script, that is fine as is.

    See HeadScript Helper Example #23 which talks a bit about ordering of the scripts.

    The important thing to remember that they don’t mention is that your view script gets rendered before the layout does.

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

Sidebar

Related Questions

I have two layouts, one is the main layout inside which I am including
I'm using this code to get the bitmap placed inside the ImageView] private Bitmap
I have this layout file called menuAdmin. I wish to, each time a given
Basic layout (VB.NET & WPF/XBAP) : I have a MainPage - mainpage.xaml Inside the
I have a faux dialog which uses this layout: <?xml version=1.0 encoding=utf-8?> <FrameLayout xmlns:android=http://schemas.android.com/apk/res/android
I have a relative layout, and inside it i place 3 items, 2 imageviews
I have custom component that I can place in my layout file (XML) for
Nested layouts do not work in Rails 3. After I hit this I tried
Someone can explain this error? Error Creating Control - head Object reference not set
I'm using a Relative layout as the root or parent container and I have

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.