I'm having a play with xml and considering using it as a way to allow updates to a news page without having to edit the html file itself.
So I searched this site and found enough info to get the xml to display in a textarea. It could be that I'm going about this all wrong but I can't work out how to get a text area to display multiple datafields from an xml file.
This is solely so I can make the titles display in bold and the content normal. If any one has any better suggestions for doing this, then I'm all ears.
HTML code:
XML code:PHP Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Text Area with content from external file</title>
<xml id="Txt" src="news.xml"></xml>
<style type="text/css">
<!--
.unnamed1 {
height: 10em;
width: 20em;
}
-->
</style>
</head>
<body>
<textarea class="unnamed1" datasrc="#Txt" datafld="Title"></textarea>
</body>
</html>
ta,PHP Code:<?xml version="1.0" encoding="UTF-8"?>
<TextOnly>
<Title>This is my title</Title>
<Content>This xml file will display the latest news.</Content>
</TextOnly>
jbw


Reply With Quote

Bookmarks