This page and the OPML Renderer are deprecated. In a few seconds, you will be automatically redirected to the page for Optimal, which now can be installed as a WordPress plugin.
OPML Renderer renders valid OPML from any source as an expandable/collapsible list.
XSL stylesheets are used to transform the OPML from XML to HTML. Two XSL stylesheets are included: one for use in pages or posts and one for use as a sidebar item .
OPML Renderer is invoked through either a new content filter or a new template function.
To access the content filter, use the following in a page or post (without spaces):
!OPMLRender : url,updatetime,page|sidebar
To access the template function, use the following:
<? OPMLRender('url','updatetime','page|sidebar'); ?>
- 'updatetime' is the number of seconds to cache a file before requesting an update
- 'page' or 'sidebar' indicates which XSL transform to use
Click here to download the latest version.
This is beta software, so please use with caution and report any problems.
Images are included as of version 0.5.
Thanks to iconophobia and the inlineRSS plugin for some code and ideas.
And great thanks to Dave Winer for his work on OPML.
Installation
- Unzip opmlRenderer.zip into your plugins directory. It should automatically create a new subdirectory.
- Activate the plugin.
That's about it!
You may want to edit the XSL stylesheets to use your own icons or change the appearance of the rendered HTML. Links to do so are provided in the plugin's description on the Plugin pane of the Admin panel.
Errata and Gotchas
I'm very sorry. At least I didn't destroy your data, right?
- Version 0.6
- opmlRenderer.php - Bug in OPMLContent function prevents usage of content filter with remote URLs that have a query string. (fixed in development version)
- Version 0.5
- opmlRenderer.php - Error in error message handling. (fixed in development version)
- Should probably find a way to indicate that remote OPML is being fetched. (done in development version)
- Need to rework the XSL stylesheets' determination as to whether or not to use bulleted lists or bullet certain list items. (done in development version)
- Need to see if plugin works as expected with WordPress 2.0 (done in development version) and PHP 5+ (OPEN)
- Need to turn off caching of local files. (done in development version)
- Need to fix XPath expressions, e.g., from @htmlUrl to @htmlUrl!="". (done in development version)
- Long-term goals:
- Version 0.4
- Currently generating valid XHTML 1.0 Transitional. If you're using a different version, your pages probably won't validate unless you tweak the XSL stylesheets.
- Version 0.3
- Not generating valid XHTML. My mistake! I'm fixing this for the next release.
- Using a variable with the same name as a parameter. Will fix.
- Version 0.2
- If you're using the :before CSS selector to generate "fancy" bullets on list items, you probably will still want to edit your CSS to eliminate those fancy bullets.
For example, here's my stylesheet.
- If you're using the :before CSS selector to generate "fancy" bullets on list items, you probably will still want to edit your CSS to eliminate those fancy bullets.
- Version 0.1
- Dies on any failure to grab your OPML file. I will change this behavior so that instead it loads the cache file, if available, and if no cache file is available, it will die more gracefully.
- Uses CSS classes in the XSL stylesheets, which you probably have not defined. I will change them to use explicit CSS styles.
Changes
- Verions 0.6
- (There should be stuff here, but I seem to have over written this file with an older version. Basically, I fixed all the errata in version 0.5.)
- Version 0.5
- New feature - OPML inclusion.
- All files - Having learned more about creating WP plugins, the javascript was moved to the document head.
- Images are now included.
- Version 0.4
- opmlRenderer.php - Deletes cache file upon XSLT processing error, because this error is usually caused by a corrupt cache file (usually, an error page cached when trying and failing to grab a remote OPML file).
- opmlRenderer.php - Changed the regex to capture and discard paragraph elements that get added by the wpautop filter. Necessary to enable the page to validate.
- opmlRenderer-page.xsl, opmlRenderer-sidebar.xsl - Corrected some invalid XHTML.
- opmlRenderer-page.xsl, opmlRenderer-sidebar.xsl - Renamed a variable that had the same name as a parameter.
- opmlRenderer-page.xsl, opmlRenderer-sidebar.xsl - Added a div wrapper to rendered text to give user more flexability to change the presentation.
- Version 0.3
- opmlRenderer.php - Added a check to ensure that allow_url_fopen is enabled if a remote OPML file is requested. Will emit an error message upon failure without dying.
- opmlRenderer-page.xsl, opmlRenderer-sidebar.xsl - Cleanup and more CSS class sanitizing. No classes are used. Lists should render better on Internet Explorer.
- opmlRenderer-page.xsl, opmlRenderer-sidebar.xsl - Changed the rendering of reading lists. The title always links to the home page (if available), and the feed may be viewed by clicking the XML icon.
- Version 0.2
- opmlRenderer.php - Changed behavior upon failure to grab the specified OPML file or XSL stylesheet. Now, instead of dying upon failure to grab the OPML file, the cache file is displayed, and if there is no cache file, an error message is displayed and script execution continues. If the XSL stylesheet cannot be read, an error message is displayed and script execution continues.
- opmlRenderer.php - Added a comment to the end of the rendered HTML if the cache file was used.
- opmlRenderer-page.xsl, opmlRenderer-sidebar.xsl - Changed to use CSS styles instead of CSS classes, since users (other than the author) would not likely have those CSS classes (nobullet, blogrollbutton, opmlFolder) defined. N.B. - continues to use "nobullet", but only certain users should be affected (see errata).
- Version 0.1
- Created
My Bloglines feeds won’t validate anymore for some reason (it says “outline” in front of each feed now) but hopefully I can use this down the line if I ever find out how to export my feeds successfully, thx.
I’m trying to use this[4] from plain PHP, at least for now, but even though after a bunch of fixes my file validates[1] the renderer says it’s invalid[2]. I also installed as a plugin in WP and created a page template[3] but that didn’t work either. Can you see what the problem is?
Thanks!
[1] http://www.kbcafe.com/rss/rsv.aspx?xml=http%3A%2F%2Fwww.billsaysthis.com%2Fcontent%2Fmisc%2Fbillsaysthissubs_122405.opml
[2] http://www.billsaysthis.com/content/misc/viewOPML.php
[3] http://www.billsaysthis.com/wp/?page_id=98
[4] http://www.billsaysthis.com/content/misc/billsaysthissubs_122405.opml
Billy: Depending on just how invalid the OPML is, it may render anyway. Did you give it a shot?
BillSaysthis: I notice that you’re using WordPress 2.0 — that could be the problem. I haven’t loaded WP2.0 yet, so I can’t test it. The OPML, though invalid, does render with my OPML Browser, which uses the same engine as this plugin.
Actually, the browser is more what I want to use so that should solve the problem. Thanks for posting this code!
I loaded the plugin right away. I see it says: OPMLRender(‘url’,’updatetime’,’page|sidebar’)
so if I want it in the sidebar, I would enter: OPMLRender(‘my opml URL [from opml manager]’,’1 min’,’sidebar’) in my opmlRenderer-sidebar.xsl file, is that right? if so, where do I enter it at in the file? TIA
Billy: You don’t need to edit opmlRenderer-sidebar.xsl. In your
sidebar.php
file, put something like what I’ve got:<li><h2>Reading Lists</h2> <?php OPMLRender('{YOUR_URL}', '60', 'sidebar'); ?> </li>
Note that the update time must be in seconds. Also, reading a remote url every minute could be considered abusive — consider bumping that up to 1 hour, or 3600 seconds.
I thought that was just retrieving my OPML file one time, I didn’t realize it was going out to it during those timeperiods, THX. Also, I was reacting to reading this from the plugin install on my WP Admin panel:
Renders valid OPML from any source as an expandable/collapsible list. Click here to edit XSL transform used for pages and posts and here to edit the XSL Transform used for the sidebar. Usage in code: OPMLRender(‘url’,’updatetime’,’page|sidebar’); Usage in pages / posts: !OPMLRender : url,updatetime,page|sidebar where ‘updatetime’ is the number of seconds to cache a file before requesting an update, and ‘page’ or ’sidebar’ indicates which XSL transform to use. By Dan MacTough.
which is why I thought I needed to edit the .xsl file… so glad I went to the source! I see you already updated it since I got it yesterday so I’ll get a new copy now, thx.
I used exactly this for the URL parameter:
http://www.opmlmanager.com/opml/BillyG.opml
and got “Error reading OPML file.” in return.
Reading Lists
Billy, can you check to ensure that your PHP installation has either CURL or allow_url_fopen?
Y! Small Biz, sending now…
their help says CURL yes
but while looking for allow_url_fopen or _url_fopen (even at the http://us2.php.net/manual-lookup.php?pattern=allow_url_fopen&lang=en site), nothing comes up
it’s entirely possible that something is wrong my end, you can check out my awe-inspiring (lol j/k) blog here:
http://billy-girlardo.com/WP/
thx for stickin with me though
I see that you’re running WP 2.0 RC. I haven’t tested WP 2.0 yet, so I cannot say if there is a problem.
Try dropping this script on your website and running it. Post the results.
yeah, sorry… I assume you mean in the plugins dir, doing now
Current PHP Version: 4.3.11
You have CURL installed.
You have allow_url_fopen enabled.
took a minute to realize I had to go to the directory on that one lol… guess Y! wasn’t lyin
Well… I’m stumped. You shouldn’t be getting that error message if you have CURL installed (the message should be different). Try editing opmlRenderer.php by commenting out the line
error_reporting(0);
, which should be on line 40.same result
this is what is in the sidebar right now:
php OPMLRender(‘{http://www.opmlmanager.com/opml/BillyG.opml}’, ’60’, ‘sidebar’);
with the opening/closing php brackets & inside the html list as shown above
Oh. Sorry, Billy, I thought it would be understood that
{YOUR_URL}
was the bit to replace with your url, i.e., no braces.oh, and I assume you mean that opml url just as I have it (without the braces), wait one…
well that code does look better… and YES, IT LOOKS MUCH BETTER! Thank you Dan, U da Man!
(I knew it was something my end lol)
Hi Dan. Just wanted to let you know that I’ve been getting errors in the validator for the the first line of the Renderer script, text/Javascript if I remember correctly, you can see it thru the W3C validator. Of course, I’m getting errors thru the del.icio.us script also and their’s is still being displayed so I guess I’ll turn yours back on. I do remember that IE wasn’t displaying as FF was and that was why I turned off some scripts before. I’ll give it another go. thx again.
I just downloaded your current version and it installed no problem, IE even looks like FF (which is usually IE’s fault when it doesn’t). Anyway, I am getting all these validation errors now, 159 total, I only had 2 before (from del.icio.us’s script).
You can see the validation here: http://validator.w3.org/check?verbose=1&uri=http://billy-girlardo.com/WP/
FYI: it definitely slowed IE down though, FF pops right up.
Thanks, Billy. I’ll fix that soon. Looks like the script I was using to validate the XHTML was not using the correct URI.
Current PHP Version: 4.4.1
You have CURL installed.
You have allow_url_fopen enabled.
not working on my blog http://blog.franto.com
after inserting your php script, rendering of HTML PAGE stops and dont continue, i’m using WP2.0
It’s very nice plugin, and I like it
Has anyone been able to make this work properly on a post (not a page or sidebar)? While I was finally able to make it function (who knew I had to take out the spaces in between the variables!) when I have a post with and opml file, it causes havoc with any theme I use. I am also having problems with IE displaying it properly (missing icons and the first half of the first character of each line chopped off). Any suggestions? If need be, I will put up a test post to show you. I’d rather not leave it up since it destroys the look of my site.
Thanks,
Bob
Ok…looks like I was able to fix some of the problems myself. The only problem remaining is that IE seems to chop off the first .5 to 1.5 characters of each line. I even tried indenting the lines a little more to see if that helps. Firefox has no problems with it. Any ideas why this would happen?
Thanks,
Bob
P.S. I’m leaving the test post up now, since it doesn’t mar my whole site.
P.P.S. Thank you so much for making this tool. I have wanted to do something like this with for my podcast show notes for awhile now!
Bob – Thanks for persevering. Sorry for the thing with the spaces. When I first posted, I was having trouble with the plugin trying to render the example text, and the spaces were my way of stopping it.
Note that I just posted version 0.4. To the extent any of your issues were the result of poorly formatted HTML, this update may help.
However, I think your IE issue may be a CSS issue in your template. I noticed you’ve got a 3-column layout with frames, too. FWIW, I have no troubles in IE with any of the templates I’ve got installed.
Dan,
The new version worked like a charm! Everything works as it should now. Thank you so much for your hard work. You have just cut tons of time from the post production of my podcast. Now I can create a show outline in Dave Winer’s OPML Editor and after I finish recording the show upload the file to my blog and not have to worry about retyping all the show notes! I’ll make sure to talk about this on my next episode as well as discuss this with my fellow members of the New Jersey Podcasters Association, since I know a few other members were looking to do something similar.
Bob
That’s great, Bob! I’m so relieved it could be cured so easily.
And thanks for your kind words. I’m just glad that someone else finds this useful or interesting.
error message appears such as “Horrific XSLT error – check logs”
how do i do?
anyway it’s a really good.
she – Most of the time, that’s because of a failure to fetch the OPML or because the OPML is not valid. Try editing
opmlRenderer.php
and comment out the lineerror_reporting(0);
, then rerun your problem page and post the error messages.i did it. but ‘Horrific XSLT error – check logs’ is remained.
she – But were there additional errors? Post a link to the page, and I’ll delete it from your comment once I’ve read it.
this is my test page. thanks!
she – Please check your email to follow up on this.
hey. in my php is not installed curl. but can use allow_url_fopen via .htaccess.
so i wrote the allow_url_fopen via .htaccess. but same error message reported.
Hi Dan. Just came back for a visit and saw you doubled the size of your download, that immediately sounded like a good thing! I swear my list opens extremely fast now, and I thought it was great before…
Two points though: I’m still getting the XHTML validation error as soon as it hits yuor script:
—————————————————————————————————————-
required attribute “type” not specified .
The attribute given above is required for an element that you’ve used, but you have omitted it. For instance, in most HTML and XHTML document types the “type” attribute is required on the “script” element and the “alt” attribute is required for the “img” element.
Typical values for type are type=”text/css” for and type=”text/javascript” for .
—————————————————————————————————————-
which is referencing this:
———————————
# Reading Lists
#
#
———————————
And tons from the fact that your img folder resides inside your opmlrender folder (even after ftp upload time) but the img tags in the script are pointing to /wp/wp-images/ as indicated here:
—————————————————————————————————————-
a name=”#” onClick=”jsid591740(‘oi-id594641’);” style=”text-decoration: none; border: none;”>Subscriptions
—————————————————————————————————————-
I guess I could copy those img’s over to the /wp/wp-images/ folder for now, just wanted to let you know… then again, with my history lately, maybe it’s something on my end lol. G/L and thanks again.
look like it didn’t all come thru but the important part is the start:
# h2 Reading Lists /h2
# ul
# script language equal “JavaScript” * edited out brackets and = so maybe it will stay *
and reference:
src=” wp wp-images imgCollapsed.gif” * edited out /’s *
peace
Damn, I’m sorry, last one but I forgot to pass this on, I saw it somewhere yesterday and perhaps it will help:
//
//]]>
Reference: * http://www.w3schools.com/xml/xml_cdata.asp
Out.
Billy, I think the problem is on your end. You’ve got a mixture of files from different releases. Please try getting the current download.
Rendering of template stops at call of
OPMLRender(...);
with
Fatal error: Call to undefined function: domxml_xslt_stylesheet() in /home/…/wp-content/plugins/opmlRenderer/opmlRenderer.php on line 136
curl-fopen-test.php returns:
Current PHP Version: 4.3.4
You have CURL installed.
You have allow_url_fopen enabled.
You have DOM_XML support.
I’m using WP 2.0
Oh, no. Marcus, you have the rare situation of having DOMXML but without the libxslt library (making it almost worthless).
Thx for straightening me out Dan. I copied over instead of deleting first. All good now.
Dan, I’m trying to instal the plugin, and after getting a “Horrific XSLT error” 🙂 I ran the script recommended in the comments, and I got this message:
Current PHP Version: 4.4.2
You have CURL installed.
You have allow_url_fopen enabled.
You DO NOT have XSLT support.
Is there anything I can do about this? Thank you!
Constantin, there really is nothing you can do other than ask your hosting company to install DOM_XML with libxslt.
I had the experience with my hosting company when they upgraded to PHP 4.4.x from 4.3.x that none of the PHP extensions were installed! Turns out the RedHat-based distros (which most web hosts use) changed the PHP packages by moving almost all the extensions into separate packages as of PHP 4.4.x. So the upgrade is an effective downgrade (in terms of features) if the administrator isn’t paying careful attention.
Just tell them you need it, pointing out that its capabilities are so integral that they are built into PHP 5 (no longer an extension).
Good luck!