Forums

javascript php coming out as wrong type (2 posts)

  1. milotimbol
    Member
    Posted 1 month ago #

    Hi,

    I'm still trying to figure this one out. I know the problem but can't solve it.

    If you access this right now as I am trying to fix it (probably not after this day)

    http://www.360philippines.com/wordpress/

    You'll see these two lines

    <script type="text/javascript" src="http://www.360philippines.com/wordpress/wp-content/themes/360philippines/js/effects.js.php"></script>

    <script type="text/javascript" src="http://www.360philippines.com/wordpress/wp-content/themes/360philippines/js/test.js"></script>

    the 1st one is the dynamic version and the 2nd is the result of that file when you access it through the browser

    When I try to access through the 1st one in the browser it is not interpreted as javascript. But the 2nd one is. I know it has something to do with headers. So I added this on top of effects.js.php

    <?php
    Header("content-type: application/x-javascript");
    include("../../../../wp-blog-header.php");
    ?>

    But it still doesn't seem to fix it. The strange thing is It's working fine in my machine using wamp. Now I'm hosting on godaddy. I had trouble with case sensitivity a while ago but I'm not sure it is related to that. Has anybody encountered this?

    Thanks,
    Milo

  2. milotimbol
    Member
    Posted 1 month ago #

    Temporarily Instead of reading a .js.php file. I outputted the javascript into the page.

    <script type="text/javascript">
    <?php
    include_once("/wp-content/themes/360philippines/js/effects.js.php");
    ?>
    </script>

    This works but I don't like how it looks. Any ideas how I can make the .js.php approach work?

    I will come back and check on this post every once in a while.

Reply

You must log in to post.

About this Topic