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
My Code:

<?php
require_once ("global.php");
require_once("./forum/inc/functions_post.php");

$limit = 5; // The amount of annoucements to show


$mysqlhost = "***";
$mysqlusername = "***";
$mysqlpassword = "***";
$mysqldbselect = "***";
$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 = $db->query("
	SELECT t.tid,t.subject
	FROM mybb_threads t	LEFT JOIN mybb_posts p ON (t.tid = p.tid)
	WHERE t.fid=2
	AND t.visible=1
	AND t.closed NOT LIKE 'moved|%'
	ORDER BY t.dateline DESC
	LIMIT $limit")
or die($db->error());
while($news = $db->fetch_array($query))
{
echo "<p class=\"topics\"><a href=\"./forum/showthread.php?tid=".$news['tid']."\" target=\"_blank\">".$news['subject']."</a></p>";
}
?>

I've paste this into my stylesheet.css:

}
.topics {
padding-left: 25px;
font-size: 9pt;
font-family: Trebuchet MS;
}
.topics a {
color: #91E902;
text-decoration: none;
}
.topics a:active {
color: #F5F5F5;
}
.topics a:visited {
color: #F5F5F5;
}

But it's still not using class topics
hey

Quote:.topics {
padding-left: 25px;
font-size: 9pt;
font-family: Trebuchet MS;
}
.topics a {
color: #91E902;
text-decoration: none;
}
.topics a:active {
color: #F5F5F5;
}
.topics a:visited {
color: #F5F5F5;
}

Css Attributes are not to be put in sylesheet.css but in the Theme manager under Additional CSS attributes, as u have global.php included Smile

regards
Don't understand that

But why is this not working?
echo "<p style=\"padding-left: 25px; font-size: 9pt; font-family: Trebuchet MS; a {color: #91E902; text-decoration: none;} a:active {color: #F5F5F5;} a:visited {color: #F5F5F5;}\"><a href=\"./forum/showthread.php?tid=".$news['tid']."\" target=\"_blank\">".$news['subject']."</a></p>";

only padding, fonsize an fontfamily is working
u are using css attributes inside the P tag!! which is impossible.
so have u tried what i have mentioned ??
regards
heloo there

replace echo by this

echo "<span class=\"topics\"><a href=\"./forum/showthread.php?tid=".$news['tid']."\" target=\"_blank\">".$news['subject']."</a></span>"; 

and umm just to clean up ur css remove that uneeded } in the 1st line of the css attributeSmile


regards
It's not working.
with <p></p> it shows off like this:
[Image: 12bu.gif]

and with <span></span>
[Image: 26vg.gif]
Chadwick Wrote:I want to use my own homepage, and put news from MyBB on it. Anyone wanna help?

Here is the page

http://www.techtabs.com/index.php

(I have tried and failed Sad)

Looks like the entire board has switched over to IPB.

Did you just give up in MyBB?? What happened???

- Dan
With div it shows off like this:
[Image: 37ce.jpg]
Can anyone help me?
Pages: 1 2 3 4 5 6 7 8 9 10 11 12