The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Conditionals in BB code?
I have a spoiler tag BB code that I really like, it presents a toggle-able button that the reader can click to "show" or "hide."
However, it doesn't work when folks are on mobile browsers. What I'm wondering is, would it be possible to add some lines to this code so that older or mobile browsers (or, perhaps, just visitors using the mobile skin) would get a more "basic" spoiler code (ie: the kind that simple highlighting reveals text) and everyone else gets the "deluxe" hide/show button? This is the deluxe code for normal use: Code:
<div style="margin:5px 20px 20px 20px"> <div class="smallfont" style="margin-bottom:2px"> <input type="button" value="Show" style="width:50px;font-size:10px;margin:0px;padding:0px;" onclick="if (this.value=='Show') {this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';this.value='Hide';} else {this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display='none'; this.value='Show';}"> </div> <div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;"> <div style="display: none;">{param}</div> </div> </div> ...and this is the basic spoiler code I'd want to be used when the user is in the mobile skin, or in some browser other than MSIE, Firefox, Safari, etc. Code:
<div style="margin:20px; margin-top:5px"> <div class="smallfont">Spoiler: (<i>Highlight this box to reveal the text.</i>)</i></div></font> <pre class="alt2" style="margin:0px; padding:$stylevar[cellpadding]px; border:1px inset; width:$stylevar[codeblockwidth]; height:{$blockheight}px; overflow:auto"><div dir="ltr" style="text-align:left;"><table bgcolor=#E1E4F2><tr><td><font color=#E1E4F2>{param}</font></td></tr></table></div></pre> </div> So, are conditionals allowed in BB code? How would I do this? |
#2
|
||||
|
||||
Honestly, I'm going to need something like this in the near future I believe. I'm wanting to pick up some more actual coding experience. When (IF) I get a chance I might try looking into this. Not promising anything though.
|
#4
|
||||
|
||||
Wow, great link, LiveWire.
Now I just need to learn how to "use PHP to test for the User Agent String." |
#5
|
|||
|
|||
PHP Code:
|
#6
|
||||
|
||||
Still stuck on this, wondering if I could get another assist. Here's the code I tried (and in this case, I've just entered one User Agent String to look for, that of the Sidekick/Hiptop mobile device from Danger.)
PHP Code:
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|