Forum Moderators: open

Message Too Old, No Replies

Common Text across Pages

Text that has to repeat across 6 Pages

         

MSkeenan

9:15 pm on Nov 16, 2005 (gmt 0)



I am a relative new be to HTML/CSS developing my own sites .. I have Text that repeats in through out my personal page. What i want to know is can i have it in a TXT file and have my HTML code read that TXT file?
here is the section excert ..

<!-- Begin Second Content Box -->
<h1>Quotes From Rev Run </h1>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr><td width="9" class="whitebox_topleft"><img/ src="../img/blank.gif" width="9" height="9" hspace="0" vspace="0" border="0" alt="" /></td><td class="whitebox"

style="border-top: 1px solid #666666;"><img/ src="../img/blank.gif" width="9" height="9" hspace="0" vspace="0" alt="" /></td><td class="whitebox" width="9"

style="border-top: 1px solid #666666; border-right: 1px solid #666666;"><img/ src="../img/blank.gif" width="9" height="9" hspace="0" vspace="0" alt="" /></td></tr><tr><td

class="whitebox" width="9" style="border-left: 1px solid #666666;"><img/ src="../img/blank.gif" width="9" height="9" hspace="0" vspace="0" alt="" /></td><td

class="whitebox">

<p> <b>BLA BLA BLIGITTY BLA needs to be repeated .. </b></p>

<p> </p>

</td><td class="whitebox" width="9" style="border-right: 1px solid #666666;"><img/ src="../img/blank.gif" width="9" height="9" hspace="0" vspace="0" alt=""

/></td></tr><tr><td width="9" class="whitebox" style="border-left:1px solid #666666;border-bottom:1px solid #666666"><img/ src="../img/blank.gif" width="9" height="9"

hspace="0" vspace="0" alt="" /></td><td class="whitebox" width="100%" style="border-bottom:1px solid #666666"><img/ src="../img/blank.gif" width="9" height="9" hspace="0"

vspace="0" alt="" /></td><td width="9" class="whitebox_bottomright"><img/ src="../img/blank.gif" width="9" height="9" alt="" hspace="0" vspace="0" border="0" /></td></tr>
</table>
<!-- End Second Content Box -->

JAB Creations

3:53 am on Nov 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi MSkeenan and welcome to WebmasterWorld!

HTML, CSS, JavaScript are clientside meaning their code does not run or execute until it reachs the client (more specifically their browser, such as Firefox or Opera).

Serverside code is what you would need to do what you want. You can't really send files and merge them together via clientside, not effectively at least! Your server should support PHP so I will post a full working example.

The PHP code (remember serverside stuff, you have to run HTTP server software on your computer or upload these to a server to get this to work) has to have a php extension.

Put both these files in the same directory.

example.php

<html>
<head>
<title></title>
</head>
<body>
<?php include("includes.php"); print $example1;?>
</body>
</html>

includes.php

<?php {
$example1 = ' <div><p>Hello world!</p></div>';
}?>

If you upload and get it to work correctly you'll see the clientside HTML code that you see in my post from the includes.php file as part of the example.php file. Remember, serverside executes BEFORE it is sent to you...so this would put that in to the example.php file and THEN send the page...you the client would see this in your browser.

If you have additional PHP questions you should post in the PHP forum which can be found at [webmasterworld.com...]

Hope this is what you want! :)

John

rocknbil

3:12 am on Nov 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Or . . .

<!-- contents of my_include.txt -->
<p> <b>BLA BLA BLIGITTY BLA needs to be repeated .. </b></p>

Then in your page file, put this line in place of BLA BLA . . . .

<!--#include file="my_include.txt" -->

or if my_include.txt is in a different directory,

<!--#include virtual="somedirectory/my_include.txt" -->

The space before the last --> is important.

Save your page file with an shtml extension, that is mypage.shtml. This tells the server to parse the page using server-side includes (SSI.)

If this does not work, it is possible that SSI is not enabled for your domain.