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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:34:22+00:00 2026-05-24T10:34:22+00:00

I have a controller that opens a container view. The container then hands the

  • 0

I have a controller that opens a container view. The container then hands the building of the page to several views including the “html_meta” view and the “top_bar”, “side_bar”, “content” views. However, the content contains several different views too many of which can be considered gadgets, or small contained html divs with different data, script actions.

Question:
If I want the HTML header/meta to include only the scripts that that the specific gadget views need, is there a way for the gadget views to send the necessary script components back up the line to the container view so that it can process them and add the scripts to the html head?

  • If it helps I can include the code, but for now, I think it gets messy here. However, if you need code to visualize it, no problem. Thanks!
  • 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-05-24T10:34:23+00:00Added an answer on May 24, 2026 at 10:34 am

    As an example my controller calls the main container but I have to pass it my content which is from another view as such

    ...
    $content['content'] = $this->load->view('about/index', $data, true);
    ...
    $this->load->view('layout/container', $content');
    

    Then layout/container.php contains several

    ...
    $this->load->view("layout/html_meta");
    ...
    $this->load->view("layout/top_bar");
    ...
    <div id="content">
      <?php echo $content?>
    </div>
    

    It’s possible but it’s not the subviews “informing” the “html_meta” to include the javascripts that it needs because your views are rendered from the main container down to the sub views.

    What you can do is create a helper for your external java scripts. I’m thinking of having a javascript group for each of your widgets such as

    function getJSforWidgetOne() {
       $scripts = array();
       $scripts[] = "http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js";
       $scripts[] = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.js";
       return $scripts;
    }
    

    Then in your controller function you also pass those scripts, or possible your constructor.

    $content['custom_js'] = getJSForWidgetOne();
    $content['content'] = $this->load->view('about/index', $data, true);
    ...
    $this->load->view('layout/container', $content');
    

    So now, $custom_js is accessible in your layout/container.php. But it’s not yet in layout/html_meta. So I’ll assign this to an array, and pass it again to layout/html_meta.

    ...
    $for_html_meta['custom_js'] = $custom_js;
    $this->load->view("layout/html_meta", $for_html_meta);
    ...
    $this->load->view("layout/top_bar");
    ...
    <div id="content">
      <?php echo $content?>
    </div>
    

    Then in your layout/html_meta, you can now use $custom_js to insert additional javascripts aside from your common scripts.

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

Sidebar

Related Questions

I have a root view controller that opens up a new modal view controller.
I have two views, the parent view opens a pop over that has a
I have a view controller that's been added to a UITabBarController . In this
I have one view controller,in that i have 1 UIButton ,when i click on
I am building an mvc app for reporting. I have a page that has
i have a link <a id=DownloadLink href='controller/action' target=_blank>Download File</a> that has to open a
I have a controller that contains a tableView that spawns another controller modally to
I have a controller that is called with AJAX (sends JSON data), so I
--Summary (shortened)-- I have a controller that loads a profile object from the corresponding
When you have a controller that does logic with services and DAO's that may

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.