PDA

View Full Version : Template conditionals


Set3sh
05-05-2014, 02:02 PM
How can I check for new posts in a forum/subforum?

Thank you.

cellarius
05-05-2014, 02:18 PM
Where?

Set3sh
05-05-2014, 03:06 PM
Anywhere in a forum/subforum.

vb:if condition="new_posts">
...
<vb:else />
...

I dind't find any official documentation regarding all template variables...

cellarius
05-05-2014, 03:20 PM
You can't, because there is none. What do you mean by "in a forum" - on forumdisplay? On showthread?

This may not be possible without a plugin. On forumdisplay or showthread (you're not entirely clear where you want to use this) you don't normally show if there's unread threads as a whole; that is only determined in the threadbits for the single thread at hand.

Set3sh
05-05-2014, 03:30 PM
I'd like to show and image at forumhome and forumdisplay when there is a new post.
So I need to know how to check for new posts in forumdisplay and showthread.

Zachery
05-05-2014, 03:39 PM
Pictures are already shown, when there are new posts in forums, you can see this on any normal forumhome page with the forum status icons.

if you want to get that data outside, you'd need to run a query to figure it out. You'd want to take a look at Number of Posts since last visit mod for something to get you started.

Set3sh
05-05-2014, 04:09 PM
That seem quite bad to run a query for every single time I refresh the page to know if it's a new post or not.

I'm working on a mod to reduce http requests and optimise vb.

So far I'm testing the beta in my own forum http://www.gamemaniacs.ro

The condition that tells me if there are new posts is a must to finish my first mod release.

Zachery
05-05-2014, 04:18 PM
Why don't you checkout my iconic style, it does the things you want (massively reduce http request overhead, in a lot of places).

Set3sh
05-05-2014, 04:27 PM
Thank you mate, but I'm trying to implement css sprites.

Zachery
05-05-2014, 05:04 PM
CSS sprites won't reduce http requests nearly as much as something like iconic.

But I don't understand why you need to know if there are new posts are not. You should assume there are and load the requires CSS/images anyway.

Set3sh
05-06-2014, 04:47 AM
If there are new posts, to load an image to let users know that.
With phpbb, mybb, xenforo I can easily do that.
Why it can not be posssible with vbulletin?

Zachery
05-06-2014, 05:33 AM
Why wouldn't your images already be part of your global sprite sheet?

Set3sh
05-06-2014, 01:27 PM
Thank you for trying to help me but I need solutions not questions.

Zachery
05-06-2014, 03:57 PM
That is a solution to your problem.

Set3sh
05-06-2014, 05:03 PM
It is not.
Let me share you my way of optimising vbulletin:
> replace most images with css buttons
> combine a few of them to preserve the style

That is why it is imperious that I check if there are new posts or not.

Zachery
05-06-2014, 06:14 PM
You should serve 1 sprite, with all of your images, not multiple.

cellarius
05-06-2014, 06:15 PM
Yeah, well, that information is just not available out of the box. You can do it on forumhome or on forumdisplay for subforums, but Lynne has explained to you how to do that. As far as I know, inside the forum (i.e. forumdisplay for threads and showthread) that information is just not readily available. You'd probably have to do a plugin checking the lastpost date of the forum against the last activity date of the user. Maybe that information can be pulled out of the datastore.

Set3sh
05-06-2014, 06:27 PM
Well, that is just great...

Lynnes suggestion works if you need to check if subforums have new posts.
But you can't check if a category forum has new posts using her solution.

Are you aware of a plugin that can solve my problem or some piece of code that I might insert in a template?

Zachery
05-06-2014, 07:03 PM
So here is what I don't get. you want to reduce the overall http request, why aren't you just serving one big sprite image, with all the graphics your forum uses?

Why even bother using graphics when you can use something like FontAwesome?