+ Reply to Thread
Results 1 to 7 of 7

Thread: news section

  1. #1
    gsgrego is offline x10Hosting Member gsgrego is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    16

    news section

    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?

  2. #2
    Ainokea is offline x10 Sophmore Ainokea is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    127

    Re: news section

    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

  3. #3
    gsgrego is offline x10Hosting Member gsgrego is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    16

    Re: news section

    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.

  4. #4
    xPlozion's Avatar
    xPlozion is offline x10 Elder xPlozion is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    Delaware, USA
    Posts
    872

    Re: news section

    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 by xPlozion; 09-23-2008 at 09:41 PM.

  5. #5
    gsgrego is offline x10Hosting Member gsgrego is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    16

    Re: news section

    well i would rather use html as i know it lol.

  6. #6
    dickey's Avatar
    dickey is offline x10 Sophmore dickey is an unknown quantity at this point
    Join Date
    Sep 2008
    Location
    Singapore
    Posts
    128

    Re: news section

    PHP Code:
    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........

  7. #7
    scopey is offline x10Hosting Member scopey is an unknown quantity at this point
    Join Date
    May 2008
    Posts
    62

    Re: news section

    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
    - When in doubt, refer to the PHP manual.

+ Reply to Thread

Similar Threads

  1. PHP Media section
    By earnthenspend in forum Programming Help
    Replies: 5
    Last Post: 06-10-2008, 05:03 AM
  2. CuteNews News Installation
    By WoWChat in forum The Marketplace
    Replies: 0
    Last Post: 10-16-2007, 05:12 PM
  3. Hiring PHP Coder, and Template Designer($$)
    By Arucard98 in forum Scripts & 3rd Party Apps
    Replies: 2
    Last Post: 02-06-2006, 02:10 PM
  4. Fusion News error
    By kouhi in forum Free Hosting
    Replies: 5
    Last Post: 12-14-2005, 02:48 PM
  5. News Management
    By BigEmmaFanz in forum Scripts & 3rd Party Apps
    Replies: 15
    Last Post: 05-19-2005, 12:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers