news section

gsgrego

New Member
Messages
16
Reaction score
0
Points
0
ok i would like to something that seems simple... i would like to create a news section BUT heres the catch i want the text and whatnot to come from a external file, problem is i would like to do this in html not ??ml or ??html or java as a last resort.

if you understand me got any ideas?
 

Ainokea

New Member
Messages
127
Reaction score
0
Points
0
you could use php to read from an external file or mysql

theirs tons of tutorials on php news systems... or just download cutenews its free and you dont need to do any work
 

gsgrego

New Member
Messages
16
Reaction score
0
Points
0
meh ive just finished figuring out how a news system on another site works..... i hate html...anyway it doesnt draw from a external file but meh easiers then what i had before.
 

xPlozion

New Member
Messages
868
Reaction score
1
Points
0
well, if you do decide that you want to load it from an external file, you can use an xml file and use xml_simple_load_file() or any other file and fopen('file.txt','r'). you can also use file_get_contents('file.txt)... the list goes on and on... it's how you want to take advantage of it...
 
Last edited:

dickey

New Member
Messages
128
Reaction score
0
Points
0
PHP:
index.php
<html>
<head>

</head>

<body>
<p> what if I don't want this to be changed???</p>
<div>
  <span onclick='dyna("template.html")'>click me</span>
</div>
</body>
</html>

<?php
  function dyna($f) {
   $template=implode("",file($f));
   $template=str_replace("{title}","Manipulated",$template); //changes the string '{title}' in template.html to the string 'Manipulated'
   $template=str_replace("{contents}",implode("",file("content.txt")),$template);//changes the string '{contents}' to whatever is inside content.txt

   echo $template;
  }

?>
Code:
//Template.html

<html>
<head>
  <title>{title}</title>
</head>
<body>
  {contents}
</body>
</html>
Code:
content.txt

ipsum........
 

scopey

New Member
Messages
62
Reaction score
0
Points
0
If you want to have news on your website that isn't your own, like from a local news site, then you have to delve into the world of XML. Otherwise, PHP is the way to go.

Great place to start:
www.w3schools.com
 
Top