0

I have an xml feed and i want to display it with a view. I have created a content type with the fields that are in the feed but how can i tell the view to get the data from this feed. I don't want to insert my feed data into the database. How can this be done programmatically? Maybe from the theme section in views? Maybe with some hooks like hook_views_data_alter? Any help would be much appreciated.

Thanks

  • are you sing drupal 6 or 7 ? and also can you tell me for what purpose you are going to use this feed, for eg property feed – Bala Sep 7 '13 at 11:18
  • I'm using drupal 7. And yes, it's a property feed. – adevms Sep 12 '13 at 6:58
  • Can you post it as answer with steps, so that it will help the future visitors. – Bala Sep 18 '13 at 6:54
2

So i solved it. In hook_views_pre_render i added something like:

if($view->name=='property_list'){ 
// ..got the xml , processed it
// and in the folowing array I added; of course field_address is an item in a content type
$view->result[$i]->field_field_address[0]['rendered']['#markup'] = $child->address;
// if i wanted the field to be a link, then altered this array item 
$view->result[$i]->field_field_address[0]['rendered']['#path']['path'] = 'property-detail?id='.$child->ID;  
}

The link pointed to another view where the detailed property was shown;

| improve this answer | |
  • I did have a test content for this content type and replaced it in the view generation. – adevms Sep 18 '13 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.