Page 1 of 1

If new posts in X forum function

Posted: Sun Oct 21, 2018 5:22 am
by teebling
Hello,

I'd like to make some code something like this:

Code: Select all

<!-- IF f=7 has UNREAD posts --><img src='#'><!-- ENDIF -->
Which I would be able to use on any viewforum page.

This is so that I could display a small image (indicating unread posts in X forum) next to any forum links in my navigation bar.

Could anyone help me out with the PHP bit? I am comfortable implementing this into the template itself just not the actual function.

Thanks,
Teeb

Re: If new posts in X forum function

Posted: Sun Oct 21, 2018 7:12 am
by david63
What code have you already got in your extension - is it on Github?

Re: If new posts in X forum function

Posted: Sun Oct 21, 2018 11:28 pm
by teebling
I don't have any code yet david63 - I understand how I will put in the IF statement into the template, but not the PHP behind that.

Teeb

Re: If new posts in X forum function

Posted: Mon Oct 22, 2018 1:01 am
by Toxyy
topicrow.S_UNREAD_TOPIC will be true per topic row on viewforum if it is unread in the templates.

Re: If new posts in X forum function

Posted: Mon Oct 22, 2018 6:17 am
by teebling
Toxyy wrote:
Mon Oct 22, 2018 1:01 am
topicrow.S_UNREAD_TOPIC will be true per topic row on viewforum if it is unread in the templates.
Thanks for this - will it work with other forums not currently displayed?

For example I am viewing forum ID 1, and there are unread posts in forum ID 3 (a page I am not currently viewing), and I do something like this:

Code: Select all

<!— IF topicrow.S_UNREAD and FORUM ID=3—><img src=“image.png”><!— ENDIF —>
Basically I have links to all the different forums in overall_header and would like to display an ‘unread posts’ indicator image above each if they have unread posts.

Re: If new posts in X forum function

Posted: Mon Oct 22, 2018 9:53 am
by Toxyy
teebling wrote:
Mon Oct 22, 2018 6:17 am
Basically I have links to all the different forums in overall_header and would like to display an ‘unread posts’ indicator image above each if they have unread posts.
I don't recall if that variable available within topic rowset but if they are you could get the array column if that and the key you need and loop through it looking for a hit, within your own mini extension of course.