Page 1 of 1

stop an onAfterDisplayContent from triggering

Posted: Wed Nov 07, 2007 4:20 pm
by yoshi
Hi,, I have a mambot which is set as 'onAfterDisplayContent'

before I have coded 'onPrepareContent' mambots and have escaped them by using

Code: Select all

   if ( strpos( $row->text, "{mambot off}" ) ) {
      $row->text = str_replace( "{mambot off}", '', $row->text );
      return true;
   }


this replaces the {mambot off} call with blanks and exits.

however I dont seem to be able to apply the above to the onAfterDisplayContent mambot.  If I try It does escape (stop) the mambot but does not replace the mambot call with blanks, I also get an annoying number 1 appear later in the output.

can anyone tell me how I might get an onAfterDisplayContent mambot to abort if a mambot regex like (mambot off} is found in the content item.

Thanks

Lee

Re: stop an onAfterDisplayContent from triggering

Posted: Wed Nov 07, 2007 9:18 pm
by Pentacle
I think onAfter... event echoes the returned values. So instead of 'return true' just use 'return'.

I don't know much about your other problem. But logically, if it is triggered after displaying content, then $row->text can't be modified I think.