[pmwiki-users] Referring to images in a skin CSS file
DaveG
pmwiki at solidgone.com
Mon Mar 16 17:19:17 CDT 2009
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
More information about the pmwiki-users
mailing list