Variable For Num Replies

Started by Stanyy, April 28, 2013, 02:27:33 PM

Previous topic - Next topic

Stanyy

What variable can be used to display number of replies to posts on info center?

Arantor

I'm not clear what you mean, seeing that there are potentially 3 different numbers in there (number of total replies to a topic, number of total *approved* replies to a topic, number of total replies to a topic since the user last read it)

None of those values are made available to the info centre, for performance reasons.

Stanyy

Hi Arantor, i mean number of total replies... I tried $context['latest_post']['replies'] but it doesn't work.

Arantor

That would be because, as I said, none of those values are made available to the info centre for performance reasons. There ISN'T a variable. You'd have to make one.

Stanyy

Ok, do I have to add it to the $context['latest_posts'] variable?
I would find that variable in the subs file right? I could be wrong tho...

Arantor

No, you don't. You find it in the bowels of Subs-Recent.php, inside getLatestPosts().

You have to modify that query, the one marked that it is already:
// !!!SLOW This query is now slow, NEEDS to be fixed.  Maybe break into two?

And you want to add more to it.

Stanyy

#6
Whew... been looking through all the junk in that file and I already feel dizzy. Kindly describe what exactly to add to it.

I can see the others under that warning line: poster time, subject, id_topic, id_member.... e.t.c..

UPDATE: Ok, I can create one under "//Build the array" and then use a $row variable in it. But the question is, what do I use in the $row variable and how do I define it in the array along with the others?.

SUGGESTION: How about if i use the id of the last post, is there a variable for that?

Kindred

how about you read what arantor wrote and understand why this is not part of the context array to begin with?


WHY are you trying to do this in the first place?
Maybe, instead of assuming you need to do it (the wrong way), if you told us what the eventual and actual goal was, we could point your to the RIGHT way (if any exists) to do what you are trying to do...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

If you use the id of the last post, that's just the id of the last post. You can't figure out the number of replies from that.

Kindred: I think you're wasting your time trying to explain that.

Stanyy

Hi Kindred.

Ok guys, the thing is that I'm making a re-structured version of my mobile site. I do not intend to use this on the actual 'info center' on my full site.

I'm trying to bring in certain functions into the mobile version as 90% of my members get redirected to wap2 because they access the site with their mobile phones.

If the effect would be really that serious then I could remove an already existing wap2 variable, if that helps?

Kindred

the performance has nothing to do with the variable itself and everything to do with how much of the system resources it takes to fill that variable.

And you still haven;t actually explained WHAT you need this for.

What are you trying to display?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Stanyy

I would like to show number of replies for recent topics.

I have a section in my mobile site to display list of recently created topics, and this uses the same variables from info center.

About resources...... wouldn't it require the same 'weight' of resources it uses when displaying number of replies for topics inside boards (which is there by default) ?

Arantor

Um, no, because it's doing something different in terms of getting the numbers. Like processing to take into account the number of replies that are unapproved. That isn't exactly free.

I'd also note that what the info centre displays is not recently created topics, it is the last x posts to the forum, regardless of their topic(s), meaning you could easily have 5 posts in the same topic. Unless you've installed a mod in which case all bets are off anyway in terms of performance.

Stanyy

Oh I installed a mod to replace that list.

I would really like to know what the consequences of doing this are. If it's just slower page loads then I think it's okay. In any case, if it gets serious, then i'll have the choice to remove it.

I remember the other day Arantor tried to discourage me from increasing num posts per page in wap2 because of performance. Well I did it anyway, although it increased the size of pages a bit, but the good thing is it DOUBLED my traffic (probably because all pages now contained more information). Really it can't be that bad.

Also, would I be able to easily divide the code block into two as suggested by the warning comment Arantor quoted from that file?

I'm sorry i'm being hard headed on this but I need it for the new structure of my forum.

Arantor

QuoteAlso, would I be able to easily divide the code block into two as suggested by the warning comment Arantor quoted from that file?

Um, no, that's why that comment has been there for *years*.

QuoteWell I did it anyway

Then I have absolutely no sympathy for you if/when it gives you trouble.

* Arantor will exit this thread before he says something he regrets, but would like to suggest that correlation does not imply causation.

Stanyy

Quote from: Arantor

* Arantor will exit this thread before he says something he regrets.

I dont understand this. Isn't this about MY forum? Wouldn't any consequences be borne me? How would this affect you in any way?

Quote from: Arantor
Then I have absolutely no sympathy for you if/when it gives you trouble.

It won't give me any trouble i assure you. The BIGGEST Smf forum ever is currently set to display more than 25 posts per page, and this is a forum that gets more than 2000 online registered members (guests not included) every FIVE MINUTES!... And the funny thing is that it's running on version 1.x

That aside, i've seen other forum softwares having that function for recent posts, so I honestly do not understand why it would be an issue for Smf when it's not for others.

Anyways, I can figure this out myself. Thanks for your time.

I'll mark this topic as solved just because you pointed me to what file to edit. Thank you.

Kindred

just curious... what forum do you THINK is the the biggest?

Because the largest and most active SMF forum is running SMF 2.0 and frequently has lag issues despite being hosted on a dedicated server and tweaking by SMF experts because of all the mods that have been installed/made.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Stanyy

I assume you speak of forum.burek.com? LOL. I came across a post the other day where people were yapping about how big Burek is. I only laughed. You know why? Because forum.burek.com is like a toilet bowl for Nairaland.com (Dont mind the recent edits! This forum is running on Smf 1.x and just recently heavily edited their template. I knew when they started back in 2005).

Now let's compare Burek and Nairaland. (These stats were taken 5 minutes ago)

TOPICS:
Burek: 600,019
Nairaland: 1,208,851

(what's that? That's more than twice burek's topics)

POSTS:
Burek: 10,999,942
Nairaland: (They removed this from view. You know why? The number string got toooo long)

ONLINE MEMBERS:
Burek: 520 users, 1348 guests per 30 minutes
Nairaland: 1184 users, 2759 guests per 5 MINUTES! Which means: 7,104 users, 16,554 guests per 30 minutes

So everyone should get their facts right. Nairaland.com is the BIGGEST SMF forum. I think it's hosted on a VPS.

Kindred

No... I was actually talking about warriorcatsrpg with 42,082,730 Posts
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Stanyy

...and only 900,388 topics? place that in the same category with burek. Plus their online stat looks lame: 105 users and 121 guests? although the time threshold isn't visible but I bet it's nothing below 30 mins.

Advertisement: