Support forums : You can see the bug

problem with *ItemAsHtml()

A red message that stops the whole page from loading; a full page, but a message that looks like it came from the server; a red box with red text that we made: All of these are bugs you can see, so report them here. kthxbai :)

Moderator: Dracones

Forum rules
Can you copy/paste the error message, or do a screenshot that shows what is wrong? If not maybe you've got a "you can sense it" bug.

problem with *ItemAsHtml()

Postby EdB » Wed Jan 25, 2012 9:33 pm

Do an installation from the zipped up v000, install the test plugin, then hit the permalink for the "Extended post" sample post. Notice how it does the DisplayItemAsHtml hook twice? Once after showing the teaser, once after showing the rest.

Not a problem for a renderer that is converting X to Y (like smilies for example), but if the rendering is actually adding something to the content like Test Plugin does then we see a serious problem - bits will be added twice. The only time I see the problem is with that one item - the "no teaser" sample works the way we would expect, and multi-page items work as one might expect.

Haven't found a way around it in the plugin because we don't have info about if the item uses !M while we are creating the item, but I haven't dug all the way deep into the bowels of if so there might be an easy answer at the plugin level. If not we need a core solution.
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: problem with *ItemAsHtml()

Postby leeturner » Wed Jan 25, 2012 11:06 pm

Good catch. I have never looked at that area so I don't know all that much about it. Might be a core solution is best.

L
leeturner
Dracone
User avatar
 
Posts: 730
Joined: Fri Dec 11, 2009 11:55 am
Location: Brighton, UK

Re: problem with *ItemAsHtml()

Postby EdB » Thu Jan 26, 2012 12:40 am

Looking a wee bit, the issue is due to how content is actually 2 different functions. content_teaser() and content_somethingelse(). Both get the beginning of a post, the latter kicks in only when there is a part after readmore. So I'm kinda leaning on somehow having core know not to do rendering if there is a readmore in the future, but I haven't really gone that far yet. Gave up after feeling like I learned something ... and when there was food to eat :)
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: problem with *ItemAsHtml()

Postby leeturner » Thu Jan 26, 2012 10:53 am

Got to get your priorities right ;)
leeturner
Dracone
User avatar
 
Posts: 730
Joined: Fri Dec 11, 2009 11:55 am
Location: Brighton, UK

Re: problem with *ItemAsHtml()

Postby EdB » Sun Jan 29, 2012 6:10 pm

gonna try something on this issue. get_content_teaser() creates an array called $content_parts which basically tells us if the post has a NoTeaser or a More in it. So it seems to me if we do the renderer thing only if the length of that array is not more than 1 we'll solve this problem. It would also affect items with NoTeaser, but that isn't so bad. Currently it shows the plugin output on a multipost page, but the idea of those is that the person click through so maybe it shouldn't output when the full content is not yet seen?

Another solution would be to not do the rendering if $disp is not 'single' ;)
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: problem with *ItemAsHtml()

Postby leeturner » Thu Jul 26, 2012 5:34 pm

Just been looking into this a little and it seems a bit of a pain in the ass to fix.

L
leeturner
Dracone
User avatar
 
Posts: 730
Joined: Fri Dec 11, 2009 11:55 am
Location: Brighton, UK

Re: problem with *ItemAsHtml()

Postby EdB » Thu Jul 26, 2012 6:39 pm

I think I fixed it but I'll have to find time to look into it again.
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: problem with *ItemAsHtml()

Postby leeturner » Thu Jul 26, 2012 7:37 pm

Cool. It would be good to port that over to QP.
leeturner
Dracone
User avatar
 
Posts: 730
Joined: Fri Dec 11, 2009 11:55 am
Location: Brighton, UK


Return to You can see the bug

Who is online

Users browsing this forum: No registered users and 1 guest

cron