Click to See Complete Forum and Search --> : Macro?
repoleved
06-19-2005, 01:35 PM
Are there macros in html?
That is, can I record many lines of code under one word or one keyboard input so that I don't have to type those lines every time (and I do not want to copy and paste)?
Do you mean you need a good editor?
the tree
06-19-2005, 02:16 PM
Do you mean you need a good editor?Everyone needs a good editor.
HTML Kit (http://www.chami.com/html-kit/)s snippet feature seems to be what your after.
Unless of course, you want to utilise server side includes (http://bonrouge.com/br.php?page=faq#includes).
Charles
06-19-2005, 02:35 PM
Actually HTML has something like constants but they are called entities. And they can even be used to include from other files. But, alas, they aren't supported by browsers.
Stephen Philbin
06-19-2005, 02:45 PM
Well you can use 'em in XML right? Then it'd be supported by web browsers, but not file browsers that stumble around the web.
Maybe he just means copy and paste?
the tree
06-19-2005, 02:54 PM
Maybe he just means copy and paste? (and I do not want to copy and paste)?I think not.
Charles, have you got a resource about these entities you speak of?
Stephen Philbin
06-19-2005, 03:29 PM
Oh yeah. Didn't notice the bit in brackets.
I'm guessing what charles meant was an SGML entity declaration. Dunno if they differ any from XML, but to make one in XML ya just declare it like this:
<!ENTITY my_new_entity "I'm a self made entity. Aren't I all nice and shiney and new? I guess if you see me in a document then you must have called me by my entity reference of "&my_new_entity;" Oh I do like being an entity. :D">
Then, as you might have guessed, you call it with &my_new_entity;
Charles
06-19-2005, 04:05 PM
They're the same in SGML as they are in XML which is to say that they're the same in HTML as they are in XHTML. And sadly the browser known to me to support making your own is MSIE and only in XML/XHTML.
Charles
06-19-2005, 04:11 PM
Save the following with a ".xml" extension and give it a try:<?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 foo-bar '<p>Foo and bar.</p>'>
]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Example</title>
</head>
<body>
&foo-bar;
</body>
</html>
Charles
06-19-2005, 04:13 PM
That'll work in MSIE and Firefox, but the following will only work in MSIE:<?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 foo-bar SYSTEM 'test2.xml'>
]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Example</title>
</head>
<body>
&foo-bar;
</body>
</html>
Stephen Philbin
06-19-2005, 04:23 PM
I've seen you say MSIE gets more XML right. I was wondering which bits. I wonder why it's not supported? It's not like the other brwsers aren't constantly updated. Opera 8.01 only just came out with more stuff. (something to do with still displaying SVG without namespaces for 8.01 if I remember right).
I still have some questions about those PUBLIC and SYSTEM identifiers though, still a bit shaky on 'em. I'll hop on over to the XML forum though and ask there.
Charles
06-19-2005, 04:47 PM
The other browsers are catching up. Why, a few versions ago Firefox couldn't handle entities at all. But you have to allow a certain lag time once browsers impliment something.