473,813 Members | 3,361 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Share common HTML code among different HTML files?

MK
Dear friends,

I have many HTML files and they all have some common HTML code which is
basically bunch of tags which are in all the files. How can I put the common
code in one file and then share it in all the files? It is some thing like
following in all the HTML files which I have.

<HTML>
<HEAD> Common </HEAD>
<BODY>
..... Common code/tags
</BODY>
</HTML>

I want to do this so that I don't have to edit all the files if some common
code has changed. Your help is very much appreciated.

Regards,
MK
Jul 24 '05 #1
5 7591
MK wrote:
I have many HTML files and they all have some common HTML code
which is basically bunch of tags which are in all the files. How
can I put the common code in one file and then share it in all the
files? It is some thing like following in all the HTML files which
I have.


http://www.allmyfaqs.com/faq.pl?Incl...ile_in_another

--
-bts
-This space intentionally left blank.
Jul 24 '05 #2
On Sat, 14 May 2005 22:05:58 +0000, MK wrote:
Dear friends,

I have many HTML files and they all have some common HTML code which is
basically bunch of tags which are in all the files. How can I put the common
code in one file and then share it in all the files? It is some thing like
following in all the HTML files which I have.

<HTML>
<HEAD> Common </HEAD>
<BODY>
.... Common code/tags
</BODY>
</HTML>

I want to do this so that I don't have to edit all the files if some common
code has changed. Your help is very much appreciated.

Regards,
MK


Try PHP. Its very simple code. If your server supports PHP, just include
this in your 'index.php' page wherever you want the changing content to go:

<?php
if (!isset($_GET['p'])) {
include("includ es/default.php");
} else {
include("includ es/" . $_GET['p'] . ".php");
}
?>
On your menu, or wherever the links go to load the different content, use
this code:

<a href="index.php ?p=PageName">Li nk Text</a> (notice that the links do not
have a file extension. The php code adds .php to the link and grabs the
file from the includes directory).
All of your content should be saved in a directory called "includes" and
they should have the extension .php

If you have any questions, there are links to PHP tutorials on my website
at
http://s94621231.onlinehome.us
(getting a domain name soon).

So you have:

-index.php (your 'common code' with the php code mentioned above)
-includes (directory that contains the files you want to include)
Jul 24 '05 #3
On Sat, 14 May 2005 23:55:05 -0400, noSpAm0000 wrote:
http://s94621231.onlinehome.us
(getting a domain name soon).

So you have:

-index.php (your 'common code' with the php code mentioned above)
-includes (directory that contains the files you want to include)


Sorry, I forgot to mention something -- your 'includes' directory should
have a file in it called default.php. That would be the initial content
that loads.
Jul 24 '05 #4
noSpAm0000 wrote:
Try PHP. Its very simple code.
Too simple.
<?php
if (!isset($_GET['p'])) {
include("includ es/default.php");
} else {
include("includ es/" . $_GET['p'] . ".php");
}
?>


If people include some "../" in their URL that will give access to any PHP
file on the computer. You need to make sure that doesn't happen. You also
need to check that the specified file exists before trying to include it.
Its safer to only allow access to specific files rather than any that the
user can guess the name of.

--
David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 24 '05 #5
@Name: öÅÎÑ HÅËÏÚ

?::..::..::Find something new, noSpAm0000::..: :..::?

14 íÁÊ 05 noSpAm0000 ÐÉÓÁÌ All, Á Ñ ÒÅÛÉÌ ÄÏÐÏÌÎÉÔØ:
I have many HTML files and they all have some common HTML code which is
basically bunch of tags which are in all the files. How can I put the
common code in one file and then share it in all the files? It is some
thing like following in all the HTML files which I have.

<HTML>
<HEAD> Common </HEAD>
<BODY>
.... Common code/tags
</BODY>
</HTML>

I want to do this so that I don't have to edit all the files if some
common code has changed. Your help is very much appreciated.


n> Try PHP. Its very simple code. If your server supports PHP, just
n> include this in your 'index.php' page wherever you want the changing
n> content to go:
n> <?php
n> if (!isset($_GET['p'])) {
n> include("includ es/default.php");
n> } else {
n> include("includ es/" . $_GET['p'] . ".php");
n> }
?>>

This is very loosy and unsafety code. With this code hackers can use
your site like proxy. Read about CRLF code injection in PHP.
?::..::..::Run, noSpAm0000::..: :..::?
.... mini7 Design & Internet Solutions
Jul 24 '05 #6

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

Similar topics

8
3356
by: Jan van Veldhuizen | last post by:
The UPDATE table FROM syntax is not supported by Oracle. I am looking for a syntax that is understood by both Oracle and SqlServer. Example: Table1: id name city city_id 1 john newyork null
346
16659
by: rkusenet | last post by:
http://biz.yahoo.com/rc/040526/tech_database_marketshare_1.html Interesting to see that database sales for windows is more than Unix.
5
5287
by: Baren | last post by:
Hi! I am using impersonate="true" to upload and download files from a network share. I have created common users on both the webserver and the file server. The user has permission to the files server folder. I am able to upload the files into the fileserver, but while downloading the same i am getting error "file doesn't exist" and the path it shows is localhost temporary internet files.
5
2054
by: Richard K | last post by:
Is it possible to share a single source file among two or more Projects in a Solution? I'm not talking about a DLL, just a .vb file that might contain a class or module with common code to be compiled into each project. That way this code can be updated once instead of makiing duplicate changes to identical code within each project. I have tried putting the source in a common folder, then using Add Existing Item to add it to each...
3
3307
by: Ron L | last post by:
I have an application that I am developing that is a front end for a SQL database. We will also be developing a subset of the UI that will work as a (mainly) standalone client that will make a connection to the database, copy the relevant data to a local file, and disconnect from the database. The users will then be able to make modifications using the UI, and when a connection is available they can connect and upload their changes. ...
2
2336
by: Mike9900 | last post by:
We need to deploy 2 or more projects that share the same assemplies , such as common.dll. And so we need to put all these files in the same //bin directory in the server with common files. But the assebmly name for the proect is the same. For example, we need different assemblies for each project, for example as1.dll, as2.dll and the common files for example common.dll. So when we deply them, we put all these files in one directory,for...
3
3145
by: Bob Peek | last post by:
I would like to share code between several web sites that exist as virtual directories under a single site. It appears that I have to create an app_code directory under each virtual root in order to share classes accross the code in the different virtual directories. This seems to defeat the purpose of shared code. Is there any way to specify to IIS where the app_code directory is for a virtual site?
4
4679
by: Jeremy S. | last post by:
We're in the process of writing a new Windows Forms app and the desktop support folks want for it to be run from a network share. I know it's possible (i.e., just have the framework on the clients and a desktop shortcut to the exe out on the network)... but is it really a good idea? What are some arguments for and against running a .NET Windows Forms client from a network share? Here is my initial list... I'd appreciate any additions,...
15
5817
by: Neo | last post by:
Hello All, I found that ASP.net website only accepts code withing site directory. This creates big hurdle in shairng code. How to share code between two websites, like the way share between two non-website code? -Pravin
0
9734
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9607
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10669
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10424
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7684
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6897
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5569
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4358
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3885
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.