1
bkresoja
How to add smarty variable for random number
  • 2004/7/18 22:04

  • bkresoja

  • Just popping in

  • Posts: 2

  • Since: 2004/7/13


How can I add some kind of variable for "theme system" that would change numbers randomly? The Idea is to change site's logo on start or reload. So, I need some variable <{random_number}> to put a number between 1 and 20 (for example) instead of <{random_number}> in the final page.
Hope you understood me

emample
<{$xoops_banner}>


2
Dave_L
Re: How to add smarty variable for random number
  • 2004/7/18 22:16

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


To get a random number between 1 and 20 inclusive, replace <{random_number}> with <{1|rand:20}>.

3
bkresoja
Re: How to add smarty variable for random number
  • 2004/7/18 22:17

  • bkresoja

  • Just popping in

  • Posts: 2

  • Since: 2004/7/13


thnx

4
evylrat
Re: How to add smarty variable for random number
  • 2005/2/3 14:29

  • evylrat

  • Not too shy to talk

  • Posts: 164

  • Since: 2004/2/25


Can you assign this to a variable to reuse throughout the theme? (unless the random seed picked is the same for all refs in the theme).

5
Dave_L
Re: How to add smarty variable for random number
  • 2005/2/3 14:45

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


If by "throughout the theme", you mean within theme.html and any files it includes:

<{assign var='random' value=1|rand:20}>
...
A random value: <{$random}>

6
evylrat
Re: How to add smarty variable for random number
  • 2005/2/3 15:08

  • evylrat

  • Not too shy to talk

  • Posts: 164

  • Since: 2004/2/25


Cheers! I'm going to try and create a large header graphic, that'll be in 3 parts.
1) Header
2) Menu Bar Image
3) Ghost image at the top of the page contents.

So hopefully it'll look like a large continuous image that is nice and bold at the top but fades out in content.

I was toying with the idea of having different images per module, but think I'll use random instead. But will that play havoc with the page loading time...

7
evylrat
Re: How to add smarty variable for random number
  • 2005/10/4 20:53

  • evylrat

  • Not too shy to talk

  • Posts: 164

  • Since: 2004/2/25


Is there a way to use these variables in the syles.css sheet? I'm thinking random backgrounds for cells in tables.
CheshAIR - Chester and surrounding areas air and water cooled VW club

8
evylrat
Re: How to add smarty variable for random number
  • 2005/10/4 21:51

  • evylrat

  • Not too shy to talk

  • Posts: 164

  • Since: 2004/2/25


I've put these in the style.css
td#header1 {background-image: url(images/header1.gif);height: 155px;width: 775px;}
td#header2 {background-image: url(images/header2.gif);height: 155px;width: 775px;}
td#header3 {background-image: url(images/header3.gif);height: 155px;width: 775px;}

and the following in theme.html
<td align="left" id="header<{$random}>"><img src="<{$xoops_imageurl}>images/logo.gif" hspace="24" />td>

The theme is producing id="header1", id="header2" etc but the style isn't being shown.
CheshAIR - Chester and surrounding areas air and water cooled VW club

9
evylrat
Re: How to add smarty variable for random number
  • 2005/10/5 16:41

  • evylrat

  • Not too shy to talk

  • Posts: 164

  • Since: 2004/2/25


Funny, that works today. I probably didn't refresh.
CheshAIR - Chester and surrounding areas air and water cooled VW club

10
MySchizo
Re: How to add smarty variable for random number
  • 2005/12/8 14:03

  • MySchizo

  • Just popping in

  • Posts: 1

  • Since: 2005/12/8


is there a smarty random variable that doesn't pick the same number twice.
everytime it picks a different number untill all numbers in it are exuasted.

Login

Who's Online

258 user(s) are online (170 user(s) are browsing Support Forums)


Members: 0


Guests: 258


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