WebGUI
      Click here to register.
      
irc://irc.freenode.net#webgui

iPhoneGuy: WebGUI is a pile of crap.
rizen: If WebGUI is such a pile of crap, why do you use it?
iPhoneGuy: Because it's the best pile of crap out there.

If this is what people who hate us are saying, imagine what people who love us will say. Come join us on IRC.


     Report a Bug > WebGUI Bug Tracker

Fix: Thread template: next.url and previous.url tmpl_vars are always defined

User yhkhoe
Date 4/26/2007 10:52 am
Severity Cosmetic (misspelling, formatting problems)
Version WebGUI
Views 109
Rating 0    Rate [
|
]
Karma Rank 0.000000
Previous · Next
User Message
yhkhoe

In the thread template the next.url and previous.url tmpl_vars are always defined wether a next or previous thread exist or not. This is because the existence of a next or previous thread is not checked when the url's are generated.

I thought this might be intended behaviour, but the Default Submission template indicates otherwise. It contains tmpl_if checks to see if next.url and previous url are defined.

    <tmpl_if previous.url>
        <a href="<tmpl_var previous.url>" class="controlLink"><tmpl_var previous.label></a>
    </tmpl_if>   

    <tmpl_if next.url>
        <a href="<tmpl_var next.url>" class="controlLink"><tmpl_var next.label></a>               
    </tmpl_if>    

 This will be fixed in 7.3.16



Back to Top
Rate [
|
]
 
 
JT
Is this fixed or not? I need to know so I can close it.

Back to Top
Rate [
|
]
 
 
yhkhoe
It's fixed. I committed it to svn yesterday.

Back to Top
Rate [
|
]
 
 
JT

I didn't understand exactly what you were fixing here. Now that I see the fix I'm removing it. It's a huge performance penalty. 

In addition, previous and next urls are always supposed to be defined. If there isn't a previous or next then it's supposed to take you back to the main listing. 



Back to Top
Rate [
|
]
 
 
yhkhoe

Wouldn't the performance penalty be a lot smaller if checking for a previous or next thread would be done without instanciating Thread assets? That isn't really necessary when ?func=previousThread is used instead of a direct url.

I did see that you go back to the main listing when there's no previous or next thread, which is a good feature. But it would still be nice if you could leave a link to the next or previous url out of a template by checking if a next or previous url actually exists. The <tmpl_if previous.url> in the Default Submission template does imply that this should be possible.

By the way, DBell and colink mentioned that macro's like PageTitle  return inaccurate information when www_nextThread or www_previousThread are used. I didn't look at this myself but i'm pretty sure your last change reintroduced this problem. Colink also added notes in Thread.pm that www_previousThread and www_nextThread are depracated, which is not the case anymore.

Yung 



Back to Top
Rate [
|
]
 
 
JT

Instanciating the asset takes 0.0079 seconds. Running the nasty query to figure out what the next/prev thread is on a big CS takes 4.1874 seconds.

This morning one of my sites was causing one of my servers to have a load average between 15 and 40. It turned out this was because of two reasons. One the site was getting hammered by search engine bots because some new sites started linking to this site. The second reason was that this site is entirely made of collaboration systems with thousands and thousands of threads, and this code was causing a big load. After removing the code you put in there for the check the load dropped to 3. Granted, that's still not good, but it's a lot better than 15 or 40. That's how inefficient that query is. I've tried to figure out how to make it faster, but I haven't come up with anything.

So, for the time being, I'm afraid that the previous/next functionality has to remain as is until someone comes up with a super efficient query for determining previous/next.

As for it causing another bug someplace else. It may. But until it's confirmed and reported, I have bugs to fix that have actually been confirmed and reported. 



Back to Top
Rate [
|
]