Thread Starter
lifted
(@lifted)
to make it clearer to everyone I have pasted some urls for you all to take a look at. the first is the custom piece of php I wrote to create this custom feed.
quotes.php
this next link is to a wordpress rss feed file which I have customized to output the same data structure as the quotes.php file.
feed=rss
both of these documents have content type text/html and both appear to be pretty much the same when viewed in the browser or when viewing the page source. Yet strangely enough the Flash is unable to read the data produced by the quotes.php file and it CAN read the data produced by the feed-rss file??
Can anyone help!?
Thread Starter
lifted
(@lifted)
To make things as simple as possible for you all I have pasted in the code for the files associated with this issue.
QUOTES.PHP
<?php require('wp-blog-header.php'); ?>
<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
<xml>
<quotes>
<?php
$args = array(
'numberposts' => 5,
'post_status' => null,
'post_parent' => null, // any parent
);
$posts = get_posts($args);
?>
<?php if( $posts ) : ?>
<?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
<?php
$author = get_post_meta($post->ID, 'postAuthor', true);
?>
<quote>
<Id><?php the_ID(); ?></Id>
<Author><?php if($author == "" || $author == null){ the_author(); }else{ echo $author; } ?></Author>
<Text><?php the_excerpt(); ?></Text>
<Link><?php the_permalink(); ?></Link>
</quote>
<?php endforeach; ?>
<?php endif; ?>
</quotes>
</xml>
Thread Starter
lifted
(@lifted)
And this is the feed-rss file I have hi-jacked:
<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
<xml>
<quotes>
<?php while (have_posts()) : the_post(); ?>
<?php
$author = get_post_meta($post->ID, 'postAuthor', true);
?>
<quote>
<Id><?php the_ID(); ?></Id>
<Author><?php if($author == "" || $author == null){ the_author(); }else{ echo $author; } ?></Author>
<Text><?php the_excerpt(); ?></Text>
<Link><?php the_permalink(); ?></Link>
</quote>
<?php endwhile; ?>
</quotes>
</xml>
@lifted,
Did you ever find a solution to this? I’m considering doing something similar, and looking for advice.
Thanks,
jason
Have you tried setting the content type in the page header?
header('Content-Type: text/xml');
Hi folks,
i think it would be nicer if you write the xml output to a file.
Define an action: http://codex.wordpress.org/Plugin_API/Action_Reference
And write it to a file…
regards Volkan
Add this to your .htaccess file in your http://dev.liftdigital.ca/lift/ directory
RewriteEngine on
RewriteRule ^quotes.xml$ quotes.php
this changes your filename and you can access it by flash
please let me know how you go
simon
By the way,
i am trying to setup flash using wordpress as a cms! how did you go….? i will probably use the RSS feeds option instead of custom php script because i dont know php that well..
What has been your experience in this area?
cheers
Simon
@ simophat – slightly off topic but I have developed an open source AS3 library that you can use if you want to use wordpress as a CMS for a flash (using the WordPress XML-RPC interface)
http://blog.absentdesign.com/as3-library-for-the-wordpress-api/
Hi. I created a couple of custom theme templates to make this happen. Works fine for me and allows you to upload images via wordpress’ native media upload features…no need for plugins etc. I hope someone can find a use for this so have put up some notes here. The example is for xml creation with the free autoviewer flash gallery, but would allow for tweaking to suit your xml needs.
Leave a comment if it doesn’t make sense and I’ll adjust accordingly!
http://www.genki.co.nz/cramp/?p=7
Cheers