[Pmwiki-users] Custom image markup

Jeroen Coumans jeroen
Fri Jul 2 09:47:15 CDT 2004


Patrick R. Michaud said the following on 02-07-2004 17:22:
> On Fri, Jul 02, 2004 at 04:41:40PM +0200, Jeroen Coumans wrote:
> 
>>I'm trying to implement the dropshadow image technique described at 
>><http://www.alistapart.com/articles/cssdrop2/>. It requires two 
>>additional divs wrapped around <img>. How can I do this in pmwiki-1.x? I 
>>naively tried adding the following line to local.php:
>>    $UrlImgFmt = "<div class='alpha-shadow'><div><img src='\$Url' 
>>    title='\$Url' alt='' img></div></div>"
>>But it didn't work. I know I can hack pmwiki.php, but I'd rather not do 
>>that. Any pointers or suggestions?
> 
> 
> You're trying to do this for *all* images in the markup text?  Wow.

What would be the alternative? I can allow span and div in the markup 
text, but I don't feel like adding it to all images in there.

> Note that something like this might do some weird things overall, since 
> the <img ...> tag is normally inline and not block markup and the 
> <div>s are making this into a block.  I haven't read the alistapart.com
> article--would <span>s work as well as <div>s?

No, unless you'd add "display: block" in the CSS ;-) The article has all 
the gory details.

> And, when you say "it didn't work", what exactly doesn't work?
> Does it not produce the HTML you expect, or is it that it produces
> the correct HTML but doesn't render properly, or what?

My markup was this:
$UrlImgFmt = "<div class='alpha-shadow'><div><img src='\$Url' 
title='\$Url' alt='' img></div></div>"

(note the title and the img>). This resulted in the following error:

Parse error: parse error in /htdocs/www/local/config.php on line 109

Warning: Cannot modify header information - headers already sent by 
(output started at /htdocs/www/local/config.php:109) in 
/htdocs/www/index.php on line 404

> It may also be that PmWiki's automatic image floating is causing the
> problem.  You might try:
> 
>    $UrlImgFmt = "<div class='alpha-shadow'><div><img src='\$Url'
>      alt='' ></div></div>";

Ok, the title was at fault here. I changed it to
$UrlImgFmt = "<div class='alpha-shadow'><div><img src='\$Url' alt='' 
/></div></div>";

and it works great now, thanks!

-- 
Groeten/Greetings,
Jeroen Coumans
www.jeroencoumans.nl



More information about the pmwiki-users mailing list