User Name
Password

Go Back   Planetarion Forums > Non Planetarion Discussions > Programming and Discussion

Reply
Thread Tools Display Modes
Unread 18 Sep 2003, 13:56   #1
Ragnarak
Registered User
 
Ragnarak's Avatar
 
Join Date: Oct 2000
Posts: 4,944
Ragnarak is a splendid one to beholdRagnarak is a splendid one to beholdRagnarak is a splendid one to beholdRagnarak is a splendid one to beholdRagnarak is a splendid one to beholdRagnarak is a splendid one to beholdRagnarak is a splendid one to behold
Javascript in PHP file help

ok i have this javascript code from an ad company:

Code:
<!-- FASTCLICK.COM 728x90 and 468x60 BANNER CODE for blahblah.co.uk -->
<script language="javascript" src="http://media.fastclick.net/w/get.media?sid=14116&m=1&tp=5&d=j&t=n"></script>
<noscript><a href="http://media.fastclick.net/w/click.here?sid=14116&m=1&c=1" target="_blank">
<img src="http://media.fastclick.net/w/get.media?sid=14116&m=1&tp=5&d=s&c=1"
width=728 height=90 border=1></a></noscript>
<!-- FASTCLICK.COM 728x90 and 468x60 BANNER CODE for blahblah.co.uk -->
I need to include this in a php file but know i need to alter it a bit to do so.

The php file looks like this:

PHP Code:
 echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" bgcolor=\"#000080\" width=\"80\" align=\"center\">\n" 
so i know i need to change " to \" but not sure if it's that simple.

If anyone could tell/show me how to change the javascript to get it to work i'd appreciate it

Thanks
__________________
I find it kind of funny
I find it kind of sad
The dreams in which i'm dying
Are the best i've ever had
Ragnarak is offline   Reply With Quote
Unread 18 Sep 2003, 14:08   #2
BuddhistPunk
Registered User
 
Join Date: Apr 2002
Location: Leeds, but looking for a way to escape
Posts: 128
BuddhistPunk is an unknown quantity at this point
Rather than editing the given code to fit into a php echo or print, I would suggest dropping out of php tags and using plain html instead. It will save you alot of time.

e.g.

Code:
<?php
$message = "Hello World";

//more php stuff here
?>

<!-- BANNER CODE IN PLAIN HTML HERE -->

<?

print $message;

//more php stuff here
?>
__________________
SELECT everything FROM everywhere WHERE something = something_else;
> 42
BuddhistPunk is offline   Reply With Quote
Unread 18 Sep 2003, 15:08   #3
Ragnarak
Registered User
 
Ragnarak's Avatar
 
Join Date: Oct 2000
Posts: 4,944
Ragnarak is a splendid one to beholdRagnarak is a splendid one to beholdRagnarak is a splendid one to beholdRagnarak is a splendid one to beholdRagnarak is a splendid one to beholdRagnarak is a splendid one to beholdRagnarak is a splendid one to behold
Quote:
Originally posted by BuddhistPunk
Rather than editing the given code to fit into a php echo or print, I would suggest dropping out of php tags and using plain html instead. It will save you alot of time.
that would be much better but the part i need to add the javascript to is inside a function and so i don't think i can split it in half can i?
__________________
I find it kind of funny
I find it kind of sad
The dreams in which i'm dying
Are the best i've ever had
Ragnarak is offline   Reply With Quote
Unread 18 Sep 2003, 15:36   #4
BuddhistPunk
Registered User
 
Join Date: Apr 2002
Location: Leeds, but looking for a way to escape
Posts: 128
BuddhistPunk is an unknown quantity at this point
You can :-D

Code:
<?
//test function breakouts
WriteHtml("foobar");

function WriteHtml($message)
{
	print "<font face=verdana size=1>A line of text from PHP<br></font>";
	?>
	<font face=verdana size=1>A line of text from HTML<br></font>
	<font face=verdana size=1>Another line of text from HTML with a PHP var : <?=$message?><br></font>
	<?
	print "<font face=verdana size=1>Another line of text from PHP<br></font>";
}

?>
That will output :

A line of text from PHP
A line of text from HTML
Another line of text from HTML with a PHP var : foobar
Another line of text from PHP
__________________
SELECT everything FROM everywhere WHERE something = something_else;
> 42
BuddhistPunk is offline   Reply With Quote
Unread 18 Sep 2003, 16:03   #5
Ragnarak
Registered User
 
Ragnarak's Avatar
 
Join Date: Oct 2000
Posts: 4,944
Ragnarak is a splendid one to beholdRagnarak is a splendid one to beholdRagnarak is a splendid one to beholdRagnarak is a splendid one to beholdRagnarak is a splendid one to beholdRagnarak is a splendid one to beholdRagnarak is a splendid one to behold
Quote:
Originally posted by BuddhistPunk
You can :-D
cheers

think it's all sorted now
__________________
I find it kind of funny
I find it kind of sad
The dreams in which i'm dying
Are the best i've ever had
Ragnarak is offline   Reply With Quote
Unread 18 Sep 2003, 16:18   #6
Mong
Forever Delayed
 
Join Date: Sep 2000
Location: www.netgamers.org
Posts: 1,475
Mong is on a distinguished road
By the way, use single quotes in PHP were possible, it aids speed.

echo "Mong is ace";
echo 'Mong is ace';

The latter is executed quicker as the stuff inside the quotes is not evaluated.

You should only use it thusly;

$foo = 'ace';
echo "Mong is $foo";

M.
__________________
Firefly Oper and General l4m3r - "I Do Stuff"

O2 Rip-off campaign

<vampy> plus i hate people ... i despise humanity as a whole

pablissimo "I'm still geting over the fact you just posted a pic of your own vomit"
Mong is offline   Reply With Quote
Unread 19 Sep 2003, 01:26   #7
Gayle29uk
Bitch
 
Join Date: Jun 2002
Location: North Yorkshire
Posts: 3,848
Gayle29uk is just really niceGayle29uk is just really niceGayle29uk is just really niceGayle29uk is just really nice
Quote:
Originally posted by Mong
$foo = 'ace';
echo 'Mong is '.$foo;
__________________
ACHTUNG!!!
Das machine is nicht fur gefingerpoken und mittengrabben. Ist easy
schnappen der springenwerk, blowenfusen und corkenpoppen mit
spitzensparken. Ist nicht fur gewerken by das dummkopfen. Das
rubbernecken sightseeren keepen hands in das pockets. Relaxen und vatch
das blinkenlights!!!
Gayle29uk is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Forum Jump


All times are GMT +1. The time now is 21:53.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018