vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   custom bbCode tag and variables ($postid) ? possible? (https://vborg.vbsupport.ru/showthread.php?t=137556)

effgee 01-26-2007 06:26 AM

custom bbCode tag and variables ($postid) ? possible?
 
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:

Code:

<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 ... feel free to grab/use/mangle the code therein!

:)


All times are GMT. The time now is 04:36 AM.

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.01563 seconds
  • Memory Usage 1,712KB
  • 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_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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