+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: javascript and css in php

  1. #1
    TarinC is offline x10 Lieutenant TarinC is an unknown quantity at this point
    Join Date
    Sep 2005
    Location
    Toronto, Canada
    Posts
    349

    javascript and css in php

    how would i put javascripts and css into php files?

    would i just type include(filename) or echo "<script type=blah blah blah src=...>"; or is there a different way?

  2. #2
    chitwa is offline x10Hosting Member chitwa is an unknown quantity at this point
    Join Date
    Apr 2005
    Location
    Kenya
    Posts
    64

    Re: javascript and css in php

    The second option (echoing) is more practical. I use it anyway and it works fine with me.

  3. #3
    Brandon Guest

    Re: javascript and css in php

    Well you could use this it might make things clearer.

    <?php
    $java = 'YOURSCRIPT';

    echo '$java';

    ?>

  4. #4
    TarinC is offline x10 Lieutenant TarinC is an unknown quantity at this point
    Join Date
    Sep 2005
    Location
    Toronto, Canada
    Posts
    349

    Re: javascript and css in php

    thanks! imma tell u guys how it goes.

  5. #5
    randomize's Avatar
    randomize is offline x10 Lieutenant randomize is an unknown quantity at this point
    Join Date
    Mar 2006
    Posts
    337

    Re: javascript and css in php

    I would use the php include function

    so somethinglike this:

    <?php include("http://www.yoursite.com/script.js"); ?>

    My mate uses it and I use it in my sites and it seems to work easy.

    Its more pactical as you only have to modify one file and it changes on all pages.

    But it is your choice if you want to use the other ways that the other guys mentioned ealier in the thread.


    Click the animation above to go to the site where they are created!

    \ /
    (.) (.)
    /_
    \_____/
    The Evil Guy will take over all Signatures. Please help him to do this by copying and pasting him into your Signature.
    Thank you For Helping Evil!

  6. #6
    moose's Avatar
    moose is offline x10 Elder moose is an unknown quantity at this point
    Join Date
    May 2005
    Location
    Findlay, Ohio
    Posts
    528

    Re: javascript and css in php

    Interesting. So how do you include the CSS in a PHP file than?

    I was actually wondering that also.

    PM Me |
    Donate Points | Email Me







    Powered by Mac OS X


  7. #7
    Brandon Guest

    Re: javascript and css in php

    Well just place it before the <?php tag.

  8. #8
    moose's Avatar
    moose is offline x10 Elder moose is an unknown quantity at this point
    Join Date
    May 2005
    Location
    Findlay, Ohio
    Posts
    528

    Re: javascript and css in php

    Are you able to have an external CSS file and call it in?

    PM Me |
    Donate Points | Email Me







    Powered by Mac OS X


  9. #9
    randomize's Avatar
    randomize is offline x10 Lieutenant randomize is an unknown quantity at this point
    Join Date
    Mar 2006
    Posts
    337

    Re: javascript and css in php

    if you wanted an external js file or something you could do:

    <script src="blah.js"></script>
    <?php include("blah.js"); ?>

    If it was to be css

    <?php include("blah.css"); ?>


    I think that is what you mean, however I could be wrong!!
    Last edited by randomize; 03-22-2006 at 10:33 AM.


    Click the animation above to go to the site where they are created!

    \ /
    (.) (.)
    /_
    \_____/
    The Evil Guy will take over all Signatures. Please help him to do this by copying and pasting him into your Signature.
    Thank you For Helping Evil!

  10. #10
    Brandon Guest

    Re: javascript and css in php

    Randomize? Do you know what your talking about those examples would not work.

+ Reply to Thread
Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers