|
|
| |
1. Universal Feed Generator |
|
Reply |
|
|
 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 |
|
|
 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 |
|
|
 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 |
|
|
 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
|
|