# Solved: HTML common code ?



## sawat (Dec 4, 2010)

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 ?


----------



## sepala (May 20, 2010)

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 (Dec 4, 2010)

thanks sepala, i can't find a way to use css for this - maybe you can post an example ? regards


----------



## sepala (May 20, 2010)

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 (Dec 4, 2010)

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.


----------



## sepala (May 20, 2010)

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 (Dec 4, 2010)

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 ! ---------


----------



## ehymel (Aug 12, 2007)

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:

```
<?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.


----------



## sepala (May 20, 2010)

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 (Dec 4, 2010)

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 (Aug 27, 2003)

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 (Dec 4, 2010)

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 (Aug 27, 2003)

sawat said:


> 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 (Jul 23, 2005)

Can also be done with JavaScript but agree with others: use a PHP include if you server supports PHP.


----------



## sepala (May 20, 2010)

Cookiegal said:


> 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.
> 
> ...


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.


----------



## sepala (May 20, 2010)

sawat said:


> 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


Unfortunately I don't have time to fight with you, so I am stopping this right from here. There is one thing I have to say. It is better if you can maintain your disciplines. You can be a LORD to your place, but not to here. In here we all are same. So, don't try to command me. Hope you understood.



> have you looked at the posts by sepala and found anything correct and useful , on this or his other postings ?


Seems like you are just SHOUTING, without having a look at the web development section. This is the first time I gave a wrong answer, and that is also because of miss communication.


----------



## Jbirk (Jan 15, 2005)

You could use Server Side Includes if this is hosted by a server that supports that.


----------



## Cookiegal (Aug 27, 2003)

sepala said:


> Unfortunately I don't have time to fight with you, so I am stopping this right from here. There is one thing I have to say. It is better if you can maintain your disciplines. You can be a LORD to your place, but not to here. In here we all are same. So, don't try to command me. Hope you understood.
> 
> Seems like you are just SHOUTING, without having a look at the web development section. This is the first time I gave a wrong answer, and that is also because of miss communication.


It is no more appropriate for you to address sawat in this manner as it was for them to address you. You should have understood that from what I posted to them above.

Now, this conflict between you two is to stop here. Since this thread appears to be solved, I will mark it as such and close it. If this conflict carries into other threads then infractions and/or bans may result.


----------

