1
bluesdog
using background image style
  • 2004/8/29 4:58

  • bluesdog

  • Just popping in

  • Posts: 1

  • Since: 2004/8/29


Using CSS, we can place an image. eg:

background: url(images/logo.png) no-repeat center;

Is there a method of using the {$xoops_imageurl} code within a style sheet instead of within the 'img src' html tag?

eg: <img src="<{$xoops_imageurl}>backlogo2.gif" alt="" />

The style sheet seems to work ok anyway. I'm just curious.



2
studioC
Re: using background image style
  • 2004/8/29 6:59

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


if your are using an externeal style sheet this wont' work but there are several ways of finding a solution for this:

-- you may use inline style in e.g. theme.html within head tag

<style type="text/css" media="all">
<!--
body {
background:url(<{$xoops_imageurl}>style/back.gif");
}
//-->
</style>

or :
<div style="background:url(<{$xoops_imageurl}>style/back.gif");"></div>

using <{$xoops_imageurl}> within themefile will cause templateengine to render this but not within an external stylesheet.

Perhaps you find some interesting stuff in this article
eastereggs
to get a solution for your display idea ?

let your head render this ..

michael

edit: <{$xoops_imageurl}> here is meant in this example as an smarty expression which could be used in style sheets or expressions . you may assign your own smartys go get your wanted solution.

3
ackbarr
Re: using background image style

the use of $xoops_imageurl is not necessary with an external stylesheet. Any url() references within an external stylesheet will be resolved relative to the location of the stylesheet itself.

so if the stylesheet is in the directory:

www.mysite.com/themes/mytheme/

a style rule
#myrule {background: url('myimage.jpg')}

will load the image file located at:

www.mysite.com/themes/mytheme/myimage.jpg

Login

Who's Online

197 user(s) are online (129 user(s) are browsing Support Forums)


Members: 0


Guests: 197


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits