Notify a new post on another site page (Technics)

by Jean-Michel2 ⌂ @, Belgium, Tuesday, April 28, 2015, 13:13 (3280 days ago)

Hi all,

On the home page of the hosting site, a button leads to the MLF forum. I would like to have a notification appearing (for instance, "New!") if there is a new posting. Let's say, in the past two days.

So the question is : how can one programmatically detect that there is a new posting on the forum ?

I can think of three possibilities :

1) by looking at the forum home page. For instance, by extracting info from the "Latest postings" frame
2) by getting the info from the MLF database. But then, access must be granted to a third party.
3) by retrieving a certain predefined flag on the forum home page. This does probably not exist today.

What is the easiest way to get this info ?

Regards,
Jean-Michel

Avatar

Notify a new post on another site page

by Alfie ⌂, Vienna, Austria, Tuesday, April 28, 2015, 16:07 (3280 days ago) @ Jean-Michel2

Hi Jean-Michel,

2) by getting the info from the MLF database. But then, access must be granted to a third party.

Why? Given what you stated in your post I assume that you run the site (say example.org) and the forum either in a subdirectory (example.org/forum) or subdomain (forum.example.org). Where does a third party come into play here?

Examples from my site:

  • Example 1
    In the left column of the main site a list of the last fifteen top-level posts (id == tid) of the forum – which is located in a subdomain.
  • Example 2
    In the subdomain a list of the latest twenty posts. List items are styled in such a way that one can distinguish between top-level posts and replies. This is the page people generally bookmark if they don’t use the RSS-feed.

In your case query the DB limiting to one (the latest) result within the last two days. Suggestion: In the main-page write sumfink like <?php include('foo.inc.php'); ?>. Within foo.inc.php query the database and style the result accordingly: "New!" with "visibility:hidden;" if there is nothing new or with "visibility:visible;" otherwise. More elegantly, if you have respective classes in a CSS.

3) by retrieving a certain predefined flag on the forum home page. This does probably not exist today.

Yep.

What is the easiest way to get this info ?

Maybe I’m biased but I would opt for 2).

--
Cheers,
Alfie (Helmut Schütz)
BEBA-Forum (v1.8β)

RSS Feed of thread