Jump to content

How to link to a script in a web page


sdpullen

Recommended Posts

How would I insert the following script into a web page in a certain area? I have my page set up on tables and want the image on the left side of the page inside a table. Look here: http://www.sikestonfirstmedia.org/testpage.htm
I turned the borders on so that you can see where things should be.

Here is the script:

[code]
<?php
$Sigs=array('http://www.sikestonfirstmedia.org/jocks/wknd.gif','http://www.sikestonfirstmedia.org/jocks/dj1.gif','http://www.sikestonfirstmedia.org/jocks/dj2.gif','http://www.sikestonfirstmedia.org/jocks/dj3.gif','http://www.sikestonfirstmedia.org/jocks/dj4.gif','http://www.sikestonfirstmedia.org/jocks/dj5.gif');
$times = array(0,5,9,14,19,24);
$time = date('H');
$day = date('D');
$w_days = array('Sun','Sat');
if (in_array($day,$w_days)) $i=0;
else {
$i = 0;
while ($time >= $times[$i]) $i++;
}
echo '<img src="',$Sigs[$i],'" >';
?>[/code]

Thanks for your help
Link to comment
Share on other sites

[quote author=RonnyZenn link=topic=123126.msg508543#msg508543 date=1169213909]
see this line
[code]echo '<img src="',$Sigs[$i],'" >';[/code]

I took it from your code, better if you change it in that way,
[code]
echo '<img src=\"'.$Sigs[$i].'\" >';
[/code]

i think then it should work ok.
[/quote]

Actually, the original syntax is perfect. There is no need to escape double quotes when you're within single quotes, and the comma is often the preferred concatonation device. Where your error apparently lies is that you are including PHP script within an HTM page. You have to do one of two things to get it to work:

1. Save the page as .php so your server knows how to interpret it

2. Modify your PHP install to recognize and parse .htm files as PHP

Good luck!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.