A Digital Age Deserves A Digital Leader

php or Javascript question

php or Javascript question

Postby gries818 » Thu Jan 25, 2007 11:13 pm

Is there a way to display the most recent posts from a blog and a forum on the main page of a website using php or javascript??? Preferably PHP but anything that works would be a help.

Thanks.
Image

Mac OS 10.6.7 - Personal
Ubuntu Server 11.04 - Server
Software Development
User avatar
Posts: 3991
Joined: Wed Jul 07, 2004 6:28 pm

Postby toxic chicken » Fri Jan 26, 2007 12:53 am

yeah, with php you can access the database and search for the newest posts.
PRO Level 5
Posts: 196
Joined: Thu Apr 20, 2006 9:18 am
Location: nowhere, washington.

Postby gries818 » Fri Jan 26, 2007 2:49 am

i know that its possible but i don't know how to do it.
Image

Mac OS 10.6.7 - Personal
Ubuntu Server 11.04 - Server
Software Development
User avatar
Posts: 3991
Joined: Wed Jul 07, 2004 6:28 pm

Postby gries818 » Fri Jan 26, 2007 9:50 pm

anything?
Image

Mac OS 10.6.7 - Personal
Ubuntu Server 11.04 - Server
Software Development
User avatar
Posts: 3991
Joined: Wed Jul 07, 2004 6:28 pm

Postby jbullard » Sat Jan 27, 2007 3:52 am

What forum application are you running on your server? The easiest way to do it is to basically use the forum connection and style programming in order to set it up the way you want it. Let me know and I can have some code up pretty quick.

Jason
VP - Software
User avatar
Posts: 3653
Joined: Sun Jun 06, 2004 10:17 pm
Location: Utah
Real Name: Jason Bullard

Postby gries818 » Sat Jan 27, 2007 5:31 am

thanks man! I'm running phpBB 2.2 or whatever the most recent release is and wordpress 2.1.

:notworthy ^*^
Image

Mac OS 10.6.7 - Personal
Ubuntu Server 11.04 - Server
Software Development
User avatar
Posts: 3991
Joined: Wed Jul 07, 2004 6:28 pm

Postby gries818 » Mon Jan 29, 2007 9:40 pm

jbullard, hows this coming?
Image

Mac OS 10.6.7 - Personal
Ubuntu Server 11.04 - Server
Software Development
User avatar
Posts: 3991
Joined: Wed Jul 07, 2004 6:28 pm

Postby jbullard » Mon Jan 29, 2007 11:45 pm

Sorry man. Been busy with VBP lately.

Alright. To display the forums most recent posts on Wordpress sidebar you can use <a href="http://love-unlimited.net/test/downloads/wp-phpbb/wp-phpbb-files.zip" target="_blank">this</a>.

If that is not what you needed you first need to create a connection to the SQL database (hopefully mysql) by using <a href="http://www.pro-networks.org/forum/viewtopic.php?t=68406&highlight=" target="_blank">this</a> tutorial or you could include the phpbb db files and use it's connection.

Then you need to do something like this.

Code: Select all
<?

require("dbconfig.php");
require("db/connection.php");

/* PHPBB Topics Table */
$PHPBB_TOPICS_TB = "phpbb_topics";

/* Return Limit */
$POST_LIMIT = 10;

$rPosts = $db->dbQuery("SELECT * FROM ". $PHPBB_TOPICS ." ORDER BY topic_last_post_id DESC LIMIT ". $POST_LIMIT .";");

While ($row = $db->dbFetchRowArray($rPosts)) {
$recent_post = '<a href="viewtopic.php?t='. $rPosts["topic_id"] .'">'. $rPosts["topic_title"] .'</a>';

echo $recent_post;

}

?>


I will have to get some code for wordpress and if the above doesn't work let me know.

HTH,
Jason
VP - Software
User avatar
Posts: 3653
Joined: Sun Jun 06, 2004 10:17 pm
Location: Utah
Real Name: Jason Bullard

Postby gries818 » Tue Jan 30, 2007 1:38 am

thanks man! :notworthy
Image

Mac OS 10.6.7 - Personal
Ubuntu Server 11.04 - Server
Software Development
User avatar
Posts: 3991
Joined: Wed Jul 07, 2004 6:28 pm

Postby gries818 » Tue Feb 13, 2007 9:14 pm

i finally got around to actually doing this (mostly because I finished by site design today) and it appears from your guide there is no db/connection.php or dbconfig.php.

I thought maybe dbconfig was the the same as db.php (where we told the path to the database we want to access) so I changed that. Code still didn't work so I changed db/connection.php to mysql.php - just because I thought that might work.

Still nothing though...
Image

Mac OS 10.6.7 - Personal
Ubuntu Server 11.04 - Server
Software Development
User avatar
Posts: 3991
Joined: Wed Jul 07, 2004 6:28 pm

Next

Return to HTML, CSS, and Scripts

Who is online

Users browsing this forum: No registered users and 9 guests

cron
cron