Realmac Software

Welcome guest, please Login or Register

   

guidance on how to use the “Show recent posts”-snippet

Avatar
Rank
Rank
Rank
Rank
Rank
Rank

Total Posts: 784

Joined Nov 2005

PM

 

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 wink
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!

frieauff.com
Kommunikation gestalten

Avatar
Rank
Rank
Rank
Rank
Rank
Rank

Total Posts: 744

Joined Sep 2009

PM

 

Great post! Will try tomorrow, thanks!

If you can’t convince them, confuse them.

Indigo Webstudio
Just Host

Avatar
Rank
Rank
Rank
Rank
Rank
Rank

Total Posts: 804

Joined Sep 2005

PM

 
the real mf - 11 January 2010 06:50 PM

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.

It’s a setting in the simple pie script and it is exactly one hour (and it is a php cache thing).

the real mf - 11 January 2010 06:50 PM

... Oscar who deserves the credits for the tutorial.

Uh… ok… but it’s just my original instructions re-written with less detail wink Like Oscar said, he just followed the readme file step by step, which is what I’ve said to do all along smile

Anyhow, if this helps then that’s all I can ask for. Thanks to you and Oscar for taking the time. I’ve posted a link to this thread in the original blog post.

Adam Merrifield

seyDesign { themes-that: matter; }

Get seyDesign support or join our forum.

Follow us on Twitter and Facebook.

Avatar
Rank
Rank
Rank
Rank
Rank
Rank

Total Posts: 784

Joined Nov 2005

PM

 

Hey Adam,
sorry, I didn’t mean to neglect your work. All credits go to you, of course. Thanks for the snippet! It’s just that somehow Oscar’s explanations seemed to work better for me and since a few people posted problems getting it to work I thought it might be worth a try. Anyway, thanks again!

frieauff.com
Kommunikation gestalten

Rank

Total Posts: 2

Joined Jan 2010

PM

 

Great post! However, I’m having a problem getting it working.  I believe I followed your instructions but I only get the following displayed when viewing my website:

Recent posts

‘; echo ‘
‘; echo ‘’; echo $item->get_title() . ‘’; echo ‘
‘; echo ‘
’ . $item->get_date(‘j M Y’) . ‘
‘; echo ‘
‘; echo shortdesc($item->get_description(), 150); // Change 150 to the length of your choice echo ‘’; echo ‘Read more.’ . ‘’; echo ‘
‘; echo ‘
‘; } ?>

Thanks for your help!

Avatar
Rank
Rank
Rank
Rank
Rank
Rank

Total Posts: 784

Joined Nov 2005

PM

 

Didi you change the page extension from .html to .php (step )? Are you sure that your webspace contains PHP?

frieauff.com
Kommunikation gestalten

Rank

Total Posts: 2

Joined Jan 2010

PM

 

Hi Markus,
Thank for replying your help is greatly appreciated.  Yes, I changed the page to a php extension and my host is running php 5.  I just can’t figure it out!

Avatar
Rank
Rank
Rank
Rank
Rank
Rank

Total Posts: 784

Joined Nov 2005

PM

 

Hm…can you give a url to view a live site?

frieauff.com
Kommunikation gestalten

Avatar
Rank
Rank
Rank
Rank

Total Posts: 113

Joined Oct 2009

PM

 

Hi

I am trying to implement this method on a website I am developing, having recent items from my blog on my home page.  I have followed the instructions carefully, but am getting the following error message when I try to access the home page:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ‘)’ in /home/vsniozee/public_html/index.php on line 351

I have looked at line 351 in my index.php file and it reads as follows:

  $inputs = array(’–’, ‘—’, ‘’‘, ‘’‘, ‘“’, ‘“’, ‘…’, ‘[’, ‘]’);

I would be grateful if someone could help me get this set up right

thanks

Nick

Avatar
Rank
Rank
Rank
Rank
Rank
Rank

Total Posts: 784

Joined Nov 2005

PM

 

Can you post a URL?

frieauff.com
Kommunikation gestalten

Avatar
Rank
Rank
Rank
Rank

Total Posts: 113

Joined Oct 2009

PM

 

yes, its http://www.soterianetwork.org.uk/

the site is password protected at the moment as i am still working on it:

username:soteria
password:mosher123

Avatar
Rank
Rank
Rank
Rank
Rank
Rank

Total Posts: 784

Joined Nov 2005

PM

 

uhm, that doesn’t really help. It’s just the error that shows up. What’s the theme you’re using and where did you put the snippet?

frieauff.com
Kommunikation gestalten

Avatar
Rank
Rank
Rank
Rank

Total Posts: 113

Joined Oct 2009

PM

 
the real mf - 21 January 2010 01:45 PM

uhm, that doesn’t really help. It’s just the error that shows up. What’s the theme you’re using and where did you put the snippet?

theme is Silk.  I put the snippet in an html block on a blocks page

Avatar
Rank
Rank
Rank
Rank
Rank
Rank

Total Posts: 784

Joined Nov 2005

PM

 

Ok, that’s it. The code doesn’t work on Block pages. Try a different page type and it should work.

frieauff.com
Kommunikation gestalten

Avatar
Rank
Rank
Rank
Rank

Total Posts: 113

Joined Oct 2009

PM

 

ok. thanks, looks like I’ll have to consider using a different type of page for my home page

Avatar
Rank
Rank
Rank
Rank
Rank
Rank

Total Posts: 804

Joined Sep 2005

PM

 
the real mf - 21 January 2010 02:08 PM

Ok, that’s it. The code doesn’t work on Block pages. Try a different page type and it should work.

Why doesn’t it work on Blocks pages?

Adam Merrifield

seyDesign { themes-that: matter; }

Get seyDesign support or join our forum.

Follow us on Twitter and Facebook.