Learn how to create links on your ECEn XML web pages.
A link looks and behaves differently than most of the
text on the web page, so we might say that a link is special text. In the ECEn XML templates, we use the <special-text> tag for links and other kinds of special text on web pages.
These instructions assume that you already have an ECEn XML web page
to edit and know at least a bit about XML. Most content, such as text, links, lists, pictures etc., belongs in the <content> portion of your page; check the instructions below to see if you need to make sure that you
have a page with a <content> portion. If you need a quick tutorial or
just a simple starter web page download, check out the 'Howdy, World' Tutorial where you can get a brief overview of what files you need to set up a basic
ECEn XML web page.
If you need an example, have a look at the Links Example page. You can view the XML source in your by clicking the 'this XML' at the bottom of the page.
Or, you can download the XML source located in the Common Tasks Downloads to the right. (Right click, Save Link Target As...)
Basic Links
Here is some "code" for a basic link, ECEn XML templates style:
Place a <text> tag between the <special-text> tags. Inside the <text> specify the link text you want to appear on you web page.
3
Place a <related-page> tag after the <text> tags. Inside the <related-page> tag specify the address (URL) of the page the link points to, in other words, its related page.
Just as every other web page, links on ECEn XML web pages can be relative or absolute.
Links to a particular place on a page
Sometimes, especially when a particular web page is long, we'd like a link
to point to a particular place on the page (rather than just the top). In the ECEn XML, you can do this with the <special-text> tag, a <related-page> and a <related-section> tag.
To create a link to a particular place on a page:
1
In the XML file you'd like to link to, or your related page, create a named section. You can do this by placing a <name> tag containing a short name you've chosen for that section within the section. If you know HTML, you can use the <related-section>
tag to point to an anchor in an HTML file. Simply specify
the name of the anchor within the <related-section>
tags.
2
Back in the XML page where you'd like the link to appear, create <special-text>
, <related-page>
and <text>
tags, just as with a basic link. If the section you're linking to is on the
same page, you can omit the 'related-page' tag.
3
After the <related-page>
tags, add a <related-section>
tag, and within it specify the name of the
section on the related page you wish you link to. Tip: Don't have your related-page point to a directory, specify the file within it. For example, don't use
'http://www.ee.byu.edu/foo' (where 'foo' is the name of a directory), rather
specify 'http://www.ee.byu.edu/foo/index.phtml'.
Links to an email address
Creating a link to send somebody email is a lot like creating a basic link. You still need
the <special-text>
and <text>
tags. However, instead of the <related-page>
tag, you'll use the <related-email-address>
tag.
To create a link to an email address:
1
Just as with a basic link, create <special-text>
and <text> tags.
2
Create <related-email-address>
tags within the 'special-text' tags. Specify the email address within them.
Turning pictures into links
Just as special text can have a related-page, so can pictures. Here's some XML to make a picture also be a link: