vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   If bbcode exists in post show something on showthread (https://vborg.vbsupport.ru/showthread.php?t=324584)

Dr.CustUmz 03-04-2017 09:16 AM

If bbcode exists in post show something on showthread
 
I am trying to show a section on the showthread page only if a specific bbcode was used, is there any way to accomplish this?

Dave 03-04-2017 03:41 PM

Can't you just check the post contents before it's parsed by the BBCode parser? Use the strpos function to check for "[BBCODE".

Dr.CustUmz 03-04-2017 05:31 PM

got to thinking on this, first thing that pops into my head is something like:

Code:

$var = $this->post['message'];

if (strpos($var, '[BBCODENAME]') !== false) {

STUFF

}

the problem with that though is I cant quite get the results I'm looking for, see if the post contains the bbcode, I want to not show the content of the bbcode in the post tab (there will be tabbed sections) it is still within the post, but in its own tab

so say the tabs are MAIN POST, BBCODE1, BBCODE2

so bbcode1 and 2 content would only show within the tabbed page, I'm over complicating it...

I may have to stick to the original way I was doing this, and not use it as a bbcode.

Paul M 03-04-2017 10:18 PM

Why assign it to $var ?

Just use
PHP Code:

if (strpos($this->post['message'], '[BBCODENAME]') !== false
{
    
//Do Stuff


(note the vb standard is { and } on their own lines).

Dr.CustUmz 03-05-2017 01:18 AM

That works a lot nicer but still doesn't allow me to quite get the end result I'm looking for.

As for the {

Just my typing style ;)

Code:

If (this) {
This stuff
} else {
That stuff
}



All times are GMT. The time now is 02:22 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.01038 seconds
  • Memory Usage 1,716KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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