stop an onAfterDisplayContent from triggering

Have a programming question regarding your component, plug-in, extension or core hacks? Have an interesting tidbit, FAQ or programming tip you’d like to share? This is the place for you.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Post Reply
User avatar
yoshi
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Fri Dec 09, 2005 12:30 pm
Location: uk
Contact:

stop an onAfterDisplayContent from triggering

Post by yoshi » Wed Nov 07, 2007 4:20 pm

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

User avatar
Pentacle
Joomla! Intern
Joomla! Intern
Posts: 61
Joined: Wed Oct 25, 2006 12:34 pm
Location: Turkey

Re: stop an onAfterDisplayContent from triggering

Post by Pentacle » Wed Nov 07, 2007 9:18 pm

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.
My Joomla! 1.5 extensions - http://joomla.ercan.us
Progress is made by lazy men looking for easier ways to do things.


Post Reply