Categories > TinyButStrong general >

Headers pass with a variable

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Anthony
Date: 2011-04-05
Time: 22:53

Headers pass with a variable

Here's a sample of the header section of my HTML template. I want to be able to pass additional headers when loading some pages, so in my PHP code I have a variable called "alternate_headers" but it appears to not work as expected. For example, I am adding an additional reference in the header to some javascript functions, but when passing using the "alternate_headers" variable, the javascript functions do not work as expected. However, if I look at the source code of the html, I do see the headers got included. Any suggestions on what the problem might be?

  
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>[onshow.page_title; noerr]</title>
    <base href="[onshow.base_path; noerr]" />
    <link href="assets/css/reset.css" rel="stylesheet" type="text/css" />
    <link href="assets/css/master.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="assets/js/jquery-1.5.min.js"></script>
    <script type="text/javascript" src="assets/js/jquery_functions.js"></script>
    [onshow.alternate_headers;htmlconv=no; noerr]
    <link rel="shortcut icon" href="assets/images/favicon.ico" type="image/x-icon" />
</head>
By: Skrol29
Date: 2011-04-05
Time: 23:30

Re: Headers pass with a variable

Hi,

I wild say if the JavaScript header tags are actually merged as you expected, then the error comes from the JavaScript.
By: Anthony
Date: 2011-04-06
Time: 04:38

Re: Headers pass with a variable

Originally, I had two different header templates with some pages being served the header with the additional headers. However, since the only difference between the two header templates were the extra javascript header references, it seemed to make sense to just keep one header template and then just pass the additional header references through a variable. So, the javacript works when I have them already in the html template as a reference, but when I pass the reference as a variable, they do not work as expected. Again, when looking at the source code in the browser, I do see the reference to the javascript, but they still do not work.

Again, the only difference is that the old method uses two separate html templates, whereas the new method uses one template with the variable as shown in the code above.
By: Skrol29
Date: 2011-04-06
Time: 21:57

Re: Headers pass with a variable

PHP is a server process. It does not interfere with the navigator. A PHP script give a (HTML) content to the navigator and the navigator manages the rendering and the Javascript execution.
One good think to test is to save your result in an HTML file. Then test this page and check the Javascript.