Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jul 2009
    Posts
    43
    Thanks
    13
    Thanked 0 Times in 0 Posts

    strtlower and ucfirst for Feed

    I'm pulling in some rss feeds with magpierss, but some are in all caps. How can I change it so that only the first letter is capitalized?

    PHP Code:
    <?php $rss2 fetch_rss('http://myfeedsite.com/feed');
    if (
    $rss2) {
     
     
    $items array_slice($rss2->items010);

     foreach (
    $items as $item )

    //My FIX WHICH ISN"T WORKING
     
    $item ucfirst(strtolower($item));

     {   echo 
    '<li><a href="'.$item['link'].'">'.$item['title'].'</a></li>';  }
    }else
    {
      echo 
    '<h2>Error:</h2><p>'.magpie_error().'</p>';
    }

    @
    ini_restore('error_reporting');
    ?>
    Last edited by GenVic; 09-15-2009 at 04:58 PM.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    $item is an array; you have to apply the functions to the elements inside the array, not the array itself.

  • #3
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,300
    Thanks
    4
    Thanked 203 Times in 200 Posts
    PHP Code:
    $item['title'] = ucfirst(strtolower($item['title'])); 
    Dave .... HostMonster for all of your hosting needs

  • Users who have thanked djm0219 for this post:

    GenVic (09-15-2009)

  • #4
    New Coder
    Join Date
    Jul 2009
    Posts
    43
    Thanks
    13
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by djm0219 View Post
    PHP Code:
    $item['title'] = ucfirst(strtolower($item['title'])); 

    Perfect. Thanks.


  •  

    Posting Permissions

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