473,322 Members | 1,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Simple header file that doesn't work rightly...

MM
Hi everybody,
what do you think about this problem?
I want to create a HTML header file with 2 variables, as below:
-----------------------------
$title = "Title of document";
$style = "./style/style.css";

print<<<HED
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://
www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>$title</title>
<meta http-equiv = 'Content-Type' content='text/html;
charset=iso-8859-1'>
<meta http-equiv = 'Content-Style-Type' content = 'text/css'>
<link href = '$style' rel = 'stylesheet' type = 'text/css'>
</head>
<body>
HED;
-----------------------------

It doesn't work rightly: $title is printed... $style not.
I have tried to modify everything and I have found it only works as
below:

....
<link href = './style/style.css' rel = 'stylesheet' type = 'text/css'>
....

i.e. it works only if I write the string with file path directly.
But... I want a variable!

[NOTE: the problem isn't HEREDOC, it's the same with print("...") or
echo "..."]

Suggestions?
Thanks.

Regards,
MM

Jun 12 '07 #1
3 2097
MM napisał(a):
Hi everybody,
what do you think about this problem?
I want to create a HTML header file with 2 variables, as below:
-----------------------------
$title = "Title of document";
$style = "./style/style.css";

print<<<HED
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://
www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>$title</title>
<meta http-equiv = 'Content-Type' content='text/html;
charset=iso-8859-1'>
<meta http-equiv = 'Content-Style-Type' content = 'text/css'>
<link href = '$style' rel = 'stylesheet' type = 'text/css'>
</head>
<body>
HED;
-----------------------------
I don't see any problems in this piece of code on my computer.
Why don't you simply use

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><?php echo $title; ?></title>
<meta http-equiv = 'Content-Type' content='text/html; charset=iso-8859-1'>
<meta http-equiv = 'Content-Style-Type' content = 'text/css'>
<link href = "<?php echo $style; ?>" rel = 'stylesheet' type = 'text/css'>
</head>
<body>

?

--
Wiktor Walc
http://phpfreelancer.net
Jun 12 '07 #2
MM
I don't see any problems in this piece of code on my computer.
Why don't you simply use

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><?php echo $title; ?></title>
<meta http-equiv = 'Content-Type' content='text/html; charset=iso-8859-1'>
<meta http-equiv = 'Content-Style-Type' content = 'text/css'>
<link href = "<?php echo $style; ?>" rel = 'stylesheet' type = 'text/css'>
</head>
<body>
Because it's really a part of class file that has whole code within <?
php and ?tag.

Jun 12 '07 #3

"MM" <ma******@gmail.comwrote in message
news:11*********************@i13g2000prf.googlegro ups.com...
Hi everybody,
what do you think about this problem?
I want to create a HTML header file with 2 variables, as below:
-----------------------------
$title = "Title of document";
$style = "./style/style.css";

print<<<HED
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://
www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>$title</title>
<meta http-equiv = 'Content-Type' content='text/html;
charset=iso-8859-1'>
<meta http-equiv = 'Content-Style-Type' content = 'text/css'>
<link href = '$style' rel = 'stylesheet' type = 'text/css'>
</head>
<body>
HED;
-----------------------------

It doesn't work rightly: $title is printed... $style not.
I have tried to modify everything and I have found it only works as
below:

...
<link href = './style/style.css' rel = 'stylesheet' type = 'text/css'>
...

i.e. it works only if I write the string with file path directly.
But... I want a variable!

[NOTE: the problem isn't HEREDOC, it's the same with print("...") or
echo "..."]

Suggestions?
Thanks.

Regards,
MM
works for me... I did this:
file ./style/style.css:
h1 {
border: 1px solid red;
font-size: 50%;
}
file 6.php:
<?php
$title = "Title of document";
$style = "./style/style.css";

print<<<HED
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://
www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>$title</title>
<meta http-equiv = 'Content-Type' content='text/html;
charset=iso-8859-1'>
<meta http-equiv = 'Content-Style-Type' content = 'text/css'>
<link href = '$style' rel = 'stylesheet' type = 'text/css'>
</head>
<body>
HED;
print<<<BOD
<h1>YO!</h1>
</body>
</html>

BOD;
?>

and it works just fine, the red border shows and the text is 50% of regular
h1
Jun 13 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Philipp Lenssen | last post by:
I have a problem doing a permanent redirect. It works only if I directly send the new location header (third line in sample below) but never in combination with sending a "301 Moved permanently"...
6
by: Sergio Otoya | last post by:
Hi all, Is there any way of copying a file using javascript, not using the Filesystemobject (ActiveX). I need this to run in Windows and MACS. Any help would be greatly appreciated. Thanks...
16
by: matthurne | last post by:
I just started learning C++ on my own...I'm using Accelerated C++. Something it hasn't explained and I keep wondering about is how header files actually work. I suspect it doesn't get into it...
1
by: Eric_Dexter | last post by:
I am just trying to acess a function in wordgrid (savefile) to a button that is defined in TestFrame. I can't seem to make it work I either get an error that my variable isn't global or it makes...
5
by: eric dexter | last post by:
I am just trying to acess a function in wordgrid (savefile) to a button that is defined in TestFrame. I can't seem to make it work I either get an error that my variable isn't global or it makes...
0
by: Grzegorz Smith | last post by:
Hi All. I 'm learning ZSI to use SOAP and I desperately need help. I'm working on example from tutorial -(examples/server/send_response/ simple/wsdl/). Here are my wsdl files...
40
by: =?iso-8859-1?B?QW5kcuk=?= | last post by:
I'm really annoyed at Python - and not for the reasons already mentioned on this list. Everyone know that programming is supposed to be a dark art, nearly impossible to learn. Computer code is...
3
by: pd | last post by:
guys, in my web app, i have a simple download button and a href which points to a file on my server, when the user clicks on the button or the link, the file should simply be downloaded to the...
32
by: alex.j.k2 | last post by:
Hello all, I have "PRECISION" defined in the preprocessor code and it could be int, float or double, but I do not know in the code what it is. Now if I want to assign zero to a "PRECISION"...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.