MyBB Community Forums

Full Version: Displaying News on Homepage
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12
k776 Wrote:Hello. An update. I'm still working on this (not as fast as before). I got everything except badword filter and smilies working. Just need permission from Chris to release it now (since its redistributing a decompiled functions_post.php file).

Thats great I will keep checking for it.
Well I have tried that script and it shows but what I want is to get the latest 10 topics on only the forums , I have removed the fidid and now it shows all the forums latest topic so I was wondering how can I limit it ?
any solutions guys?
Excellent I don't remember which one I used but it works great. The one I use doesn't make smileys show up.
How can I show my Active Topics like this:

[Image: naamloos0nn.th.gif]

Can you help me making a code?

Thanks a lot in advance.
Re: parsing message properly

some steps may not be neccessary due to the way my site was setup, might be different from yours (and yours can be simpler/more complicated)

here, i will assume your forum is in the folder called "mybb" and your site is in a folder parallel to that folder.

1) make a copy of "mybb/inc/init.php" and "mybb/global.php".
2) place them in the folder where your site is (i'm assuming your forums and main site are on different folders)
3) modify copied global so it links to the copied init.php
FROM: require "./inc/init.php";
TO: require "init.php";
4) modify copied init.php so it links to the old files located in the /mybb folder
FROM: require "./inc/class_core.php";
TO: require "../mybb/inc/class_core.php";

there are tons of this in this file, you will have to change them all.
5) now add these lines of code to your site
require_once ("global.php");
require_once("../mybb/inc/functions_post.php");

6) Do the database access codes given earlier in this thread. NOTE: now that you have included all those stuff, you can use mybb's DB wrapper class ($db)

7) before you echo the message, apply this function into it

$message[post] = postify($message[post], $allowhtml="yes", $allowmycode="yes", $allowsmilies="yes", $allowimgcode="yes", $archive=0);

that should do it
I get this:


Warning: Cannot modify header information - headers already sent by (output started at /usr/local/psa/home/vhosts/owiosa1.nl/subdomains/fearless/httpdocs/forum.php:3) in /usr/local/psa/home/vhosts/owiosa1.nl/subdomains/fearless/httpdocs/forum/inc/functions.php on line 802
you need to do this

require_once ("global.php");
require_once("../mybb/inc/functions_post.php");

before you do any outputs on your own scripts/pages
so if you put it on the very top of your pages, you should be good.
<?php
require_once ("global.php");
require_once("../mybb/inc/functions_post.php");


$mysqlhost = "**";
$mysqlusername = "**";
$mysqlpassword = "**";
$mysqldbselect = "mysql";
$prefix = "mybb_";
$fid = "2";

mysql_select_db($mysqldbselect, mysql_connect($mysqlhost,$mysqlusername,$mysqlpassword));

$message[post] = postify($message[post], $allowhtml="yes", $allowmycode="yes", $allowsmilies="yes", $allowimgcode="yes", $archive=0);

$query = mysql_query("SELECT t.tid,t.subject,t.uid,t.username,t.replies,p.message FROM ".$prefix."threads t LEFT JOIN ".$prefix."posts p ON (t.tid = p.tid) WHERE t.fid='".$fid."' AND t.visible='1' AND t.closed NOT LIKE 'moved|%'") or die(mysql_error());
while($news = mysql_fetch_array($query))
{
echo "<a href=\"./forum/showthread.php?tid=".$news['tid']."\">".$news['subject']."</a> | Posted by: <a href=\"./forum/member.php?action=profile&amp;uid=".$news['uid']."\">".$news['username']."</a> | Replies: <a href=\"./forum/showthread.php?tid=".$news['tid']."\">".$news['replies']."</a><hr />".$news['message']."<br /><br />";
}
?>

saved this as forum.php
opend it in firefox I get this:


Warning: main(): open_basedir restriction in effect. File(../mybb/inc/functions_post.php) is not within the allowed path(s): (/usr/local/psa/home/vhosts/owiosa1.nl/subdomains/fearless/httpdocs:/tmp) in /usr/local/psa/home/vhosts/owiosa1.nl/subdomains/fearless/httpdocs/forum.php on line 3

Warning: main(../mybb/inc/functions_post.php): failed to open stream: Operation not permitted in /usr/local/psa/home/vhosts/owiosa1.nl/subdomains/fearless/httpdocs/forum.php on line 3

Fatal error: main(): Failed opening required '../mybb/inc/functions_post.php' (include_path='.:/usr/local/psa/apache/share/pear') in /usr/local/psa/home/vhosts/owiosa1.nl/subdomains/fearless/httpdocs/forum.php on line 3
remember that the paths i used where just an example (../mybb/), you need to update it based on your folder structure relative to your script and the forum files.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12