Login   Register  
PHP Classes
elePHPant
Icontem

Universal Feed Generator

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      Universal Feed Generator  >  All threads  >  Universal Feed Generator  >  (Un) Subscribe thread alerts  
Subject:Universal Feed Generator
Summary:Can I generate xml file output using the class?
Messages:5
Author:Anu
Date:2012-09-28 16:42:11
Update:2014-03-26 23:26:17
 

  1. Universal Feed Generator   Reply   Report abuse  
Picture of Anu
Anu
2012-09-28 16:42:11
I am using your Universal Feed Generator to generate RSS feeds on our site, and that works well. However for some other project I need to generate an xml output file with my feeds. I know with you class the feed is generated as part of the current feed output. Is there any way, I can modify the class to split out an xml file with the feed?

  2. Re: Universal Feed Generator   Reply   Report abuse  
Picture of Anis uddin ahmad
Anis uddin ahmad
2012-09-29 17:42:39 - In reply to message 1 from Anu
Yes you can do it with some simple change in code. But, if you want it without changing in current class, you can do it by controlling output buffer. Just like:

<?php

// Build your rss feeds first, but don't output it

// Start output buffer
ob_start();

$yourFeedWriterObject->genarateFeed();

// Get the output in a variable
$outout = ob_get_contents();

//Write it to a file
file_put_contents($filePath, $output);
?>

Thanks a lot for asking.
Have fun :)
---

Anis

  3. Re: Universal Feed Generator   Reply   Report abuse  
Picture of Anu
Anu
2012-10-01 18:37:27 - In reply to message 2 from Anis uddin ahmad
That worked. Thanks for your reply.

  4. Re: Universal Feed Generator   Reply   Report abuse  
Picture of Anu
Anu
2012-10-02 18:06:27 - In reply to message 3 from Anu
Hi Anis,

Though the solution you suggested let me create xml file for my feed and save it on my server, I am unable to get a handle on the file to transfer to S3.
So, I am using the following code to save my rss feed to a file
-----------------------------------------------
file_put_contents($fileName, $this->output);
-----------------------------------------------
But when I try to see if the file exists, with the following code I do not ends up in "no file found"

-----------------------------------------
if (file_exists($fileName) )
echo "found file";
else
echo "no file found";

------------------------------------------

$fileName here is complete file path. Am I doing something wrong?

Thanks

  5. Re: Universal Feed Generator   Reply   Report abuse  
Picture of Michael Pawlowsky
Michael Pawlowsky
2014-03-26 23:26:17 - In reply to message 2 from Anis uddin ahmad
First thanks for putting this out there.

I realize you can capture the output in ob, but it would be more flexible if it was an option to output right away or save to var.

Kind of like print_r.


Thanks,
Mike