PDA

View Full Version : Latest news on the index (invision function)


Eagle Creek
05-12-2005, 10:35 AM
Howdy!

Take a look overhere please:
http://eaglecreek.j-p-it.nl/forum/


As you can see at the top of the forums there is a sentence "[EC] Eagle Creek Clan Forum latest news: Forums and site updated"..

In the Admin Panel of the Invision Board I can turn this feature on or off and I can fill in the section ID of the section which one should be shows.

It justs shows the title of the most recent posted thread in that forum.

Is this a standardoption on VB? Or should I go ask for a hack like this?

All the best, EC

cinq
05-12-2005, 10:38 AM
Not a default feature, but can be easily added by placing code in php_include and editting your FORUMHOME template :)

Eagle Creek
05-12-2005, 10:52 AM
Uuhm.. I'm not really a PHPhero (I will be, one :D, I bought books :p, anyway ;)).. Can you make something for me?

Or is that much work?

cinq
05-12-2005, 10:55 AM
The thread there "Forums and site updated", is it being pulled from just a specific forum(s) ? Or is it just the latest thread with a reply ?

Eagle Creek
05-12-2005, 11:00 AM
No, it's for specific forum(s).. In Invision Board I can give up the forumID of the forum I want to get displayed.. (only one forum is possible overthere, but maybe more forumID's are possible when you make it yourself).

So; it shows the threadtitle from the forum I gave the ID and it links to the thread.

cinq
05-12-2005, 11:09 AM
Not tested but something you can try :

Put this in your phpinclude_start ( Styles & Templates > Style Manager > All Style Options )


$getnews = $DB_site->query_first("SELECT threadid, title FROM ".TABLE_PREFIX."thread WHERE forumid=X ORDER BY lastpost DESC LIMIT 1");

You will need to put the forumid of the specific forum you want in place of the X at forumid=X

Now, in your FORUMHOME template, add this whereever you want it to be shown :


[EC] Eagle Creek Clan Forum latest news: <a href="showthread.php?t=$getnews[threadid]">$getnews[title]</a>

Eagle Creek
05-12-2005, 11:17 AM
It isn't for EC forums but I will try this out! Thanks alot!

Where do I have to place it in phpinclude_start?

/*
// Example of how to include a seperate file:

ob_start();
include('yourheader.html');
$your_code = ob_get_contents();
ob_end_clean();

// Now place a reference to $your_code where you want the resulting HTML to be displayed.
// This will most likely be the header or footer template.
*/

cinq
05-12-2005, 11:19 AM
After :

// This will most likely be the header or footer template.
*/

Eagle Creek
05-12-2005, 11:21 AM
Database error in vBulletin 3.0.4:

Invalid SQL: SELECT threadid, title thread WHERE forumid=X ORDER BY lastpost DESC LIMIT 1
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE forumid=X ORDER BY lastpost DESC LIMIT 1' at line 1

mysql error number: 1064

Date: Thursday 12th of May 2005 02:21:08 PM
Script: http://www.antispywareoffensief.nl/forum/online.php?order=asc&sort=username&pp=60&page=1
Referer: http://www.antispywareoffensief.nl/forum/online.php?order=asc&sort=username&pp=60&page=1
Username: Admin
IP Address: *

cinq
05-12-2005, 11:24 AM
You will need to put the forumid of the specific forum you want in place of the X at forumid=X


erm... :p

Eagle Creek
05-12-2005, 11:30 AM
I did.. Forum 35..


/*
// Example of how to include a seperate file:

ob_start();
include('yourheader.html');
$your_code = ob_get_contents();
ob_end_clean();

// Now place a reference to $your_code where you want the resulting HTML to be displayed.
// This will most likely be the header or footer template.
*/
$getnews = $DB_site->query_first("SELECT threadid, title ".TABLE_PREFIX."thread WHERE forumid=35 ORDER BY lastpost DESC LIMIT 1");


Gives:


Database error in vBulletin 3.0.4:

Invalid SQL: SELECT threadid, title thread WHERE forumid=35 ORDER BY lastpost DESC LIMIT 1
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE forumid=35 ORDER BY lastpost DESC LIMIT 1' at line 1

mysql error number: 1064

Date: Thursday 12th of May 2005 02:30:33 PM
Script: http://www.antispywareoffensief.nl/forum/online.php?order=asc&sort=username&pp=60&page=1
Referer: http://www.antispywareoffensief.nl/forum/online.php?order=asc&sort=username&pp=60&page=1
Username: Admin
IP Address: *


:(

cinq
05-12-2005, 11:41 AM
<a href="https://vborg.vbsupport.ru/showpost.php?p=652555&postcount=6" target="_blank">Sorry try the code again</a>

Eagle Creek
05-12-2005, 11:45 AM
Whaha, I will. Hang on a sec :).

http://www.antispywareoffensief.nl/forum/index.php?

(and with this one, can I select more forums? (I dont need that currently; just interested)

THANKS ALOT!

Uuuhm.. I have another little question. Would this format be possible:


Latest news: TOPICTITLE (date - time)

"Latest News: 'Thanks cinq (12-05-2005; 14:55)'"

?

cinq
05-12-2005, 11:54 AM
Great :)

Yes you can, just use this :


$getnews = $DB_site->query_first("SELECT threadid, title FROM ".TABLE_PREFIX."thread WHERE (forumid=X OR forumid=X OR forumid=X) ORDER BY lastpost DESC LIMIT 1");

Note the OR forumid=X portions. Just add more if you need to and replace the Xs with the respective forumids of those forums you want to check.

Eagle Creek
05-12-2005, 11:58 AM
Great :)

Yes you can, just use this :


$getnews = $DB_site->query_first("SELECT threadid, title FROM ".TABLE_PREFIX."thread WHERE (forumid=X OR forumid=X OR forumid=X) ORDER BY lastpost DESC LIMIT 1");

Note the OR forumid=X portions. Just add more if you need to and replace the Xs with the respective forumids of those forums you want to check.
Coool! Thx!

And my Q about date time? Is that much more work?

cinq
05-12-2005, 12:17 PM
$getnews = $DB_site->query_first("SELECT threadid, title, lastpost FROM ".TABLE_PREFIX."thread WHERE (forumid=X OR forumid=X OR forumid=X) ORDER BY lastpost DESC LIMIT 1");
$lastpostdateline = vbdate($vboptions['dateformat'],$getnews['lastpost'],true);


Forumhome template put this :


Latest news: <a href="showthread.php?t=$getnews[threadid]">$getnews[title]</a> - $lastpostdateline

Eagle Creek
05-12-2005, 12:52 PM
Hmm... You changed something.

title FROM ".TABLE_PREFIX.
==>
title, lastpost FROM ".TABLE_PREFIX.


Why did you do that?

http://www.antispywareoffensief.nl/forum/index.php

YOU MADE AN EAGLE HAPPY!


Thank you so much! If there's something I can do for you call me!

cinq
05-12-2005, 12:56 PM
That is to capture last post datetime for that thread :)

Eagle Creek
05-12-2005, 01:20 PM
That is to capture last post datetime for that thread :)
Ok.. But when I have the following situation:

I post new thread (1) 3 PM
someone replys to that one 3.5 PM
I post new thread (2) 4 PM
someone replys to first one 4.5 PM


Thread 1 will be displayed at the index, isnt it?

Eagle Creek
05-13-2005, 08:16 PM
Is it possible to look only at the post date of the FIRST post?

Because when people now react on a two day old post it shows up on the index and it looks like a recent post..

Paul M
05-13-2005, 11:22 PM
Is it possible to look only at the post date of the FIRST post?Change "lastpost" to "dateline" in the code (all occurances).

Snake
07-02-2005, 11:12 AM
cinq, I wonder if I can add more forum IDs to get more forums for news like forumid=1,2,3,4?

Snake
08-24-2005, 04:45 PM
Please anyone?