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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:21:00+00:00 2026-05-15T11:21:00+00:00

Hey everyone, I am having a problem with a website I’m trying to build;

  • 0

Hey everyone, I am having a problem with a website I’m trying to build; basically I have a class that I call from my header file that loads all of the link and script tags. The link tags show up across all browsers, but the script tags only show up in safari and chrome, they do no show up in firefox or IE.

<script type='text/javascript' src='...'>  

now I have tried removing the “<” at the front of the tag just to see what happens, and it will show up as plain text then, but as soon as I put the “<” back it is again MIA.

So here is what’s going on in the php. My header.php file calls the cms object function, located in cms.php, and those functions call other functions in my system.php file.

Now, again the link tags work w/out a hitch and I call them the exact same way … it is just the dumb script tags. When I call the load_js(“config”); function in my header.php it will load multiple tags as well. If it was just 1 tag I would put the script tags in the html rather than in the php, but I don’t think I can do that when I’m producing multiple tags.

Any help would be great! Thanks in advance as well!

header.php

<?php echo $this->load_css("config"); ?>  
<?php echo $this->load_js("config"); ?> 

cms.php

function load_js($name){        
    // ...
    return header_script($name.".js");
    // ...
}
function load_css($name){       
    // ...
    return header_link($name.".css");
    // ...
} 

system.php

function header_script(){
    // 0 = src
    $num = func_num_args();
    if($num == 0){
        return;// if no arguments, can't successfully build header_script.
    }
    if($num == 1){
        return "<script type='application/javascript' src='".func_get_arg(0)."'></script>\n";
    }
}
function header_link(){
    $num = func_num_args();
    // 0 = rel
    // 1 = type
    // 2 = href
    if($num < 3){
        return; // can't successfully build link.
    }
    if($num == 3){
        return "<link rel='".func_get_arg(0)."' type ='".func_get_arg(1)."' href='".func_get_arg(2)."' />\n";
    }
}
  • 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-15T11:21:01+00:00Added an answer on May 15, 2026 at 11:21 am

    Firstly, application/javascript is not recognized by some browsers. You should change that to text/javascript

    Secondly, as mentioned in comments (Justin Johnson), you should use parameters in your function definition with default values:

    function header_script($name = '')
    {
        if ($name != '') {
            return '<script type="text/javascript" src="'.$name.'"</script>';
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.