View Single Post
Old 10-18-2012, 04:26 AM  
just a punk
So fuckin' bored
 
just a punk's Avatar
 
Industry Role:
Join Date: Jun 2003
Posts: 32,381
Parsing LiveJasmin XML feeds

My customers ask if it's possible use non-RSS feeds like LiveJasmin XML feed as content sources for WP blogs.

Here is the instruction on how to do that with CyberSEO.

1) Click the "Alter default settings" button.

2) Find the "XML section tag names (separate with commas)" field and add the "PERFORMERINFO" word there. The whole field may look like this: "ITEM,VIDEO,MOVIE,GALLERY,ENTRY,PERFORMERINFO" ).

3) Save the default settings and import your feed.

4) On the feed settings page assign some name to your feed ("Feed title:" box).

5) Now you have to decide which exactly XML sections you want to import into your posts. Let's assume you want to parse the following ones: <performerid>, <bio>, <picture> and <link>.

6) Find the "Custom fields" box and put the following lines there:

performerid->performerid
bio->bio
picture->picture
link->link


7) Now copy this code into the "PHP code <?php .. ?>" box:
PHP Code:
$post['guid'] = 'http://' $post['custom_fields']['performerid'];
$post['post_title'] = $post['custom_fields']['performerid'];
if (
is_array($post['custom_fields']['picture'])) {
    
$img $post['custom_fields']['picture'][rand(0count($post['custom_fields']['picture']) - 1)];
} else {
    
$img $post['custom_fields']['picture'];
}
$post['post_content'] = '<p><a href="' $post['custom_fields']['link'] . '"><img src="' $img '" /></a></p><p>' $post['custom_fields']['bio'] . '</p>'
8) Save settings and pull the feed.

Instruction example above just a basic example on how your non-standard feed can be parsed. There are many other sections that you may want to use as well (e.g. <turnon>, <turnoff>, <age> etc). To do so, you have to make the necessary changes in (6) and (7). Please find the additional info in the "XML section tag names (separate with commas)" part here: http://www.cyberseo.net/xml-syndicator/
__________________
Obey the Cowgod
just a punk is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote