Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2013
    Thanked 0 Times in 0 Posts

    Echo Portion of XML

    I'm guessing there is a better way to do this and would like some assistance, I am still fairly new to PHP.

    I've got an XML file that outputs:

    <title>Fleet Alignment</title>

    I would like to list the month and day that the post was created along with the title; ex: MM-DD "Title".

    I've got it working with this code: <?php echo substr($news->updated,6,4); ?> <a href="<?php echo $news->link['href'];?>"><?php echo $news->title. PHP_EOL .'<br><br></a>';

    Is substring the correct way to do this? Is there a better way?

    Thanks for any suggestions, the XML is coming from a simple machines forum installation.

  2. #2
    Master Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Behind the Wall
    Thanked 606 Times in 599 Posts
    Is there a better way?
    PHP: Date/Time - Manual
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts