PDA

View Full Version : Need Hack : lat 10 posts in a marquee


charsima
08-28-2001, 10:36 AM
I need the hack that shows the last 10 posts in a marquee at the top of the forum .

Does anyone know from where to get it ?

Admin
08-28-2001, 05:15 PM
I'm already working on this. :)

Admin
08-28-2001, 05:35 PM
Add this code in your phpinclude template:
$latestposts=$DB_site->query("SELECT postid,LEFT(pagetext,20) AS text FROM post ORDER BY dateline DESC LIMIT 10");
while ($latestpost=$DB_site->fetch_array($latestposts)) {
if ($marquee) {
$marquee .= "  "; // String to seperate between each link
}
$marquee .= "<a href=\"showthread.php?s=$session[sessionhash]&postid=$latestpost[postid]\">$latestpost[text] ...</a>"; // Link and text for post
}
Now you can use $marquee in your marquee tag for the content.
This will only select the first 20 characters of the post, and add ... after it (with a link to the post).

webhost
08-30-2001, 06:52 PM
Is it possible to use this on a non vb page?

Admin
08-30-2001, 06:56 PM
Create this page as marquee.php
<?php

error_reporting(7);

require("./global.php");

$latestposts=$DB_site->query("SELECT postid,LEFT(pagetext,20) AS text FROM post ORDER BY dateline DESC LIMIT 10");
while ($latestpost=$DB_site->fetch_array($latestposts)) {
if ($marquee) {
$marquee .= "&nbsp;&nbsp;"; // String to seperate between each link
}
$marquee .= "<a href=\"showthread.php?s=$session[sessionhash]&postid=$latestpost[postid]\">$latestpost[text] ...</a>";
}
?>
<marquee-code-here value="<? echo("$marquee"); ?>">
and put it in your forum's root.

Now just use SSI to include it
<!--#include file="vbb/marquee.php"-->
and also change the actually code for the marquee as I don't know it.

webhost
08-31-2001, 07:24 PM
Great Hack Firefly.

Need an addon if possible.

I would like to for example exclude forumid 14, 43, 87 from the marquee.How would I do this?

Admin
09-01-2001, 05:43 AM
Try this code
<?php

error_reporting(7);

require("./global.php");

$latestposts=$DB_site->query("SELECT postid,LEFT(pagetext,20) AS text FROM post WHERE forumid<>14 AND forumid<>43 AND forumid<>87 ORDER BY dateline DESC LIMIT 10");
while ($latestpost=$DB_site->fetch_array($latestposts)) {
if ($marquee) {
$marquee .= "&nbsp;&nbsp;"; // String to seperate between each link
}
$marquee .= "<a href=\"showthread.php?s=$session[sessionhash]&postid=$latestpost[postid]\">$latestpost[text] ...</a>";
}
?>
<marquee-code-here value="<? echo("$marquee"); ?>">

I think that's it... try it. :)

webhost
09-01-2001, 11:06 AM
error with this. it worker before I made the change to exclude forums.

<b>Warning</b>: Cannot add header information - headers already sent by (output started at /home/realweb/public_html/marquee.php:13) in <b>/home/realweb/public_html/forums/admin/functions.php</b> on line <b>1486</b><br>

<!-- Database error in vBulletin: Invalid SQL: SELECT postid,LEFT(pagetext,20) AS text FROM post WHERE forumid<>45 AND forumid<>30 AND forumid<>33 AND forumid<>93 AND forumid<>40 AND forumid<>41 AND forumid<>38 AND forumid<>39 AND forumid<>42 AND forumid<>43 AND forumid<>46 AND forumid<>54 AND forumid<>48 AND forumid<>61 AND forumid<>50 AND forumid<>51 AND forumid<>52 AND forumid<>53 AND forumid<>55 AND forumid<>56 AND forumid<>57 AND forumid<>58 AND forumid<>59 AND forumid<>60 AND forumid<>62 AND forumid<>75 AND forumid<>70 AND forumid<>72 AND forumid<>69 AND forumid<>67 AND forumid<>68 AND forumid<>71 AND forumid<>76 AND forumid<>77 AND forumid<>78 AND forumid<>79 AND forumid<>80 AND forumid<>81 AND forumid<>82 AND forumid<>83 AND forumid<>90 AND forumid<>91 AND forumid<>88 AND forumid<>89 AND forumid<>92 ORDER BY dateline DESC LIMIT 10
mysql error: Unknown column 'forumid' in 'where clause'
mysql error number: 1054
Date: Saturday 01st of September 2001 06:04:47 AM
Script: /marquee.php
Referer:
-->
</td></tr></table>
<p>There seems to have been a slight problem with the database.
Please try again by pressing the refresh button in your browser.</p>An E-Mail has been dispatched to our <a href="mailto:support@realwebhost.net">Technical Staff</a>, who you can also contact if the problem persists.</p><p>We apologise for any inconvenience.</p><pre>

Database error in vBulletin: Invalid SQL: SELECT postid,LEFT(pagetext,20) AS text FROM post WHERE forumid<>45 AND forumid<>30 AND forumid<>33 AND forumid<>93 AND forumid<>40 AND forumid<>41 AND forumid<>38 AND forumid<>39 AND forumid<>42 AND forumid<>43 AND forumid<>46 AND forumid<>54 AND forumid<>48 AND forumid<>61 AND forumid<>50 AND forumid<>51 AND forumid<>52 AND forumid<>53 AND forumid<>55 AND forumid<>56 AND forumid<>57 AND forumid<>58 AND forumid<>59 AND forumid<>60 AND forumid<>62 AND forumid<>75 AND forumid<>70 AND forumid<>72 AND forumid<>69 AND forumid<>67 AND forumid<>68 AND forumid<>71 AND forumid<>76 AND forumid<>77 AND forumid<>78 AND forumid<>79 AND forumid<>80 AND forumid<>81 AND forumid<>82 AND forumid<>83 AND forumid<>90 AND forumid<>91 AND forumid<>88 AND forumid<>89 AND forumid<>92 ORDER BY dateline DESC LIMIT 10
mysql error: Unknown column 'forumid' in 'where clause'
mysql error number: 1054
Date: Saturday 01st of September 2001 06:04:47 AM
Script: /marquee.php
Referer:


</pre>

Stasik
09-01-2001, 12:04 PM
there is no forumsid column in post table :( we have to search in tread table with threadid, but i dont know how to do in in mySQL :(

Admin
09-01-2001, 12:07 PM
Yeah you're right.

I'll see if I can do this...

Stasik
09-01-2001, 12:11 PM
we have to check ther threadid in thread table and get the forumid from there

ozone2000
09-01-2001, 07:11 PM
FireFly, can you make it look like this:
http://www.dynamicdrive.com/dynamicindex2/crosstick.htm
... then that'll be cool!

WebMasterAJ
09-03-2001, 01:17 PM
How would you make it show just the thread, and not the posts?

Other than that, this is pretty cool :)

Admin
09-03-2001, 01:31 PM
webhost:
<?php

error_reporting(7);

require("./global.php");

$latestposts=$DB_site->query("SELECT post.postid AS id,LEFT(post.pagetext,20) AS text FROM post LEFT JOIN thread ON thread.threadid WHERE thread.forumid<>14 AND thread.forumid<>43 AND thread.forumid<>87 GROUP BY post.postid ORDER BY post.dateline DESC LIMIT 10");
$marquee = "";
while ($latestpost=$DB_site->fetch_array($latestposts)) {
if ($marquee) {
$marquee .= "&nbsp;&nbsp;"; // String to seperate between each link
}
$marquee .= "<a href=\"showthread.php?s=$session[sessionhash]&postid=$latestpost[id]\">$latestpost[text] ...</a>";
}
?>
<? echo("$marquee"); ?>

(working)

WebMasterAJ
09-03-2001, 01:45 PM
hmmm... thanks, but for some reason its not showing the title of the thread, it just shows ...

Any ideas?

Admin
09-03-2001, 02:00 PM
AJ, I don't understand. You want the latest 10 threads' titles to be displayed?
If so, use this:
<?php

error_reporting(7);

require("./global.php");

$latestposts=$DB_site->query("SELECT threadid,title FROM thread ORDER BY dateline DESC LIMIT 10");
$marquee="";
while ($latestpost=$DB_site->fetch_array($latestposts)) {
if ($marquee) {
$marquee .= "&nbsp;&nbsp;"; // String to seperate between each link
}
$marquee .= "<a href=\"showthread.php?s=$session[sessionhash]&threadid=$latestpost[threadid]\">$latestpost[title] ...</a>";
}
?>
<marquee-code-here value="<? echo("$marquee"); ?>">

WebMasterAJ
09-03-2001, 02:06 PM
AWESOME... thanks :)

Admin
09-03-2001, 02:07 PM
No problem. :)

ozone2000:
I'll get to you when I fix webhost's version. :)

webhost
09-03-2001, 04:03 PM
Firefly

I get this error now

Database error in vBulletin: Invalid SQL: SELECT post.postid,LEFT(post.pagetext,20) FROM post LEFT JOIN thread ON thread.threadid WHERE thread.forumid<>30 AND thread.forumid<>33 AND thread.forumid<>38 ORDER BY post.dateline DESC LIMIT 10
mysql error: Got error 28 from table handler
mysql error number: 1030
Date: Monday 03rd of September 2001 10:51:55 AM
Script: /marquee.php
Referer:

Admin
09-03-2001, 06:01 PM
That's wierd, it's working perfect for me. :confused:

Admin
09-03-2001, 06:03 PM
Bah:
http://www.vbulletin.com/forum/showthread.php?s=&threadid=25820

Stasik
09-03-2001, 06:04 PM
can u show me working php page?

Admin
09-03-2001, 06:11 PM
Yeah sure.
What version do you want?

Stasik
09-03-2001, 06:17 PM
203

Stasik
09-03-2001, 06:18 PM
i mean this **** with executed forums

Admin
09-03-2001, 06:28 PM
Ok I'm gonna guess you want what webhost wants:
http://forum.t-cove.com/hack.php
http://forum.t-cove.com/hack.phps (for the source, but without color - stupid host)

Stasik
09-03-2001, 06:32 PM
:eek: oh my god.....


i`m going down for debug now :(

Admin
09-03-2001, 06:35 PM
Why?
Is there something wrong with your board?

Stasik
09-03-2001, 06:47 PM
i`ll fix it i hope

webhost
09-03-2001, 07:14 PM
Firefly

this is what I have, GO here http://forums.realwebhost.net/marquee.php
problem somewhere


<?php

error_reporting(7);

chdir("/home/realweb/public_html/forums/");
require("./global.php");


$latestposts=$DB_site->query("SELECT post.postid AS id,LEFT(post.pagetext,20) AS text FROM post LEFT JOIN thread ON thread.threadid WHERE thread.forumid<>33 AND thread.forumid<>30 AND thread.forumid<>38 GROUP BY post.postid ORDER BY post.dateline DESC LIMIT 10");
$marquee = "";
while ($latestpost=$DB_site->fetch_array($latestposts)) {
if ($marquee) {
$marquee .= "&nbsp;&nbsp;"; // String to seperate between each link
}
$marquee .= "<a href=\"showthread.php?s=$session[sessionhash]&postid=$latestpost[id]\">$latestpost[text] ...</a>";
}
?>
<? echo("$marquee"); ?>



GET this error still

Database error in vBulletin: Invalid SQL: SELECT post.postid,LEFT(post.pagetext,20) FROM post LEFT JOIN thread ON thread.threadid WHERE thread.forumid<>30 AND thread.forumid<>33 AND thread.forumid<>38 ORDER BY post.dateline DESC LIMIT 10
mysql error: Got error 28 from table handler
mysql error number: 1030
Date: Monday 03rd of September 2001 01:58:08 PM
Script: /marquee.php
Referer:

Admin
09-04-2001, 10:52 AM
Like I said:
[QUOTE]Originally posted by FireFly
Bah:
http://www.vbulletin.com/forum/showthread.php?s=&threadid=25820