PDA

View Full Version : If bbcode exists in post show something on showthread


Dr.CustUmz
03-04-2017, 09:16 AM
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:

$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

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 ;)

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