Beginner HTML Question

S

SpaceGirl

Karl said:
Guess you've never run into that on your "fan" sites.


-Karl

My "fan" site is a play site... it's currently being re-written from the
ground up and is pretty my JS free. It's a play site, non-commercial, so
hardly matters either way! :p

--


x theSpaceGirl (miranda)

# lead designer @ http://www.dhnewmedia.com #
# remove NO SPAM to email, or use form on website #
 
J

Jeffrey Silverman

I purchased the Macromedia Studio MX 2004 suite a month ago, and have been
teaching HTML to myself. (I've previously programmed in ALGOL, FORTRAN, BASIC.
I've dabled around in C, C++, and PASCAL. I've been using LaTeX regularly for
ten years and consider myself well above average, approaching expert.) I've
learned quite a bit about HTML in one month, and have become quite comfortable
with it. I have a question that I haven't been able to find the answer to in
several sources.

I want to include the text "90 years" in eight different locations in my site.
Next year I'll need to change all occurrences of "90" to "91". Rather than
search and replace all of the "90" occurrences, can I define a command, say
"&age;", at the beginning of the document, set it's value to 90, and then
include the text "&age; years" in the eight locations? Next year, I'll only
have to change the one value of "&age;" to 91, and then this will be reflected
throughout all eight occurences in the document. If this is possible, how can
I use "&age;" in other documents within the same site? Can I include this
command definition in the css?

Thank you.



Kurt Todoroff
(e-mail address removed)

Markets, not mandates and mob rule.
Consent, not compulsion.

Wow. All these responses in this thread and no one really seemed to
answer your question!

The question is "Can HTML be used to make dynamic changes using variables,
loops, branching, or other techniques found in typical programming
languages?"

The answer is, "NO". Period. HTML is NOT A PROGRAMMING LANGUAGE!!!! (I am
yelling here only because I have seen people post, incorrectly, that it
is.)

But, of course, that is only in the most technical sense. There ARE ways
to do what you want to do.

Possibilities include...

1) Use a server-side scripting language. PHP, ASP, JSP, Perl,
AppleScript, C/C++, Ada, Ruby, etc. (I am getting a little carried away.
Stick to one of the first four).

2) Use Server-side Includes (SSI).

SSI is like a proto-programming language, although it is really pretty
much just focused on bringing other files into the scope of your current
HTML page. A Templating system, if you will.

In your case, I recommend finding out what capabilities you have available
to you on the server. Post back another question on the specifics on how
to do what you want when we know what you have to work with.

Example, using SSI:
"index.shtml"
<html>
<body>
I am <!--#include age.txt--> years old! Wow!
</body>
</html>

"age.txt"
90

(The exact syntax may be off by a character or space here or there, but it
is pretty darn close. I don't use SSI, I use PHP, so I am working from
memory here!)


later...
 
S

Sam Hughes

Oh and my post had no actual point. The other poster did indeed
need to know that HTML is not a programming language, in a sense.

Egads I'm replying to myself doubly.

I mean, "The other poster did indeed need to know, in a sense, that HTML
is not a programming language." Silly languages. English needs a
postfix notation format.
 
S

Sam Hughes

Wow. All these responses in this thread and no one really seemed to
answer your question!

Numerous people did...
The question is "Can HTML be used to make dynamic changes using
variables, loops, branching, or other techniques found in typical
programming languages?"

The answer is, "NO". Period. HTML is NOT A PROGRAMMING LANGUAGE!!!!
(I am yelling here only because I have seen people post,
incorrectly, that it is.)

Nobody said that. Other people merely pointed out that using pure
HTML, one _can_ include information from other files, theoretically.
But, of course, that is only in the most technical sense.

Erm, HTML is not a programming language in any sense, except ones
propounded by bogosity itself :-o Or, maybe it _smells_ like a
programming language! :)
 
J

Jeffrey Silverman

Erm, HTML is not a programming language in any sense, except ones
propounded by bogosity itself :-o Or, maybe it _smells_ like a
programming language! :)

Ah, took the bait.

I actually am not trying to troll, really. What else can I do, though,
while I wait for Apache to compile? (well, okay, a lot of things.) But
HTML is not a programming language in any sense.

Here is why:
programming
n : creating a sequence of instructions to enable the computer
to do something

HTML does not create *instructions* of any type.
HTML does not provide logical operations such as loops, branches,
operators, etc.
HTML does not allow for variable data.

HTML does smell like a programming language, I'll grant you that. But it
is not a programming language at all.

HTML is a MARKUP language. Mark-up.
 
J

Jeffrey Silverman

Thanks for helping us out with that, Captain Obvious.
Nobody here would have known that were it not for you.

-Karl

Allright, I get it.

But I am just responding to it being called a programming language.

later...

Swwwooooshhhh!!! Away-ho! I'm Captain "O"!!
 
N

nice.guy.nige

While the city slept, Jeffrey Silverman ([email protected]) feverishly
typed...
Allright, I get it.

But I am just responding to it being called a programming language.

Maybe I've missed something here, but nobody in this thread has said that
HTML *is* a programming language - quite the opposite!

Cheers,
Nige
 
J

Jukka K. Korpela

Toby Inkster said:
Theoretically, yes.

Well, maybe not. We are pretty theoretical today, but to make my
contribution to the world supply of nitpicking, I would say that HTML
specifications exclude the possibility by requiring a fixed DOCTYPE
declaration. Where would you put said:
Number of browser that support it: 0.

Well, approximately 0 for practical purposes.

But if I use

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"

I can then use &age; in the text. This conforms to XML specifications,
and is supported by Opera. But it does not conform to XHTML
specifications, which require that I use one of the give magic
incantations as the DOCTYPE declaration. So it could be an XML document
that only uses XHTML 1.0 tags, but it still would not - technically - be
an XHTML document. And naturally it would fail to work in a vast majority
of browsing situations-
Use search and replace. Of if you really don't want to do that, a
server-side include.

Yes, or some other server-side techniques (like generating the HTML
document with a CGI script - easier than it sounds, when available).
 
K

Karl Groves

Jeffrey Silverman said:
Allright, I get it.

But I am just responding to it being called a programming language.

I don't recall seeing anyone say that.

-Karl
 
J

Jeffrey Silverman

Maybe I've missed something here, but nobody in this thread has said that
HTML *is* a programming language - quite the opposite!

Cheers,
Nige

Hmph. That does appear to be the case. Comments withdrawn. Apologies all
around.


Must've misread something somewhere, but I have a <3 month old infant and
I must plead sleep deprivation!

later...
 
T

Toby Inkster

Jukka K. Korpela wrote:
| <?xml version="1.0" encoding="UTF-8"?>
| <!DOCTYPE html
| PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
| [<!ENTITY age "90">]
| >
|
| I can then use &age; in the text. This conforms to XML specifications,
| and is supported by Opera.

Really? Wow! I never knew Opera supported that. I may have to have a play
with that some time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top