11
tjnemez
Re: {$xoops_imageurl} Problem
  • 2005/1/24 3:32

  • tjnemez

  • Home away from home

  • Posts: 1594

  • Since: 2003/9/21


okay in style.css use this:

div#whatever {
background-image: url(myimage.gif);
background-repeat: no-repeat;
}

12
Draven
Re: {$xoops_imageurl} Problem
  • 2005/1/24 3:32

  • Draven

  • Module Developer

  • Posts: 337

  • Since: 2003/5/28


I use it all the time, it indeed does work provided you use it IN a template file parsed by smarty.

13
Draven
Re: {$xoops_imageurl} Problem
  • 2005/1/24 3:35

  • Draven

  • Module Developer

  • Posts: 337

  • Since: 2003/5/28


If you must use it in a style sheet, and your XOOPS install is in the root directory of your hosting account, you can use a root path like:

background-image:url(/themes/mytheme/images/image.gif);

this will read the first '/' as being the root dir and convert it to:

http://www.mydomain.com/themes/mytheme/images/image.gif

14
mixmaster
Re: {$xoops_imageurl} Problem
  • 2005/1/24 3:41

  • mixmaster

  • Just popping in

  • Posts: 28

  • Since: 2005/1/21


Quote:

Draven wrote:
I use it all the time, it indeed does work provided you use it IN a template file parsed by smarty.


Shouldn't it also work in a theme file? I'm not sure I follow what you mean with using it in a template file.

15
Draven
Re: {$xoops_imageurl} Problem
  • 2005/1/24 3:46

  • Draven

  • Module Developer

  • Posts: 337

  • Since: 2003/5/28


Quote:

mixmaster wrote:
Quote:

Draven wrote:
I use it all the time, it indeed does work provided you use it IN a template file parsed by smarty.


Shouldn't it also work in a theme file? I'm not sure I follow what you mean with using it in a template file.


Yes, by template file I mean themes.html, theme_block_right.html etc.

Smarty does NOT parse included css files like styles.css.

please post the exact theme file you are trying to get this to workin, and the exact path to the image file you are trying to use as a background and I will give you the code.

16
AAINC
Re: {$xoops_imageurl} Problem
  • 2005/1/24 3:48

  • AAINC

  • Not too shy to talk

  • Posts: 121

  • Since: 2003/10/18


Quote:

mixmaster wrote:
I have a simple question about using {$xoops_imageurl}

The following code works with no problem:
<td width="##" height="##" style="background-image: 
url(http://www.mysite.com/xoops/themes/mytheme/image.jpg); 
background-repeat: no-repeat;"
>&nbsp;td>


But this won't work?

<td width="##" height="##" style="background-image: 
url([color=33CC33]<
{$xoops_imageurl}>image.jpg[/color]); 
background-repeat: no-repeat;"
>&nbsp;td>


How do I get this to work????




Your above code in html has an image in the td. To do that in css you would do something like this:

td#your_td { background: url(myimage.gif); background-repeat: no-repeat; background-position: left; height:100px; width:100px;}


Then call the td in your theme
<td class="your_td">


As Draven said, you cannot parse the smarty through the css.

17
Draven
Re: {$xoops_imageurl} Problem
  • 2005/1/24 3:58

  • Draven

  • Module Developer

  • Posts: 337

  • Since: 2003/5/28


Yep, to ensure the file is included from the correct location in the css file, I would use a full path instead of just the image name, but that's just a minor adjustment

18
mixmaster
Re: {$xoops_imageurl} Problem
  • 2005/1/24 4:10

  • mixmaster

  • Just popping in

  • Posts: 28

  • Since: 2005/1/21


Ok, here's the code for center theme block:

    <{foreach 
item=block from=$xoops_ccblocks}>
    <
div style="padding: 5px;">
    <
div class="blockTitle"
  <
table width="100%" border="0" cellspacing="0" cellpadding="0">
    <
tr
      <
td width="101" height="37" style="background-image: url([color=0000FF]<{$xoops_imageurl}><{$block.title|replace:" ":"_"}>_image1.gif[/color]; background-repeat: [color=0000FF]no-repeat[/color];">&nbsp;td>
      <
td height="37" style="background-image: url([color=0000FF]<{$xoops_imageurl}><{$block.title|replace:" ":"_"}>_image2.gif[/color]; background-repeat: [color=0000FF]repeat-x[/color];">&nbsp;td>
      <
td width="114" height="37" style="background-image: url([color=0000FF]<{$xoops_imageurl}><{$block.title|replace:" ":"_"}>_image3.gif[/color]; background-repeat: [color=0000FF]no-repeat[/color];">&nbsp;td>
    tr>
  table>
div>
<
div class="blockContent"><{$block.content}>div>

    div>
    <{/foreach}>
    


I have 3 images in /mytheme/ folder:
Big_Story_image1.gif
Big_Story_image2.gif
Big_Story_image3.gif

e.g. url to image:
http://www.mysite.com/xoops/themes/mytheme/Big_Story_image1.gif

or

<{$xoops_imageurl}>Big_Story_image1.gif

19
Draven
Re: {$xoops_imageurl} Problem
  • 2005/1/24 4:16

  • Draven

  • Module Developer

  • Posts: 337

  • Since: 2003/5/28



    <{foreach 
item=block from=$xoops_ccblocks}>
    <
div style="padding: 5px;">
    <
div class="blockTitle"
  <
table width="100%" border="0" cellspacing="0" cellpadding="0">
    <
tr
      <
td width="101" height="37" style="background-image: url(<{$xoops_imageurl}><{$block.title|replace:" ":"_"}>_image1.gif; background-repeat: no-repeat;">&nbsp;td>
      <
td height="37" style="background-image: url(<{$xoops_imageurl}><{$block.title|replace:" ":"_"}>_image2.gif; background-repeat: repeat-x;">&nbsp;td>
      <
td width="114" height="37" style="background-image: url(<{$xoops_imageurl}><{$block.title|replace:" ":"_"}>_image3.gif; background-repeat: no-repeat;">&nbsp;td>
    tr>
  table>
div>
<
div class="blockContent"><{$block.content}>div>

    div>
    <{/foreach}>
    


ok, the absolute first thing I would check is that that string replace is producing the proper file name.


try this, in your template file just _echo_ the new file name so you can see what the filename it produces looks like:

try this:

<{$xoops_imageurl}><{$block.title|replace:" ":"_"}>_image3.gif


look at the end result and ensure that the proper _case_ is being produced. If your webserver is *nix based, it _is_ case sensative. If the file name your code is producing is not an exact match, case and letters, you've found your problem.

20
mixmaster
Re: {$xoops_imageurl} Problem
  • 2005/1/24 4:24

  • mixmaster

  • Just popping in

  • Posts: 28

  • Since: 2005/1/21


Yes, it produces the correct file name.

The main difference I want to reiterate is this:

The following works (whereas the one I provided before doesn't):

    <{foreach 
item=block from=$xoops_ccblocks}>
    <
div style="padding: 5px;">
    <
div class="blockTitle"
  <
table width="100%" border="0" cellspacing="0" cellpadding="0">
    <
tr
      <
td width="101" height="37" style="background-image: url([color=0000FF]http://www.mysite.com/xoops/themes/mytheme/Big_Story_image1.gif[/color]); background-repeat: no-repeat;">&nbsp;td>
      <
td height="37" style="background-image: url([color=0000FF]http://www.mysite.com/xoops/themes/mytheme/Big_Story_image2.gif[/color]); background-repeat: repeat-x;">&nbsp;td>
      <
td width="114" height="37" style="background-image: url([color=0000FF]http://www.mysite.com/xoops/themes/mytheme/Big_Story_image3.gif[/color]); background-repeat: no-repeat;">&nbsp;td>
    tr>
  table>
div>
<
div class="blockContent"><{$block.content}>div>
    div>
    <{/foreach}>
    

Login

Who's Online

300 user(s) are online (252 user(s) are browsing Support Forums)


Members: 0


Guests: 300


more...

Donat-O-Meter

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

Latest GitHub Commits