Closed Thread Icon

Topic awaiting preservation: PHP Templates and Javascript Pages that link to <a href="https://ozoneasylum.com/backlink?for=12730" title="Pages that link to Topic awaiting preservation: PHP Templates and Javascript" rel="nofollow" >Topic awaiting preservation: PHP Templates and Javascript\

 
Author Thread
The Jackal
Paranoid (IV) Inmate

From: The Dark Side of the Moon
Insane since: Jun 2000

posted 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"; ?>

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 05-10-2003 21:10

The Jackal:

quote:
do I just name the tag myself, like <?php $javascript = "Javascript Here"; ?>



Pretty much you can do:

code:
$page_title = 'My page';
$extra_javascript = 'JAVASCRIPT';



then include a header file with something like this in it:

code:
if (!empty ($extra_javascript)) {
echo "<script language=\"JavaScript\"";
echo $extra_javascript;
echo "</script>";
}



___________________
Emps

FAQs: Emperor

The Jackal
Paranoid (IV) Inmate

From: The Dark Side of the Moon
Insane since: Jun 2000

posted posted 05-10-2003 21:41

Thanks Emperor. Though you left the closing '>' out of

code:
echo "<script language=\"JavaScript\"";



It took me a sec to figure out why I got a blank page, LOL! I appriciate it man. L8R!

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted 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).

___________________
Emps

FAQs: Emperor

The Jackal
Paranoid (IV) Inmate

From: The Dark Side of the Moon
Insane since: Jun 2000

posted 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.

kuckus
Bipolar (III) Inmate

From: Berlin (almost)
Insane since: Dec 2001

posted posted 05-10-2003 22:54

Yep, exactly - see this FAQ for a few links:

:FAQ: How do I install AMP (Apache/PHP/Mysql) on my Windows computer for offline testing?

kuckus

« BackwardsOnwards »

Show Forum Drop Down Menu