lazzeristudios Posted July 10, 2006 Share Posted July 10, 2006 God, I hope someone here can help me. I have been at this for the better part of today. Please forgive me if I have posted this in the wrong section....Let me first say that I am a newbie with php so I hope my search for help forums has brought me to the right place. The script I am trying to use is this:------------------------------------------------[code=php:0]<?php#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-## Applet : phpBB Latest Topic Displayer# Author : Jonathan Wolf <jonathanw@hotmail.com>, M.S.# Version : v1.0 (2-20-06)# Changes : v1.0 (2-20-06): Brand new.#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-##-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-## Control Constants#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#// forum_id to grab topics from (must be a valid forum_id integer)$forum_id = 3;// How many of the newest topics to display$limit_count = 5;// Date and time format (used in PHP strftime() routine)$date_time_format = "%b %e at %I:%M %p"; // e.x. 20 Feb 12:29 am// Path to phpBB's base directory (usually "forum/" or "phpBB/")// Note: This is !required! to be set correctly for this script to work// (phpBB's include files will reference this variable many times).$phpbb_root_path = "forum/";#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-## phpBB Connection Section# This will give us a MySQL database connection ($db) to work with that# is already initialized with the correct phpBB database for access.# This also gives us some useful setup values such as the table prefix.#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#if(!defined("IN_PHPBB")){ define("IN_PHPBB", true); include($phpbb_root_path . "extension.inc"); include($phpbb_root_path . "common.".$phpEx); include($phpbb_root_path . "config.".$phpEx);}if($db) // Database connection check{ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Database Query Section #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# // Grab our topics using a singular query $topics_query = $db->sql_query(" SELECT {$table_prefix}topics.topic_title, {$table_prefix}users.username AS poster_name, {$table_prefix}topics.topic_time, {$table_prefix}posts_text.post_text AS topic_text, {$table_prefix}topics.topic_views, {$table_prefix}topics.topic_replies, {$table_prefix}topics.topic_id, {$table_prefix}posts_text.post_id, {$table_prefix}topics.topic_poster AS poster_id FROM {$table_prefix}topics, {$table_prefix}users, {$table_prefix}posts_text WHERE {$table_prefix}topics.forum_id = {$forum_id} AND {$table_prefix}users.user_id = {$table_prefix}topics.topic_poster AND {$table_prefix}posts_text.post_id = {$table_prefix}topics.topic_first_post_id ORDER BY topic_time DESC LIMIT {$limit_count};"); #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Parsing Section #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# // Topic query-result existance check and non-zero row count check if($topics_query && mysql_num_rows($topics_query)) { // Now go through all our selected topics for processing and display while($topic_entry = $db->sql_fetchrow($topics_query)) { // The first thing we have to do is pre-process some things... // The post_text needs to have its BB-code replaced with actual // HTML code, which is a bit tricky and involves some fancy foot // work. Some of the following processing code is, as mentioned, // adapted from clericvash's "Topic Extraction" script. Cheers. // Set up some easy to use variables for parsing and displaying. $topic_title = $topic_entry["topic_title"]; $poster_name = $topic_entry["poster_name"]; $topic_time = strftime($date_time_format, $topic_entry["topic_time"]); $topic_text = $topic_entry["topic_text"]; $topic_views = $topic_entry["topic_views"]; $topic_replies = $topic_entry["topic_replies"]; $topic_id = $topic_entry["topic_id"]; $post_id = $topic_entry["post_id"]; $poster_id = $topic_entry["poster_id"]; $view_link = "{$phpbb_root_path}viewtopic.{$phpEx}?p={$post_id}"; $reply_link = "{$phpbb_root_path}posting.{$phpEx}?mode=reply&t={$topic_id}"; $poster_link = "{$phpbb_root_path}profile.{$phpEx}?mode=viewprofile&u={$poster_id}"; // BB-Code processing // Extra character removal (these characters are identifiers that // are concatenated into the BB-code commands themselves in order // to help phpBB track appropriated opening and closing commands). $topic_text = preg_replace("/\:[0-9a-z\:]+\]/si", "]", $topic_text); // Bold $topic_text = str_replace("[b]", "<B>", $topic_text); $topic_text = str_replace("[/b]", "</B>", $topic_text); // Italics $topic_text = str_replace("[i]", "<I>", $topic_text); $topic_text = str_replace("[/i]", "</I>", $topic_text); // Underline $topic_text = str_replace("[u]", "<U>", $topic_text); $topic_text = str_replace("[/u]", "</U>", $topic_text); // Quote (style #1) $topic_text = preg_replace("/\[quote=(.*)\](.*)\[\/quote\]/Usi", "<DIV STYLE=\"padding: 7px\">$2</DIV>", $topic_text); // Quote (style #2) $topic_text = str_replace("[quote]", "<B>Quote:</B><BR><I>", $topic_text); $topic_text = str_replace("[/quote]", "</I>", $topic_text); // Code $topic_text = str_replace("[code]", "<B>Code:</B><BR><I>", $topic_text); $topic_text = str_replace("[/code]", "</I>", $topic_text); // List $topic_text = preg_replace("/\[list\](.*)\[\/list\]/si", "<DIV STYLE=\"padding: 7px\">$1</DIV>", $topic_text); $topic_text = preg_replace("/\[list=(.*)\](.*)\[\/list\]/si", "<DIV STYLE=\"padding: 7px\">$1</DIV>", $topic_text); // Image $topic_text = str_replace("[img]http://", "<IMG SRC=\"", $topic_text); $topic_text = str_replace("[/img]", "\" ALT=\"Image\">", $topic_text); // URL $topic_text = preg_replace("/\[url\](.*)\[\/url\]/Usi", "<A HREF=\"$1\" TARGET=\"_blank\">$1</A>", $topic_text); $topic_text = preg_replace("/\[url=http://(.*)\](.*)\[\/url\]/Usi", "<A HREF=\"$2\" TARGET=\"_blank\">$2</A>", $topic_text); // Endlines $topic_text = str_replace("\n", "<BR>\n", $topic_text); #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Displaying Section # Modify this section to your liking. Currently, this section # just contains a dummy displayer. The following variables have # been pre-initialized to help with this section, and include: # $topic_title - (text) Title of topic # $poster_name - (text) Username of original poster # $topic_time - (text) Time of post creation (converted string) # $topic_text - (text) Actual text of the topic (already in HTML) # $topic_views - (int) Number of topic views (in the forum) # $topic_replies - (int) Number of replies for topic # $topic_id - (int) Topic's id # (from database) # $post_id - (int) Post's id # (from database) # $poster_id - (int) Poster's user id # (from database) # $view_link - (text) An http link to the forum view topic page # $reply_link - (text) An http link to the forum reply-to page # $poster_link - (text) An http link to the poster's info page #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# // Head banner (poster, date) echo("<table>\n"); echo("<tr>\n"); echo("<td bgcolor=4D5459>\n"); echo("<A HREF=\"{$view_link}\" TARGET=\"_blank\">{$topic_title}</A> <br> Posted on {$topic_time}<BR>\n"); echo("</td>\n"); echo("</tr>\n"); echo("</table>\n"); } } else { // No topics exist in this forum. Display some sort of error message. echo("<P>No topics exist in the forum.<BR>\n"); }}?>[/code]-----------------------------------------------------I am trying to add this to a page I have been working on by using iframe:[code]<tr> <td bgcolor="4D5459"><br><br> <img src="images/kimscorner.gif" border="0"><br> <iframe width=245 src="grabber1.php" align=middle frameborder=0 scrolling=auto name=viewpoint></iframe></td> </tr>[/code]1st question, Is there a better way to do this?2nd question, How can I, or will someone help me to change the font color and size of the font that is displayed by the php script? ({$topic_title} & {$topic_time})3rd question, If you look at the working demo with ie there is a white bg that I cannot get rid of, but with firefox the white bg is not there. [url=http://www.midwestcheeranddance.com/index2.html]http://www.midwestcheeranddance.com/index2.html[/url] My plan is to get rid of the scroll bar and still show 5 latest topics without making the page any bigger then it is....Thanks in Advance....zach Quote Link to comment Share on other sites More sharing options...
cmgmyr Posted July 10, 2006 Share Posted July 10, 2006 1. You should try setting this up in a div and using and include instead of an iframe.2. You can change the colors in the css files that were included in your forum3. If you use a div and include it should get rid of any extra space IE is putting in there. Hope that helped.-Chris Quote Link to comment Share on other sites More sharing options...
trq Posted July 10, 2006 Share Posted July 10, 2006 There is an entrie forum dedicated to help with third party scripts, this is the wrong place to post such requests. Quote Link to comment Share on other sites More sharing options...
lazzeristudios Posted July 10, 2006 Author Share Posted July 10, 2006 [quote author=cmgmyr link=topic=100007.msg394220#msg394220 date=1152497109]1. You should try setting this up in a div and using and include instead of an iframe.2. You can change the colors in the css files that were included in your forum3. If you use a div and include it should get rid of any extra space IE is putting in there. Hope that helped.-Chris[/quote]I will try changing to a div....As far as my forums go.... this script did not come with the phpBB forums... So I do not think it is reading the css from the forums...Thankszach Quote Link to comment Share on other sites More sharing options...
lazzeristudios Posted July 10, 2006 Author Share Posted July 10, 2006 [quote author=thorpe link=topic=100007.msg394221#msg394221 date=1152497136]There is an entrie forum dedicated to help with third party scripts, this is the wrong place to post such requests.[/quote]That is why I said I was sorry if it was in the wrong area.... maybe a mod can move this to the right section for me...zach Quote Link to comment Share on other sites More sharing options...
cmgmyr Posted July 10, 2006 Share Posted July 10, 2006 When you set up the div, assign it an id and in your css make the output that you want with that id. That will over ride whatever css it is reading from now.-Chris Quote Link to comment Share on other sites More sharing options...
lazzeristudios Posted July 10, 2006 Author Share Posted July 10, 2006 [quote author=cmgmyr link=topic=100007.msg394227#msg394227 date=1152498121]When you set up the div, assign it an id and in your css make the output that you want with that id. That will over ride whatever css it is reading from now.-Chris[/quote]Yea, that is all foreign language to me..... I think I am about to throw in the white towel here... I have been looking at this code all day... I have been to 3 php help forums... and still can't figure it out... Thanks... I will check back here tomorrow..... Thanks for looking..zach Quote Link to comment Share on other sites More sharing options...
lazzeristudios Posted July 11, 2006 Author Share Posted July 11, 2006 [quote author=cmgmyr link=topic=100007.msg394227#msg394227 date=1152498121]When you set up the div, assign it an id and in your css make the output that you want with that id. That will over ride whatever css it is reading from now.-Chris[/quote]Would something like this work?[code]echo(" <span class='STYLE_NAME'><A HREF=\"{$view_link}\" TARGET=\"_blank\">{$topic_title}</A> <br> Posted on {$topic_time}</span><BR>\n");[/code]And then can I add the style in the index.html page, or do I need to actually create a [code]<style>...... </style>[/code]in the php script somewhere?zach Quote Link to comment Share on other sites More sharing options...
lazzeristudios Posted July 11, 2006 Author Share Posted July 11, 2006 To the Admins of these forums...I now know you have an area for third party script help.... please feel free to move this there.... I do not want to re-post it there and then have 2 post going...Thank Youzach Quote Link to comment Share on other sites More sharing options...
cmgmyr Posted July 11, 2006 Share Posted July 11, 2006 What you wrote first should work for you[code]echo(" <span class='STYLE_NAME'><A HREF=\"{$view_link}\" TARGET=\"_blank\">{$topic_title}</A> <br> Posted on {$topic_time}</span><BR>\n");[/code]-Chris Quote Link to comment Share on other sites More sharing options...
lazzeristudios Posted July 11, 2006 Author Share Posted July 11, 2006 [quote author=cmgmyr link=topic=100007.msg394886#msg394886 date=1152587356]What you wrote first should work for you[code]echo(" <span class='STYLE_NAME'><A HREF=\"{$view_link}\" TARGET=\"_blank\">{$topic_title}</A> <br> Posted on {$topic_time}</span><BR>\n");[/code]-Chris[/quote]Thanks.... I actually got the font and colors changed for the most part. I had to use a style tag with the values in-line....But now I can't seem to get it to work in my html document with a php include tag. Not sure what is wrong.... but now I would like to get away from using an iframe.zach Quote Link to comment Share on other sites More sharing options...
cmgmyr Posted July 11, 2006 Share Posted July 11, 2006 Instead of where you have the iframe put this:[code]<div id="top_5" style="width:100;height:100;overflow:auto;"><?php include "your_top_five_script.php"; ?></div>[/code]change the height and width to whatever you want.-Chris Quote Link to comment Share on other sites More sharing options...
lazzeristudios Posted July 12, 2006 Author Share Posted July 12, 2006 ChrisOK, this is what I have now, and it still did not work.[code]<tr> <td><br><br> <img src="images/kimscorner.gif" border="0" align="top"><br> <div id="top_5" style="width:245;height:225;overflow:auto;"><?php include "http://midwestcheeranddance.com/grabber1.php"; ?></div></td> </tr>[/code]it looks as if it has created the space, but nothing from the script is showing.Any ideas?zach Quote Link to comment Share on other sites More sharing options...
lazzeristudios Posted July 13, 2006 Author Share Posted July 13, 2006 Anyone know why this does not work?zach Quote Link to comment Share on other sites More sharing options...
lazzeristudios Posted July 14, 2006 Author Share Posted July 14, 2006 nevermind.... I just need to parse my html to php.........zach Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.