[pmwiki-users] Referring to images in a skin CSS file

Jo Vermeulen jo.vermeulen at gmail.com
Tue Mar 17 01:51:32 CDT 2009


Perfect, thanks Petko and David!
-- Jo

On Mon, Mar 16, 2009 at 11:19 PM, DaveG <pmwiki at solidgone.com> wrote:

>
>
> Jo Vermeulen wrote:
>
>> Hi,
>>
>> I was wondering what is the best way to refer to background images in the
>> CSS style sheet for a custom skin? Is it possible to use PHP variables to
>> get the current skin directory in the CSS file (just like how the CSS file
>> is linked in the template)?
>>
> You can't use PHP variables in the css file. However, you typically refer
> to images using relative paths -- usually including images in the same
> directory as the css, or a sub-directory. The you can refer to the image
> from css:
>
>  #selector { background: url(images/picture.jpg) }
>
> If you really need to use PHP variables to determine the image path, then
> you can add styles to the page header using:
>
>  $HTMLStylesFmt['mystyle'] = '#selector { background: url(' .$myPHPvariable
> .'/picture.jpg) }';
>
>
>  ~ ~ David
>
>
>  Will this still work when rewrite rules are used (e.g. to rewrite
>> example.com/pmwiki.php/?n=Group.Page <
>> http://example.com/pmwiki.php/?n=Group.Page> ->  example.com/Group/Page <
>> http://example.com/Group/Page>)?
>>
>> Thanks in advance!
>>
>> -- Jo
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> pmwiki-users mailing list
>> pmwiki-users at pmichaud.com
>> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20090317/573ae903/attachment.html 


More information about the pmwiki-users mailing list