Andreas Gohr schrieb: > Hi > > >> The plugin works fine so far - when doing the preview, I see the >> cartoon where it should be. As soon as I press "Save", the page is >> rendered anew and contains PHP source code instead of the text (and >> cartoon) I entered. > > This is very strange and from looking at your code I have no idea why > that should happen. > >> /////////////////////////////////////////////////////////////////////////////////////////////////// >> // GIF Util - (C) 2003 Yamasoft (S/C) // http://www.yamasoft.com >> // All Rights Reserved // This file can be frelly copied, >> distributed, modified, updated by anyone under the only // >> condition to leave the original address (Yamasoft, >> http://www.yamasoft.com) and this header. >> /////////////////////////////////////////////////////////////////////////////////////////////////// >> >> > > Does this tell you anything? Do you recognize this header? Is there a > file on your server that contains that code? You should try to > figure this out first... there seems to be something fishy going on. Hm, yes, I recognize it - it is the picture handling of FPDF, I use it in my pdfexport plugin. So I see why it may break - I may not create a PDF out of the page. But I'n not gonna debug HTML2FPDF... > When you resolved that mystery, here are some comments on your code. > > 1. Using regular expressions should make it much easier to grep the > wanted string from the HTML instead of using substr/strpos Yes. Just wanted to be quick ;-) It takes some time for me to figure out the correct regexes... > 2. don't rely on file, file_get_contents or similar functions to > fetch data via HTTP. URL opening is disabled on many hosters. Use the > HTTPClient library of DokuWiki instead. If you use SimplePie (see > below) it will do the downloading for you. It's for private use, and at home, allow_url_fopen is allowed :-) > 3. site scraping is a bad idea (and might be illegal). Userfriendly > provides an RSS feed that includes the image. Parsing that is much > easier and will not break when the site's layout changes. Hint: use > the SimplePie library shipped with DokuWiki to parse the feed. Yes, I see the feed, but - in contrast to Dilbert - I do not see the cartoon, just the link. And the link does not only show the cartoon, but the whole page. I have <http://www.userfriendly.org/rss/uf.rss> as rss feed. I know about the juristic problems. I hope the laws of the US allow linking to other sites, when a note above or beneath the built-in picture states the origin. I never looked at SimplePie, but will do tomorrow (I hope). > 4. you might need to disable caching for the page lower the cachetime > of your wiki to have a daily fresh image Yes, ~~NOCACHE~~ has been added > 5. pull the image through lib/exe/fetch.php to get image caching (use > the ml() function to construct the src) Yes, I'd like to. I never even thought about using fetch.php for external sources... Thank you, it's 1.17 am, time to sleep for now... Regards, Werner -- DokuWiki mailing list - more info at http://wiki.splitbrain.org/wiki:mailinglist