SimplePie 1.5 is now available!

SimplePie Documentation.  Learn how to use this thing.  It's way better than going to school.

You are here: Documentation » SimplePie Plugins and Integration » Textpattern » SimplePie Plugin for Textpattern

SimplePie Plugin for Textpattern

The Basics

Main page SimplePie Plugin for Textpattern
Author Mike Small (formerly Ryan Parman)
Plugin Version 1.2.2
Compatible Textpattern version 4.x
Download Download
Required SimplePie version 1.x
Optional Helpers None
Plugin Support None

About the Plugin

This plugin adds a <txp:feed> tag to Textpattern that allows you to display feeds in your wiki.

Installation

Upgrading from an older version?

Replace the old simplepie.inc with the latest one downloaded from http://simplepie.org/downloads/downloads. Uninstall the old plugin and reinstall the latest version via the link above.

Fresh Installation

For the purposes of these instructions, we're going to make a few assumptions. We're going to assume that you have installed Textpattern to http://blog.example.com, which would mean that the Textpattern administration folder lives at http://blog.example.com/textpattern/, and that your Textpattern lib folder lives at http://blog.example.com/textpattern/lib/.

Step 1: Download the latest simplepie.inc and the plugin file

  1. simplepie.inc is the main directory of the SimplePie package available here: http://simplepie.org/downloads/.
  2. The Textpattern plugin simplepie_textpattern_1.2.2.zip

When you download them, make sure you know where you've downloaded them to. Once you've done that, unzip them. The full SimplePie library is what powers everything, and the Textpattern plugin simply makes it available to your blog pages.

Step 2: Upload simplepie.inc to your Textpattern 'lib' folder

This means that this file will be uploaded to http://blog.example.com/textpattern/lib/.

Step 3: Create a simplepie_cache folder inside your Textpattern 'lib' folder

This means that after you create the simplepie_cache folder, it will live at http://blog.example.com/textpattern/lib/simplepie_cache/.

Step 4: Change the file permissions for the cache directory to be server-writable

This setting varies from webhost to webhost. In the past, I've used iPowerWeb, and they required file permissions of 777 in order to be server-writable. Currently, I use Dreamhost, and they need permissions to be set to 755 to be server-writable. Again, if you're not sure, either go ask your host or you can try various settings yourself. The three to try are 755, 775, or 777.

The specific process of how you change your file permissions differs from FTP application to FTP application. On Windows I use FlashFXP, where you find the remote file or folder that you want to change the permissions of, you right-click on it, and choose Attributes (CHMOD). On Mac OS X I use Transmit, where you find the remote file or folder that you want to change the permissions of, you right-click (or ctrl-click for you one-button-mousers) on it, and choose Get Info. Your specific FTP application will most likely be something similar.

Step 5: Enable the plugin in your Textpattern control panel

  1. Log into your Textpattern control panel, click on the “admin” tab, then the “plugins” tab.
  2. Copy-paste the contents of simplepie_textpattern.txt into the form and click “upload”.
  3. You should see some colorized PHP code. Scroll to the bottom of the page, and click “install”.
  4. You should see the SimplePie Plugin for Textpattern listed in your plugins list. On the right-hand side of the row, you'll see the word “no” under the “Active” column. Click “no” to change it to “yes”, meaning that the plugin is now enabled.

If you need more help installing Textpattern plugins, check out the Textpattern plugin installation instructions.

SimplePie and the SimplePie Plugin for Textpattern are now installed.

Usage

How to use it

SimplePie Plugin for Textpattern adds one tag to your Textpattern installation: the <txp:feed> tag. Here's how you use it:
Changes from version 1.2.1 to 1.2.2 highlighted in bold.

  1. <txp:feed>http://example.com/feed.xml</txp:feed>
    To load a feed on your Textpattern pages, simply wrap the feed URL with <txp:feed> tags. Doing this with no attributes will display the default way:
    • An <h3> containing the feed's title, linked back to the originating site.
    • An ordered list, containing all of the news items in the feed.
    • The news item's title, linked back to the originating post.
    • The full HTML description for each news item.
  2. items attribute
    Limits the number of items returned. If you set this value to 5, then you'll get back the 5 most recent posts. If there's a feed with fewer than 5 posts, SimplePie will return all of them. Defaults to all.
  3. showdesc attribute
    Determines whether the description should be shown or not. If set to false, descriptions are omitted, and the ordered list will display only the linked item titles with no special formatting. Defaults to true.
  4. showdate attribute
    Displays the date of the news item. Accepts anything that's allowed in PHP's date() function. Defaults to blank.
  5. shortdesc attribute
    Strips all tags from the item's description and limits the number of characters that are displayed. Accepts any numeric value. If more characters are allowed than are in the description, the entire description will be displayed. If the text wasn't cut at the end of a sentence (ending with a period, exclamation point, or question mark), an ellipsis will be added to the end of the text. Defaults to all characters.
  6. showtitle attribute
    Determines whether the built-in feed title is displayed or not. Defaults to true.
  7. alttitle attribute
    Displays a custom title in place of the feed's built-in title. If ”-1” is entered no title is displayed (removes the built-in title too). Defaults to blank.
  8. h attribute
    Define the html header used for the title (eg h4) defaults to h3.
  9. listtype attribute
    Defines the list type. Eg listtype=“ol” will give an ordered list. Defaults to “ul”.
  10. error attribute
    Displays a custom error message for when there is a problem retrieving the feed. Defaults to the standard error messages.

If you want to apply special CSS styles to the feed display, here's some basic markup that represents what is generated.

<div class="simplepie">
	<h3><a href="http://example.com">Example Site</a></h3>
	<ol>
		<li><strong><a href="...">Item Title 1</a> <span class="date">29 May 2006</span></strong><br />
		The description for the item.</li>
 
		<li><strong><a href="...">Item Title 2</a> <span class="date">28 May 2006</span></strong><br />
		The description for the item.</li>
 
		<li><strong><a href="...">Item Title 3</a> <span class="date">27 May 2006</span></strong><br />
		The description for the item.</li>
	</ol>
</div>

plugins/textpattern/simplepie_plugin_for_textpattern.txt · Last modified: 2011/03/06 03:56 (external edit)