PDA

View Full Version : How to print url in perl?


bazz
02-15-2005, 07:59 PM
Hi,


$Header = "http://mydomain.com/headers_and_footers/header.txt";

sub put_header {
print <<ENDPR;
Content-type: text/html



$Header


ENDPR
}


Not doing as I want, this variable is supposed to call in a url. Unfortunately is just prints the url on the page. I tried a php include and then the whole include is printed.


Help plz.

mlseim
02-15-2005, 08:39 PM
Do this ...

$Header = "http://mydomain.com/headers_and_footers/header.txt";
print "Location: $Header\n\n";

====================================================

DO NOT put: print "Content-type: text/html\n\n";
before: print "Location: $Header\n\n";

likewise, if you removed this: Content-type: text/html
from your code, it might work.

bazz
02-16-2005, 01:01 PM
Max thanks but, I am still having trouble getting it to work.

If I place it before the sub, it works but doesnt print the sub.

If I place it in the sub before 'Content text/html' it shows the header page but bnot that rest of the html thats to be outputted by the perl.

If I place it after the 'Content Type' it prints just ";

If I remove Content Type, I just get the whole outputted html as a text file.

What the heck am I not getting, about this ??

Sorry for the numerous questions.

Bazz



sub put_header {


print <<ENDPR;
Content-type: text/html
print "Location: $Header\n\n";
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<head>

<title>Sample Site #1</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<link rel="stylesheet" href="globalstyle.css" type="text/css">


</head>

<body>





ENDPR
}

mlseim
02-16-2005, 02:00 PM
I guess I've lost the purpose of what you are trying to do.

bazz
02-16-2005, 02:08 PM
OK, I have a perl file that outputs html.

$Header = "filename" where that file is determined by the website calling the perl. This means that if yoursite.com links to the perl file, that when it provides its own output, $header places part of your web page before the outputted html.
$Footer places the rest of your html after the outputted html so that the end result is that the outputted html, is configured to your sites appearance.

Then if somone else's site links to the perl file, that it presents the outputted html to match their sites appearance.

see an example here (http://thechrissystem.com/samplesites/sample1/index.php). the text you see on each page is actually outputted by separate perl files so that the only stuff in the html proper, is the menu and the background colors. The images come from elsewhere too , as you know. :) The problem is best seen from the Meal Menus page. Click on a specific item to see that the resulting page is bust, because it shows no matching html.

So I am trying to make $Header pull the filename with the html stored in it - a bit like an include. But I can't get include to work here either. I am really stuck, right at the end of a near finished project.

Bazz