Foren / Cotonti / Support / Randomizing Image

12NächsteLetzte

CJ
#1 5. Juni 2011, 12:59

ok so GOM Team use to have this http://custom.simplemachines.org/mods/index.php?mod=909 it randomizes the images {Random} Image 1 | Image 2 | Image 3 {/random} ({} = [])

 

but i didnt add it to the LDU another guy did, im wondering how i would added it to the Sed files (cotonti)

pieter
#2 5. Juni 2011, 13:12

Where do you want to use it?

Maybe there is another solution for it.
In which version do you want to add it?

... can we help you ...
CJ
#3 5. Juni 2011, 13:25

6.1.5? is my cotonti.

I found another

 

Create a new file (bbcode.php): Upload it to your main forums URL where index.php, etc is located. Remove the javascript and replace it with the following (in the bbcode section of the admin cp): You can now use [rand]Test1||Test2[/rand] and no longer "%"'s.

now my Images between [rand] Tags Dont show

im looking for other ways but i really wana get this working alot of the guys on the site use to have this and we loved it, its been used in out shoutbox news forums downloads Ect on LDU but now on SED idk how to get this to work..


Dieser Beitrag wurde von CJ (am 5. Juni 2011, 15:27, vor 12 Jahre) bearbeitet
Kingsley
#4 5. Juni 2011, 13:41

think this plugin from EZ does what you want

CJ
#5 5. Juni 2011, 13:47

no... thats not want, what i want is a script (bbcode) that randomizies the images in the tags [random][/random] and anyone can use it in there signature. as i said we use to have it on out site befor we switched to SED.

 

urlkiller
#6 27. Juni 2011, 01:46

Sorry if i may sound stupid. but what's the use of a random bbcode thing?

[random]one|two|three[/random] and then it returns only one of the 3 vars?
i really cant figure out a plausible reason that would explain why... surprise

 

 

Added 58 seconds later:

anyway you could do that with a plugin i guess. check out the bbcode documentation that will give you some leads i think.

Added 51 seconds later:

http://www.cotonti.com/articles/14

URL shortener: <a href="http://bbm.li/!7AD5C7">http://bbm.li/!7AD5C7</a>
CJ
#7 28. Juni 2011, 11:27

we used it before so that we all could have a roating siggy

 

and thanks for tha link

urlkiller
#8 29. Juni 2011, 02:51

yeah as it is for a signature you could think about the following.

1. add a extra field to the users
2. make a really small plugin (sounds scary? it isnt!)
2a. the plugin only reads the string from the new extra field (e.g.: var1;var2;var3;var4)
2b. make an array out of that
2c. randomize the array
3. output only one var

that should do the trick... then you would only need one field...

but if you only want some fancy signatures you can check that <marquee> http://de.selfhtml.org/html/text/anzeige/marquee.htm
and also. since everyone could use html in their signature they can add even this to animate or make it more interesting.

URL shortener: <a href="http://bbm.li/!7AD5C7">http://bbm.li/!7AD5C7</a>
CJ
#9 29. Juni 2011, 13:22

but would that work for any user ?

Added 56 minutes later:

ok i have a code to put in the Functions.Php its for BBCode how would i add it ??

 

    if($name == 'random')
    {
        $parts = explode('|',$inner);
        return $parts[mt_rand(0,count($parts) - 1)];
    }
    if($name == 'noparse') return $inner;

how would i add that to the PhP so it doesnt kill my site


Dieser Beitrag wurde von CJ (am 29. Juni 2011, 14:19, vor 12 Jahre) bearbeitet
urlkiller
#10 30. Juni 2011, 03:48

ok. so. i never done that before but it seems that is working properly...

so some little steps for you to do:

1. go to admin.php?m=bbcode on your site
2. add a new field with the following settings:

http://www.cotonti.com/datas/users/bbcode_39.png

here is the complete code you have to paste on the right place (see above):

1st field: \[random\](.+?)\[/random\]
2nd field: $arr = explode('|',$input[1]); return $arr[mt_rand(0,count($arr) - 1)];

this allows users on your site to add an random code like [random]one|two|three|four|...[/random]

URL shortener: <a href="http://bbm.li/!7AD5C7">http://bbm.li/!7AD5C7</a>
CJ
#11 30. Juni 2011, 14:58

now in my Signature area it says $arr = explode('|',$input[1]); return $arr[mt_rand(0,count($arr) - 1)];

 

...

Added 29 minutes later:

Nvm i got it working ! thanks for the HELP !!


Dieser Beitrag wurde von CJ (am 30. Juni 2011, 15:27, vor 12 Jahre) bearbeitet
urlkiller
#12 30. Juni 2011, 15:48

and does it work like you wanted?
you can really do a lot with only the build in features of the framework...

nice, eh?
 

URL shortener: <a href="http://bbm.li/!7AD5C7">http://bbm.li/!7AD5C7</a>
CJ
#13 30. Juni 2011, 15:52

Once question i added it to a news post but its not changing the image, but its working on my Siggy

urlkiller
#14 30. Juni 2011, 15:56

hmm...
try it please with multiple post.
it had the behaviour that it only changes the value when the post was submited. only refreshing the page wont work... [this was for me, maybe your's behave differntly]
(bare with me this is my first time working with bbcode system ever. i usualy use html markup for most user freetext fields like here on cot now)

URL shortener: <a href="http://bbm.li/!7AD5C7">http://bbm.li/!7AD5C7</a>
CJ
#15 30. Juni 2011, 15:59

Yeah it only works on Profiles not News postes or Forum posts.

12NächsteLetzte