Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8322579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:26:14+00:00 2026-06-08T23:26:14+00:00

I have a small issue which I’m hoping someone can help me resolve. Copied

  • 0

I have a small issue which I’m hoping someone can help me resolve.

Copied below is a piece of code which goes away to my database model and returns an array with a URL and a feed type. The user enters whether they have used a twitter name, blogger site etc.

However, to parse this data with simplepie I need to pass an array of URL’s… and I lose my “type” option. Is there anyway I could add this back to the simplepie item so that I can display a specific icon if the user has selected a specific type of feed.

$feed = $this->profile_model->get_module_feed();

    $feedarr = array();
    foreach($feed['data'] as $feeds) {
        if ($feeds['type'] == 1 ) {
            $i = "http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=" . $feeds['rss'];
        }
        if ($feeds['type'] == 2 ) {
            $i = "http://search.twitter.com/search.atom?q=" . $feeds['rss'];
        }
        if ($feeds['type'] >= 3 ) {
            $i = $feeds['rss'];
        }

        $d = $feeds['type'];

        //else $i = $feeds['rss'];

        echo $i . " " . $d . "<br />";

        array_push($feedarr, $i);
    }

    $this->simplepie->set_feed_url($feedarr);
    $this->simplepie->enable_cache(false);
    $this->simplepie->init();
    $this->simplepie->handle_content_type();


    $data = $this->simplepie;

    foreach($data->get_items() as $item) { ?>
        <h2><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></h2>
        <p><?php echo $item->get_description(); ?></p>
        <p><small>Posted on <?php echo $item->get_date('j F Y | g:i a'); ?></small></p>
    <?php


    }


    }
}


?>

Eg, if the $feed[‘type’] is 1 I would like to display the image associated with 1

hoping someone can help as I’m a wee bit stumped!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T23:26:15+00:00Added an answer on June 8, 2026 at 11:26 pm

    You can use the individual feed item’s feed property to get it’s subscribe url and try to match it with the feed urls you used for the fetching. Here’s a simplified example:

    // array with unique feed url => feed type (icon)
    $feed_types = array(
        'http://feed.one.com/' => 'type1',
        'http://feed.two.com/' => 'type2',
    );
    
    $pie = new SimplePie;
    $pie->set_feed_url(array_keys($feed_types));
    $pie->enable_cache(false);
    $pie->init();
    $pie->handle_content_type();
    
    foreach ($pie->get_items() as $item) {
        $feed_url = $item->feed->subscribe_url();
        $type = isset($feed_types[$feed_url]) ? $feed_types[$feed_url] : 'unknown type';
        print $type;
    }
    

    As long as you use the same url’s for fetching that embedded into the feed results the subscribe_ul() method’s result should align up with the urls used in set_feed_url().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can anyone help, i have a small issue, i have an interface and also
Here's hoping someone can give me a hand will a small JavaScript issue I'm
i have a small issue which my text field insist to inhert the CSS
I have a small issue with iAP. I have the code working for the
Hi guys! Hope somebody could help me to solve one small issue. I have
I have a small issue with a CA2000 warning. In my project which is
I have a routing issue which I can't seem to get my head around.
We're having a small issue and could use some help - we have the
I have a small app which references the Microsoft.SqlServer.Smo assembly (so I can display
In my Java application I have found a small performance issue, which is caused

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.