Recent Topics

1 Jan 31, 2008 22:04    

Hello!

I want to write a plugin that appends a certain piece of code to the end of an article page. For this purpose I used the DisplayItemAsHtml hook:


	function DisplayItemAsHtml( &$params ) {
		
		if($params['preview']) return false;
		if(!$params['dispmore']) return false;
		
		$params['data'] .= $something;
		
		return true;
	}

The second line (where it checks $params['dispmore']) shall stop the plugin from appending the extra code if it's not the full view of the article.
However, on a page with teaser and "more" content, the code is appended twice, once to the teaser and once to the "more" content.

What do I have to do to append the code only to the "real" content, and not to the teaser?

Thanks for any help in advance!

2 Feb 05, 2008 19:29

Are you doing this without adding something to the content that gets found and replaced? That's how most renderers work: add "[[whatever]]" or "<!-- whatever -->", then search for that and replace it.

If you're trying to modify content without adding something to search and replace I've no idea how you'll get there. I don't have appropriate files open in front of me, but "content" is getting called by a couple of different functions. For example I'll suspect you will see the same problem with a multi-page post: appending something to the bottom of each page instead of just the end of the last page. That would seem to be the root of your problem, so somehow you would have to figure out is this the 'first and only' or 'first of two' times I'm seeing this content, and work from there.

Good luck!


Form is loading...