PDA

View Full Version : custom bbCode tag and variables ($postid) ? possible?


effgee
01-26-2007, 06:26 AM
Hi all!

I would like to create a custom bbCode tag [spoiler] that can be collapsed/expanded via JS. In order to be able to do that however, I need to assign unique IDs to each container displaying a spoiler posted by users.

So I was wondering if it was possible to create a custom bbCode tag [spoiler], where the replacement code contains the variable $postid, similar to the snippet below:

<div id="spC_$postid" onclick="JSgoeshere">
<div class="spBody"> (This just for formatting)
{param}
</div>
</div>

("spC_" = prefix so the div doesn't have the same ID as the postbit container)


Any hints/tips/pointers would be greatly appreciated.

:)

Dismounted
01-26-2007, 06:50 AM
$post[postid] should work.

effgee
01-26-2007, 02:15 PM
Hi Dismounted,

Thanks much for the quick reply! I tried $post[postid] a minute ago but all I get on the rendered page is <div id="$post[postid]">the parameter text</div>. Is it possible that vB simply won't parse variable placed in this location?

Ha! Fixed with work-around by using "this" my JS. For anyone in a similar predicament, here's an example (http://forums.macnn.com/_eff_temp/spoiler_final/spoiler_final.html) ... feel free to grab/use/mangle the code therein!

:)