Topic awaiting preservation: PHP Templates and Javascript (Page 1 of 1) |
|
---|---|
Paranoid (IV) Inmate From: The Dark Side of the Moon |
posted 05-10-2003 20:58
OK, I am using the template tute at the GN at http://www.gurusnetwork.com/tutorials/php/phptemplate2/phptemplate2.html. My question is this, I want to use a javascript code that requires a part of the code to be in the <head> of the page, how is this done? I noticed that the if you use the <?php $title = "Title Here"; ?> tag it will transfer the title from the .php file to the header.php file in a template. Is there a special tag to do the same for javascript or do I just name the tag myself, like <?php $javascript = "Javascript Here"; ?> |
Maniac (V) Mad Scientist with Finglongers From: Cell 53, East Wing |
posted 05-10-2003 21:10
The Jackal: quote:
code: $page_title = 'My page';
code: if (!empty ($extra_javascript)) {
|
Paranoid (IV) Inmate From: The Dark Side of the Moon |
posted 05-10-2003 21:41
Thanks Emperor. Though you left the closing '>' out of code: echo "<script language=\"JavaScript\"";
|
Maniac (V) Mad Scientist with Finglongers From: Cell 53, East Wing |
posted 05-10-2003 21:51
The Jackal: Ooops - good catch. I should have added some kind of caveat in there (code thrown together off the cuff so may cause browsers to melt in disgust). |
Paranoid (IV) Inmate From: The Dark Side of the Moon |
posted 05-10-2003 22:21
OH! I need to know how to view php scripts on my own PC too. I assume I will need some type of interpreter so that the php scripts are actually read through my browser rather than opened up in a text format. |
Bipolar (III) Inmate From: Berlin (almost) |
posted 05-10-2003 22:54
Yep, exactly - see this FAQ for a few links: |