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

  • SEARCH
  • Home
  • 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 4327352
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:31:34+00:00 2026-05-21T09:31:34+00:00

hmmm, i know i can do this with jquery but i’m trying no to

  • 0

hmmm, i know i can do this with jquery but i’m trying no to use javascript and instead use php. also to learn from.

I have a folder hierarchy like this

modules
 |-navagation
    |-js
       |-nav.js

and I want to find a way to append that .js to the

 <head></head>

like this

<html>
    <title></title>
    <head>
        <script scr="jquery.js"></script>
        <script src="nav.js"></script>
    </head>
</html>

My goal is that I want to upload modules to my modules folders and have the php automatically pick it up and load up the resources from the modules.

One thing that I’m struggling with is that I’m loading my files via Smarty using .tpl to display my markup. Thats the only berrier i’m dealing with.

my original method was this but because I’m doing it with template files i’m at a loss.

ob_start();
include(THEME_PATH . "/index.html");
$content = ob_get_contents();
ob_end_clean();

// Scripts to include
$scripts = BaseHelper::include_script("http://code.jquery.com/jquery-1.4.2.min.js");
$scripts .= BaseHelper::include_script("js/jquery.sound.js");
$scripts .= BaseHelper::include_script("js/jquery.jblock.js");
$scripts .= BaseHelper::include_script("js/init.js");

// Add scripts to theme
echo str_replace("</head>", $scripts . "\n</head>", $content);
  • 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-21T09:31:34+00:00Added an answer on May 21, 2026 at 9:31 am

    I would turn your index.html template page into a php page, create your scripts prior var prior to including the template and then render them from within the included template file:

    ob_start();
    // Scripts to include
    $scripts = BaseHelper::include_script("http://code.jquery.com/jquery-1.4.2.min.js");
    $scripts .= BaseHelper::include_script("js/jquery.sound.js");
    $scripts .= BaseHelper::include_script("js/jquery.jblock.js");
    $scripts .= BaseHelper::include_script("js/init.js");
    include(THEME_PATH . "/index.php");
    $content = ob_get_contents();
    ob_end_clean();
    

    index.php:

    <head>
    <?php echo $scripts ?>
    </head>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hmmm...crappy question, but I didn't know how to phrase this: I have a sweet
I would be surprised if this is possible, but you never know. Is there
Hmmm... the Java Iterator<T> has a remove() method but not a replace(T replacement) method.
Hmmm. Consider this program, whose goal is to figure out the best way to
I want to use a javascript framework with MVC for a complex web application
I have this code I been working on but I'm having a hard time
Well, there are other ways (hmmm... or rather working ways) to do it, but
I'm attempting to load JSON (from php's json_encode) into a Backbone JS collection. I've
Hmmm I don't know how to clearly state the title. hopefully the following explanation
What prompted this question: I'm trying to change the account under which a windows

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.