Sometimes being a beginner is a good thing (you will find out why a bit later).
I am not a web designer even though I managed to create and maintain this website.
And I don't know many things about web design and PHP programming. The one
new thing I learned is "<!-- #include -->" directive.
With such command you can include another HTML code into your web page. The
only thing that you should know is that your web page (where you include the
code) has to have ".shtml" extension. The file, which you include
doesn't have to have any specific extension.
This directive is useful to include the same header and footer to your pages
(that's what I use it mostly for). So you can modify the header and footer
in one place.
Because I still don't know much about this directive - I play with it. I try various things and make a lot of mistakes. One of them that there should not be any space between "<!--" and "#include". Otherwise it doesn't work. Well, one time I thought, why cannot I make the webserver to process PHP code and include the results via "#include" directive? Of course, I tried and it worked. Though my friend, who is a web developer and who I ask some stupid questions about PHP and HTML, was surprised. He didn't think that such approach should work. But it does. Here is the short version of what I do:
main.shtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title>Photography Techniques and Images at Artificial Rainbow by Roman
Zolin</title>
</head>
<body>
<!--#include virtual="/include/menu.php?header=My Header" -->
</body>
<html>
menu.php
<?
$header = "";
if ($_GET["header"]!="") $header
= $_GET["header"];
$header = "Default Header";
?>
If you look at the main.shtml page you will see the directive include and that is brings the menu.php file. And that it passes the parameter "header" (the value is "My Header"). The menu.php uses this parameter to include into <h1></h1> tags. If the parameter is empty then the header will be named "Default Header".
So as the result of this composition you would see a single page with My Header of Heading 1 style.
No Comments/Pingbacks for this post yet...
When we find something interesting and useful, which we want to return to and share with others, it will be posted here. It could be about composition, digital effects, photoshop, photography business or links to interesting websites.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
<< < | ||||||
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |