Solved: HTML common code ?

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

sawat

Thread Starter
Joined
Dec 4, 2010
Messages
14
i have 300 HTML files. each of them contains 15 lines of identical html code in a single div.
is there a way to separate the common code to it's own file and then include this common code
in all 300 html file with a single simple instruction ?
 
Joined
May 20, 2010
Messages
4,038
According to my knowledge there is no way to do what you are asking for, because HTML won't support that kind of activities as CSS do.
 

sawat

Thread Starter
Joined
Dec 4, 2010
Messages
14
thanks sepala, i can't find a way to use css for this - maybe you can post an example ? regards
 
Joined
May 20, 2010
Messages
4,038
sawat,

we use CSS only for the styling purposes. What I mentioned in the above post is, you know we can create a one common style Sheet for several web pages, and the only thing we have to do is calling it from the HTML page. But for HTML, we don't have such a facility.
 

sawat

Thread Starter
Joined
Dec 4, 2010
Messages
14
hi sepala here is the common code that appears just before the
body end tag in all 300 html files

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
ccccccccccccccccccccccccccccccccccccccccc

(i have omitted all the html tags as they garble this post)

if you are telling me a css link can do that, i think we probably have a communications problem,
i am looking for a php script solution. regards.
 
Joined
May 20, 2010
Messages
4,038
sawat,
I used CSS just as an example, and I didn't say it will suit "THIS CASE" because this is not a COMMON STYLE SHEET MATTER.

pardon me, as I said, according to my knowledge there is no way to take a part of a HTML code in to another page and MAKE IT AVAILABLE to ALL pages.
 

sawat

Thread Starter
Joined
Dec 4, 2010
Messages
14
hi sepala, i agree with you that you do not understand what css is, and what it can and and cannot do.i apologise for wasting your time with my comments. regards and please no more replies from you ! ---------
 
Joined
Aug 12, 2007
Messages
696
sawat,

What web server platform are you using? What you are describing is very common and a great way to keep your scripts very clean and easy to maintain, but this has to be done on the server-side using scripting of some sort. For example, php can do this if you have it available. Just move the common code to a separate file, then rename the original html script to end in .php. Then replace your common code in the original html script with a line like:
Code:
<?php include('commoncode.php') ?>
It's really that simple, no need for any other php knowledge. Other server-side languages like asp.net will have something similar.
 
Joined
May 20, 2010
Messages
4,038
I have to reply because I think you messed up with who knows CSS and Don't. Think about it. The sad thing is, even you don't know HTML. Even 5 year kid could do. so sad
 

sawat

Thread Starter
Joined
Dec 4, 2010
Messages
14
hi ehymel, and thanks for the first cojent reply to my post.
i will have a look around for some php script. thanks
PS a note for sepala - what sort of idiot are you that ignores my asking you not
to post ? you seem not only to be ignorant of the subject on hand but illiterate also
PLEASE DO NOT POST AGAIN sepala. on the basis of your stupid replies it would not be difficult
to have you banned from here
 

Cookiegal

Karen
Administrator
Malware Specialist Coordinator
Joined
Aug 27, 2003
Messages
118,115
sepala,

This is not my area of expertise either (I know nothing about CSS, etc) but if CSS is not able to do what the poster is asking help with then I don't see why you mentioned it.

sawat,

Regardless of what you think of the replies, it's not appropriate for you to take things into your own hands. In the future, please report the situation to the moderators and they will decide what, if any, action is necessary.
 

sawat

Thread Starter
Joined
Dec 4, 2010
Messages
14
hi, cookiegal, pleased admin are taking an interest in this debacle. what do you mean "it's not appropriatefor for you to take things into your own hands" ?and how do i report to admin about the absurdities in this thread ?all i posted was a simple question about html on the correct web board. since then i have had 8 emails and a lot of rubbish as a result. apart from ehymel a total waste of my precious time.have you looked at the posts by sepala and found anything correct and useful , on this or his other postings ?how does techguy admin differentiate between useful replies and total rubbish ?as you admit no-one is a master/mistress of all things. regards.
 

Cookiegal

Karen
Administrator
Malware Specialist Coordinator
Joined
Aug 27, 2003
Messages
118,115
hi, cookiegal, pleased admin are taking an interest in this debacle. what do you mean "it's not appropriatefor for you to take things into your own hands" ?
that means you shouldn't have posted a reply to the other poster like you did.
and how do i report to admin about the absurdities in this thread ?
On the bottom right-hand side of every post there is an icon that says "Report" in the same row of icons as "Edit" "Quote", etc. Just click on that and fill in the details regarding the reason for the report and send it. This type of message goes to all of the moderators and administrators and they will then review the situation and decide what action needs to be taken.
all i posted was a simple question about html on the correct web board. since then i have had 8 emails and a lot of rubbish as a result.
If you have your settings to allow people to e-mail you, we have no control over that. If you're referring to e-mail notifications of replies then that is the way it works. If you don't want to receive them then you have to unsubscribe from the thread and you won't be notified if anyone replies.
apart from ehymel a total waste of my precious time.have you looked at the posts by sepala and found anything correct and useful , on this or his other postings ?
That is between sepala and the administration.
how does techguy admin differentiate between useful replies and total rubbish ?
If the moderators come across something that is bad advice or wrong information they will handle it. But we can't be everywhere at once and screen all of the replies. We also rely on other members to report any misinformation. That is the way these types of communities work. :)
 

DrP

Joined
Jul 23, 2005
Messages
739
Can also be done with JavaScript but agree with others: use a PHP include if you server supports PHP.
 
Joined
May 20, 2010
Messages
4,038
sepala,

This is not my area of expertise either (I know nothing about CSS, etc) but if CSS is not able to do what the poster is asking help with then I don't see why you mentioned it.

sawat,

Regardless of what you think of the replies, it's not appropriate for you to take things into your own hands. In the future, please report the situation to the moderators and they will decide what, if any, action is necessary.
I think there is a communication problem, and thats what lead to the misunderstandings. What I said is this, I am explaining it as much as I can.

I said, In CSS we create external CSS files to avoid multiply coding(In here I am just giving an example, didn't say CSS is the solution, JUST AN EXAMPLE, becasue I wanted to say WE CAN'T DO AVOIDING MULTIPLY CODING AS WE DO THERE). But in HTML, we can't do things like that, because HTML is not that kind of a language.

Then he asked how to do it by CSS. Then I said " We can't do those stuffs, because it is a styling language, if your case is related to styling problems, then we can do that"

I hope I have explained the situation.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Members online

Top