|
Posted by Petr Vileta on 08/15/06 22:50
<laredotornado@zipmail.com> píse v diskusním príspevku
news:1155653603.758087.104410@74g2000cwt.googlegroups.com...
> Hi, I'm using PHP 4.3. I have 15 pages in which I need to take the
> content of the BODY and put it in a little table ...
>
> <table>
> <tr><td colspan="3"><img src="header.gif"></td></tr>
> <tr>
> <td><img src="left_img.gif"></td>
> <td><!-- body content goes here --></td>
> <td><img src="right_img.gif"></td>
> </tr>
> <tr><td colspan="3"><img src="bottom.gif"></td></tr>
> </table>
>
> It is a pain to have to cut and paste all this HTML code (the above is
> just an abbreviated version) into all 15 pages. And plus, if the shell
> changes, I'll have to change it in 15 pages. Any advice on an
> efficient way to add this to everything?
>
Use simple trick. Every time if you use include"..." the PHP go into parse
mode (html mode).
Here is example of use.
file "table.inc"
------
<table>
<tr><td colspan="3"><img src="header.gif"></td></tr>
<tr>
<td><img src="left_img.gif"></td>
<td><!-- body content goes here --></td>
<td><img src="right_img.gif"></td>
</tr>
<tr><td colspan="3"><img src="bottom.gif"></td></tr>
</table>
------
file "page1.php"
------
<html><head>
<title>Page 1</title>
</head>
<body>
<?php
include "table.inc";
?>
.... other content
</body></html>
------
file "page2.php"
------
<html><head>
<title>Page 2</title>
</head>
<body>
<?php
include "table.inc";
?>
.... other content
<?php
include "table.inc"; // insert the table second time
?>
</body></html>
------
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
Navigation:
[Reply to this message]
|