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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:04:41+00:00 2026-06-01T06:04:41+00:00

I am trying to load specific styles/script resources for a specific module within my

  • 0

I am trying to load specific styles/script resources for a specific module within my application.

Here is my application structure:

-application
  -configs
  -controllers
  -forms
  -layouts
  -models
  -modules
    -admin
      -configs
      -controllers
      -models
      -views
      -Bootstrap.php
  -views
  -Bootstrap.php

The problem I’m having is: the styles and scripts I am loading through headLink() and headScript in /application/modules/admin/Bootstrap.php are also being loaded in my controller/actions that are not in the admin module. Here are my Bootstrap.php‘s

/application/Bootstrap.php:

protected function _initDoctype()
{
    $this->_logger->info('Bootstrap ' . __METHOD__);

    //init the view
    $this->bootstrap('view');
    $view = $this->getResource('view');
    $view->doctype('XHTML1_STRICT');

    //Set title and separator
    $view->headTitle('Sunny Rose Photography')
         ->setSeparator(' | ');

    //Load global stylesheets
    $view->headLink()->appendStylesheet('/styles/styles_main.css')
         ->headlink()->appendStylesheet('/scripts/jquery-ui-1.8.17/themes/base/jquery-ui.css');

    //Load Scripts
    $view->headScript()->prependFile('/scripts/jquery-1.7.1/jquery-1.7.1.js')
         ->headScript()->appendFile('/scripts/jquery-ui-1.8.17/ui/minified/jquery-ui.min.js')
         ->headScript()->appendFile('/scripts/gallery.js')
         ->headScript()->appendFile('/scripts/scripts_main.js');
}

/application/modules/admin/Bootstrap.php:

 protected function _initDoctype()
{
    $this->bootstrap('view');
    $view = $this->getResource('view');
    $view->headLink()->appendStylesheet('/styles/admin/styles_admin.css');
    $view->headScript()->appendFile('/scripts/admin/scripts_admin.js');
}

I can see how or maybe why it’s doing it: because I’m getting the view from the main bootsrap(?). My question is, how does one load module specific stylesheets and/or script files?

I apologize if this is a duplicate question, i searched for various wordings of the title of the question and I didn’t find anything conclusive.

Thanks,
Ken

  • 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-01T06:04:42+00:00Added an answer on June 1, 2026 at 6:04 am

    Its not possible to determine name of module at bootstrap time . Only after routeShutdown you will come to know about module name . If you are using layout then open application.ini

    resources.layout.pluginClass = "My_Layout_Controller_Plugin_Layout"
    

    inside

    class My_Layout_Controller_Plugin_Layout extends Zend_Layout_Controller_Plugin_Layout
    {
    
    public function routeShutdown($request)
    {
       $moduleName = $request->getModuleName();
    
    if($moduleName == 'admin') 
    {
    // load css , js for this specific module
    }
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to load a view specific stylesheet in an asp.net mvc3 application (just
I'm trying to load images from the specific folder in sd card.i saved images
I'm trying to load a specific key from a dictionary, with keys like character
I'm trying to load content into a Dojo content pane in a specific html
I am trying to make my app automatically load specific content for a user
I am trying to set the date to a specific one on page load
I'm trying to implement a transparent cache that can load a specific object when
I am trying to load an XML file, and then evaluate 2 different specific
So i am trying to make a game that will load a specific XIB
I am trying to auto-load classes from the lib directory inside of one specific

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.