Presenting the recent posts from a blog on another page of a website seems to be a continuous wish from many. Now that the RSS stack (first developed by Elixir, then handed over to Gary from RWT) has been withdrawn due to technical problems one of the few remaining solutions is the snippet “show recent posts”, created by seyDesign.
However, quite a few people have had difficulties implementing it. That includes me
Just a few days ago, Oscar from the german-speaking part of the forum posted how he managed to implement it. And although he says he basically did nothing but follow the included read-me, this time I got it. Since I found his explanation helpful and easy to understand, I promised to translate it into english.
The snippet will allow you to integrate this nice effect into almost all page types: styled text, html, other page types that include a styled text field (like the contact form, if you want), stacks pages (both text stacks as well as html stacks do work), you name it…
Assuming you have a blog page and want to display the recent posts on the homepage as well, then…
1. download and unzip the snippet (see link above)
2. download the required “simplepie.inc” from http://simplepie.org/downloads
3. put the file simplepie.inc into the assets of the home page
4. change the extension of the page to .php in the page inspector
5. create a new page underneath the home page, preferably an html page-type, and name it “cache” in the page title field, the browser title field, the folder field and the file name field (important: all four!)
6. drag and drop the snippet to where you want the recent posts to show up (can be in the sidebar, in the content area, in a text stack or in any styled text area)
7. select the snippet code and chose “ignore formatting” from the format menu
8. look for the url in the snippet code (by default it’s the Seydoggy blog). I’m talking about this line of code:
$feed = new SimplePie('http://www.seydesign.com/news/files/blogRSS.php');
replace the default url by your blog’s RSS feed or by the absolute path to your blog page. If you’re using the feed, change the “feed://www.yourdomain.com/blabla...” into “http://www.yourdomain.com/blablabla...”
9. Make sure the path that points to the simplepie.inc in the asset is correct. By default it is
require_once('assets/simplepie.inc');]
which is correct for an index page. But since RW puts newly added pages into their own folders this path would have to be different if the snippet is used on a page residing in its own folder. I prefer to organize my sites so that all pages that are of equal menu rank are sitting in the root level, so it doesn’t matter. But if you use the snippet in a page that has its own folder, change the path to
require_once('../assets/simplepie.inc');]
This tells the browser to go UP one level and look there.
10. Adjust the settings in the snippet to your liking. You can change the number of posts to be displayed (a setting of 0,7 means 7 posts - don’t ask me about the strange spelling with a zero and a comma...), the number of days that the snippet looks back to pull posts into the home page (default is 168 hours which equals 7 days) and the length of the posts (default is 150 letters). All these settings are commented in the snippet code, so you should easily find them.
11. Publish the project
12. Go to the webspace with an FTP application and change the permissions of both the newly created cache folder and the cache.html file to 777 (yes, the cache folder from step 5). Unfortunately this cannot be done within RW, it has to happen after upload. But RW will not modify these settings anymore even if you re-publish the project, so you’ll only have to do it once.
13. Make a few posts in your blog and publish them (well, maybe you have already...that’s allright)
14. done!
The only mystery we haven’t (yet) uncovered) is why it takes a little while until the snippet updates. Oscar believes it’s exactly one hour. I have just made a test post to see if that’s true. No, it’s not a cache issue.
Ok, I hope this explanation is helpful to some. Here’s the original post made by Oscar who deserves the credits for the tutorial. It also contains screenshots for further explanation.
Let me know if it works for you!