Page 1 of 2
inserting php in non-php pages (dynamic banner)
Posted: Mon Oct 27, 2003 11:42 am
by kendall
Hi,
sorry but couldnt really think of an appropriate name for the question....
I have created a banner script that randomly displays images from a database...
the script is to be called with a variaiable parameter and then echoes a img tag with the information...
How do you guys get this to work on non-php pages... reason for this is that i want to be able to have ppl display my banners by merely calling the script
here my theory of function
php script
<?php
i get the type of banner to display true $_GET['type'];
get the random banner from database using mysql_query();
echo banner using <img src=PATH.mysql_result>
?>
but how do i call the script from a non php stand point?
Kendall
Posted: Mon Oct 27, 2003 11:57 am
by m3rajk
i think you need to use the cgi-module which needs to be called via <script language="php"></script>
inserting php in non-php pages (dynamic banner)
Posted: Mon Oct 27, 2003 12:28 pm
by kendall
m3rajk,
i think you need to use the cgi-module
what is the cgi-module...
i did use a
Code: Select all
<script language = php src = file.php></script>
but it didnt work...i got no output

Re: inserting php in non-php pages (dynamic banner)
Posted: Mon Oct 27, 2003 12:35 pm
by vigge89
kendall wrote:m3rajk,
i think you need to use the cgi-module
what is the cgi-module...
i did use a
Code: Select all
<script language = php src = file.php></script>
but it didnt work...i got no output

what about
Code: Select all
<script language="php" src="file.php"></script>
?
Posted: Mon Oct 27, 2003 12:55 pm
by kendall
vigger,
uhmmm... thats what i meant
Posted: Mon Oct 27, 2003 1:27 pm
by kendall
just to update...there's a attribute to the <script> tag...
found it in dreamweaver but not on W3C documentation
wat is it?
Kendall
Posted: Mon Oct 27, 2003 1:36 pm
by vigge89
kendall wrote:just to update...there's a attribute to the <script> tag...
found it in dreamweaver but not on W3C documentation
wat is it?
Kendall
does that work?
and also, my name is victor - nickname is vigge, not vigger, veggo or something

Posted: Mon Oct 27, 2003 1:38 pm
by kendall
viggee,
noooooo...........
what is meant by a cgi-module?
Kendall
Posted: Mon Oct 27, 2003 4:11 pm
by evilMind
cgi: common gateway interface - standard for running external programs from a web server. CGI specifies how to pass arguments to the program as part of the request.
module: An independent piece of software which forms part of one or more larger programs. Modules are usually compiled seperately (in compiled languages) and provide an abstraction or information hiding mechanism so that a module's implementation can be changed without requiring any change to other modules.
Posted: Mon Oct 27, 2003 5:10 pm
by m3rajk
php can be installed as a stand alone. in this version all your pages are .php
or as a cgi-module, in which case i believe you have pages as .html with <script language="php"> /* php in here */ </script>
Posted: Mon Oct 27, 2003 6:58 pm
by JAM
I belive that...
Code: Select all
<img src="http://www.phpdrivenserver.net/image.php?name=foo" />
...should do the trick. If you have the correct header()'s in the file on the php driven server, you should get an image. by using $_GET you can choose what image.
I cant see any other problems.
Posted: Tue Oct 28, 2003 7:29 am
by kendall
evilMind,
I kinda know what CGI and MODULE's are i just wanted to know what was meant by it in relation to PHP
m3rajk,
AH....thanks i think you made it a bit clearer for me....
so your saying that all i need to do is insert
Code: Select all
<script language="php">
<?php
php code here
?>
</script>
then how come...
Code: Select all
<script language="php" runat="www.onlinetnt.com" src='file.php'></script>
doesn't work??? further more...WTF is the attribute 'runat' ??? i dont see it in the 3WC documentation. this is something that 'popped' up in dreamweaver coding hints.
JAM,
ma man Jamm....believe it or not seeing that all else failed i was attempting this method because all i want people to do is just insert one small tag that will link the banners to there pages and not have to insert a large bunch of code with <script><?php ?></script> method...i'm having a bit of a time understanding how it actually works but im still trying to figure it out myself...
Kendall
Posted: Tue Oct 28, 2003 7:47 am
by kendall
Jam...
quick question if my banners were HTML coded how would this react when i <img src='banner.php?banner=html'> which generated an html banner?
Kendall
Stil...trial and error is the best way to learn
Posted: Tue Oct 28, 2003 8:27 am
by kendall
JAM...
I can't seem to get this thing to work
heres my php code
Code: Select all
// after getting the results
$Image = mysql_fetch_assoc($IMG);
// display image
// get content type
echo 'http://www.onlinetnt.com/images/advertisements/'.$Image['file'];
here's what i do to retieve the script
Code: Select all
<img src="http//onlinetnt.com/ad_system.php?type=B">
what else do i need to do??
Kendall
Posted: Tue Oct 28, 2003 3:11 pm
by kendall
Kendall,
ok guys i got it i had to invoke a javascript document.write() in order to this display the image