script help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • hoozdiss

    #1

    script help

    i installed apache 2.2 on winxp with php5. when i write a piece of
    html and include a php or java script in the html i have no problem.
    when i file the script and use something like
    <script src="script.php "></script>
    i get nothing. he finds the file - if i rename it - he complains.
    i'm guessing a config param. please help.

  • Anonymous

    #2
    Re: script help

    hoozdiss wrote:
    >
    i installed apache 2.2 on winxp with php5. when i write a piece of
    html and include a php or java script in the html i have no problem.
    when i file the script and use something like
    <script src="script.php "></script>
    i get nothing. he finds the file - if i rename it - he complains.
    i'm guessing a config param. please help.
    You made two substantial mistakes.

    1) If you use the HTML <scripttag you must tell the user agent which
    language it is written in.

    e.g. <SCRIPT type="text/vbscript"
    src="http://someplace.com/progs/vbcalc">

    2) The <scripttag is for client side scripting only! The server should
    just pass the script to the user agent which should execute it.


    If you want to include PHP scripts from a file use

    <?php
    include("/path/script.php");
    ?>

    Bye!

    Comment

    • Andy Hassall

      #3
      Re: script help

      On Fri, 15 Sep 2006 14:54:48 -0400, hoozdiss <BillG@msn.comw rote:
      >i installed apache 2.2 on winxp with php5. when i write a piece of
      >html and include a php or java script in the html i have no problem.
      >when i file the script and use something like
      ><script src="script.php "></script>
      That's specifying a client-side script to run, which is probably not what you
      want (unless the PHP script is itself generating Javascript, for example).

      You probably want to use require() or similar in a PHP block.

      --
      Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
      http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

      Comment

      • hoozdiss

        #4
        Re: script help

        i'm trying to run scripts like site counters etc. right now i just
        have small test scripts -

        </head>

        <body>
        this is a test
        <script type="text/javascript"
        src="http://192.168.123.162/test/scriptA.php"></script>
        <br>and this<br>
        <script src="http://localhost/test/calendar.php"></script>
        try this-<br>
        <script type="text/javascript" src="scriptJ.js "></script>
        <br>
        <script type="text/javascript">
        document.write( "this part works")
        </script>
        <br>
        try include
        <?php
        include("script A.php");
        ?>

        etc.
        i keep the script files in the same directory as the html-
        ....Apache2.2\h tdocs\test
        if i delete them - there's a msg in the log so he knows they're there.

        i don't know about using script type= javasript with php - am i
        missing something here? but even the js doesn't work (except the
        inline one).




        Comment

        • Jerry Stuckle

          #5
          Re: script help

          hoozdiss wrote:
          i'm trying to run scripts like site counters etc. right now i just
          have small test scripts -
          >
          </head>
          >
          <body>
          this is a test
          <script type="text/javascript"
          src="http://192.168.123.162/test/scriptA.php"></script>
          <br>and this<br>
          <script src="http://localhost/test/calendar.php"></script>
          try this-<br>
          <script type="text/javascript" src="scriptJ.js "></script>
          <br>
          <script type="text/javascript">
          document.write( "this part works")
          </script>
          <br>
          try include
          <?php
          include("script A.php");
          ?>
          >
          etc.
          i keep the script files in the same directory as the html-
          ...Apache2.2\ht docs\test
          if i delete them - there's a msg in the log so he knows they're there.
          >
          i don't know about using script type= javasript with php - am i
          missing something here? but even the js doesn't work (except the
          inline one).
          >
          >
          >
          >
          There is no difference between using a script tag in PHP and in HTML (as
          long as the tags aren't in a PHP block, of course).

          First of all try getting it to work in a simple html page. Once you get
          it to work there, it will work in this page.

          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstucklex@attgl obal.net
          =============== ===

          Comment

          • hoozdiss

            #6
            Re: script help

            god - been working on this all day - finally found it - you can tell
            i'm new to this. my apache install was vanilla - i used htdocs for
            initial testing then added a test directory under that which is where
            i tested the scripts. they didn't work until just now when i added
            the test directory and "Options +Includes" to the httpd.conf file.
            i really thought that was supposed to trickle down. anyway thanks for
            all offers of help.

            Comment

            Working...