vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   [variable] within a bbcode (https://vborg.vbsupport.ru/showthread.php?t=136943)

Equinox68 01-19-2007 04:30 PM

[variable] within a bbcode
 
I am trying to use a random number variable within a custom bbcode.

basically I have a tag called [rand] that produces random numbers from 1 - 15

The php code looks like this

PHP Code:

<phpcode><![CDATA[$this->post['message'] = preg_replace('/\[rand\]/i',mt_rand(1,15),$this->post['message']);]]></phpcode

I also have a custom bbcode called [sign] where you can input any text you want and it shows a smilie holding a sign with whatever you wrote.

All my smilies for this bbcode are named the same with numbers at the end such as sign1.png, sign2.png, sign3.png, etc etc

What I want to do is make the smilies change by randomly calling up a different number.

This is what I'm currently running for the sign.

HTML Code:

<table border="0" cellspacing="0" cellpadding="0">
        <tr>
                <td align="center" style="background-color: White; border: 1px solid Black; padding: 1px;"><FONT COLOR="Black"><normalfont>{param}</normalfont></FONT>
                </td>
        </tr>
        <tr>
                <td align="center">
                <img src="http://mywebsite/images/sign{option}.png" alt="" border="0">
                </td>
        </tr>
</table>

What I want is something like /images/sign[rand].png

This obviously doesn't work. I've tried having my custom bbcode look something like this

[sign=[rand]]blah blah[/sign] and obviously this doesnt work.

Could someone tell me what I could do to accomplish this?

I'd appreciate any help on this.

Someone must know this

Someone must know

Anyone?


All times are GMT. The time now is 01:33 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01946 seconds
  • Memory Usage 1,713KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_html_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (1)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete