I made this website that uses XML file to store news entries. So basically a person will "submit" his name, date and content to the file and then I use DOM and for loop to print out the entries in homepage.
Anyway I'm planning to add WYSIWYG editor for the posting part but for now they're forced to use 'a' tags to make the links clickable. The problem is I noticed links that start with http:// works but links that start with www. doesn't. Is there a way to make both work using 'a' tags?
I'm still new to web development so I'm wondering if someone can help me.
$doc->load('entries.xml');
$newsArray = $doc->getElementsByTagName ('entry');
for($i = $newsArray->length; $i > 0; $i--)
{
$ent = $newsArray->item ($i-1);
$title = $ent->childNodes->item (1)->nodeValue;
$message = $ent->childNodes->item (2)->nodeValue;
$name = $ent->childNodes->item (3)->nodeValue;
$date = $ent->childNodes->item (4)->nodeValue;
if (get_magic_quotes_gpc()) {
$message1 = stripslashes($message);
}
else {
$message1 = $message;
}
echo "<div id='newsSec'>";
echo "<p></p>";
echo "<div class='newsTitle'> <b> $title </b> </div>";
echo "<div class='newsMessage'> " .nl2br($message1) ."</div>";
echo "<div class='newsName'> <b>Posted by:</b> $name <b>$date</b> </div>";
echo "</div>";