Guest Posted September 29, 2005 Posted September 29, 2005 (edited) phpbb scrolling box contribution integrates the last few posts from the forum into an infobox within your catalog in a scrolling manner. Contribution download link: http://www.oscommerce.com/community/contributions,3600 Edited September 29, 2005 by enigma1 Quote
Guest Posted October 1, 2005 Posted October 1, 2005 v1.01 is now available. Added support when the phpbb forum is outside the osc catalog. Second dbase support, instructions & file added. Quote
digigasin Posted October 1, 2005 Posted October 1, 2005 I've just installed your contribution and it works fine. Would it be possible to modify the red link (topic title) so that you end up on the topic itself instead of the forum index ? It would be fine if you can help me... thanks Quote
Guest Posted October 1, 2005 Posted October 1, 2005 Ok here is the one with the forum id included. I also added the code to strip the tags from the description as a security measure. <?php /* $Id: information.php,v 1.6 2003/02/10 22:31:00 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ $phpbb_post_query = tep_db_query("select pt.post_subject, pt.post_text, p.forum_id from phpbb_posts p left join phpbb_posts_text pt on p.post_id=pt.post_id order by pt.post_id desc limit 3"); ?> <!-- information //--> <tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_FORUM); new infoBoxHeading($info_box_contents, true, true, tep_href_link(FILENAME_BBMODULES, 'op=modload&name=phpbb2&file=index.php', 'NONSSL')); $forum_text = ''; while( $phpbb_post = tep_db_fetch_array($phpbb_post_query) ) { $post_content = strip_tags($phpbb_post['post_text']); $forum_text .= '<center><b><a href="' . tep_href_link(FILENAME_BBMODULES, 'op=modload&name=phpbb2&file=viewforum.php&f=' . $phpbb_post['forum_id'], 'NONSSL') . '">' . $phpbb_post['post_subject'] . '</a></b></center><br>' . $post_content . "\n"; $forum_text .= "<center><br />\n---------\n</center><br />" . "\n"; } $forum_text = '<MARQUEE behavior= "scroll" align= "center" direction= "up" height="160" scrollamount= "2" scrolldelay= "20" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>'.$forum_text.'</MARQUEE>' . "\n"; $info_box_contents = array(); $info_box_contents[] = array('align' => 'center', 'text' => $forum_text); new infoBox($info_box_contents); ?> </td> </tr> <!-- information_eof //--> Now this code is for the integrated forum. For the external you need to change the links and the query to access the 2nd dbase. And of course the additional dbase switch code. The header of the box (the arrow) goes to the main forums page while each post has a link to the specific forum the post is associated with. Quote
digigasin Posted October 2, 2005 Posted October 2, 2005 (edited) Thanks a lot :thumbsup: Here is another modification which enables you to directly reach the topic itself : <?php /* $Id: information.php,v 1.6 2003/02/10 22:31:00 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ $phpbb_post_query = tep_db_query("select pt.post_subject, pt.post_text, p.topic_id from phpbb_posts p left join phpbb_posts_text pt on p.post_id=pt.post_id order by pt.post_id desc limit 3"); ?> <!-- information //--> <tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_FORUM); new infoBoxHeading($info_box_contents, true, true, tep_href_link(FILENAME_BBMODULES, 'op=modload&name=phpbb2&file=index.php', 'NONSSL')); $forum_text = ''; while( $phpbb_post = tep_db_fetch_array($phpbb_post_query) ) { $post_content = strip_tags($phpbb_post['post_text']); $forum_text .= '<center><b><a href="' . tep_href_link(FILENAME_BBMODULES, 'op=modload&name=phpbb2&file=viewtopic.php&t=' . $phpbb_post['forum_id'], 'NONSSL') . '">' . $phpbb_post['post_subject'] . '</a></b></center><br>' . $post_content . "\n"; $forum_text .= "<center><br />\n---------\n</center><br />" . "\n"; } $forum_text = '<MARQUEE behavior= "scroll" align= "center" direction= "up" height="160" scrollamount= "2" scrolldelay= "20" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>'.$forum_text.'</MARQUEE>' . "\n"; $info_box_contents = array(); $info_box_contents[] = array('align' => 'center', 'text' => $forum_text); new infoBox($info_box_contents); ?> </td> </tr> <!-- information_eof //--> Edited October 2, 2005 by digigasin Quote
gregy Posted October 2, 2005 Posted October 2, 2005 thanx a lot for this one .. just what i was looking long time ago .. now to the questions .. - align everything to left? - can you validate marquee .. i guess not .. i mean is there any other option .. now when i added this infobox my page is not W3C valid beacuse of marquee :( Quote
Guest Posted October 2, 2005 Posted October 2, 2005 yes the marquee fails w3c although its supported by ff, ie, opera I think. Now if you want to replace it to have it just like the default specials box or reviews box (just the last post I mean with a link around it). To align to the left remove the <center> </center> tags. and align="center" Quote
gregy Posted October 2, 2005 Posted October 2, 2005 how about to display last 5 topics .. not text in topic ..? Quote
Guest Posted October 2, 2005 Posted October 2, 2005 (edited) yes so you modify this line: $forum_text .= '<center><b><a href="' . tep_href_link(FILENAME_BBMODULES, 'op=modload&name=phpbb2&file=viewforum.php&f=' . $phpbb_post['forum_id'], 'NONSSL') . '">' . $phpbb_post['post_subject'] . '</a></b></center><br>' . $post_content . "\n"; to $forum_text .= '<center><b><a href="' . tep_href_link(FILENAME_BBMODULES, 'op=modload&name=phpbb2&file=viewforum.php&f=' . $phpbb_post['forum_id'], 'NONSSL') . '">' . $phpbb_post['post_subject'] . '</a></b></center><br>' . "\n"; To change the number of topics retrieved change the limit 3 to limit 5 I have to put an admin setting to control this probably with the next version Edited October 2, 2005 by enigma1 Quote
Guest Posted October 3, 2005 Posted October 3, 2005 Uploaded v1.02 with the following changes: - Added phpbb tags conversion to html format for strong, quotes, links, to cover both external/internal forums. This will eliminate problems with the special forum formatting. - Added Maximum number of posts to display. Option is available in osc admin cpanel. Setting this option to 0 will disable the box. Quote
blessix Posted October 10, 2005 Posted October 10, 2005 Hello I added the contri scrolling box to my website. It does work, but when I click on the link in the scrollbox I get : "page not found", so the url isn't correct. --------------------------------------------------------------------------------------------------------------------- this is the url wich he is directing to: http://www.car-designer.nl/catalog/FILENAM...857a0da106bf85b ---------------------------------------------------------------------------------------------------------------------- And this is the page he should direct to: http://www.car-designer.nl/phpBB2/viewtopic.php?t=3 ----------------------------------------------------------------------------------------------------------------------- Has anyone any idea goes wrong???? n.b. I'm sorry for my bad language :P :P :P :P Quote
Guest Posted October 11, 2005 Posted October 11, 2005 are you using the external or internal forum version? I believe is the internal so if the forum is installed outside the catalog you will have to hard-code the directory/link. See how the phpbb_forum_external.php file sets up the link hard-coded. Quote
gregy Posted October 11, 2005 Posted October 11, 2005 yes so you modify this line: $forum_text .= '<center><b><a href="' . tep_href_link(FILENAME_BBMODULES, 'op=modload&name=phpbb2&file=viewforum.php&f=' . $phpbb_post['forum_id'], 'NONSSL') . '">' . $phpbb_post['post_subject'] . '</a></b></center><br>' . $post_content . "\n"; to $forum_text .= '<center><b><a href="' . tep_href_link(FILENAME_BBMODULES, 'op=modload&name=phpbb2&file=viewforum.php&f=' . $phpbb_post['forum_id'], 'NONSSL') . '">' . $phpbb_post['post_subject'] . '</a></b></center><br>' . "\n"; To change the number of topics retrieved change the limit 3 to limit 5 I have to put an admin setting to control this probably with the next version hi thanx for support .. but this now is only removing text from posts .. i also removed the line where it adds those lines $forum_text .= "<left><br />\n---------\n</center><br />" . "\n"; but now it shows only last post .. i would also like to remove scroll .. it mess my W3C validation thanx in advance Quote
blessix Posted October 11, 2005 Posted October 11, 2005 Tanks, :thumbsup: When I use the hard-code it works. Would it be better if I install the forum inside the catalog? I want to implement the forum in oscommerce, is this possible when it is intalled outside catalog? When i now use the link on the scroller it directs to the main page of phpbb2. I guess when i have implement it it would direct to the topic itself? Quote
Guest Posted October 11, 2005 Posted October 11, 2005 (edited) i would also like to remove scroll .. it mess my W3C validation Ok to remove the scrolling/marquee locate and remove this line of code: $forum_text = '<MARQUEE behavior= "scroll" align= "center" direction= "up" height="160" scrollamount= "2" scrolldelay= "20" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>'.$forum_text.'</MARQUEE>' . "\n"; And I did not understand the first question: but this now is only removing text from posts .. i also removed the line where it adds those lines $forum_text .= "<left><br />\n---------\n</center><br />" . "\n"; but now it shows only last post .. what you need in this case? ------------------------------------------------------------- Would it be better if I install the forum inside the catalog?I want to implement the forum in oscommerce, is this possible when it is intalled outside catalog? If your forum works my opinion is don't break it. You could add it inside the osc it will have few advantages but it maybe a pain to re-install it internally. The problem with the external forum is the session id is not maintained so customers who buy items going back/forth between shop/forum may have problems. With the internal version, sessions are maintained. Anyways if you decide to do that backup first. ok for the topic links: When i now use the link on the scroller it directs to the main page of phpbb2. I guess when i have implement it it would direct to the topic itself? Find this line of code from the internal version of the box: $forum_text .= '<center><b><a href="' . tep_href_link(FILENAME_BBMODULES, 'op=modload&name=phpbb2&file=viewforum.php&f=' . $phpbb_post['forum_id'], 'NONSSL') . '">' . $phpbb_post['post_subject'] . '</a></b></center><br>' . $post_content . "\n"; now as you see the parameters are passed here so what I am going to do is something similar for the external version where you put your forum url in a separate line so it will simplify things. I haven't test the code so backup whatever you change: Here is the modified code for the external forum: (change just the url) <?php tep_db_close(); tep_db_connect2() or die('Unable to connect to database server!'); $phpbb_post_query = tep_db_query2("select pt.post_subject, pt.post_text, p.forum_id from phpbb_posts p left join phpbb_posts_text pt on p.post_id=pt.post_id order by pt.post_id desc limit " . MAX_DISPLAY_PHPBB_BOX_POSTS); ?> <!-- external_forum //--> <tr> <td> <?php // YOUR EXTERNAL FORUM URL HERE $forum_url = "http://mysite.com/phpbb"; $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_FORUM); new infoBoxHeading($info_box_contents, true, true, '<a href="' . $forum_url . '">Forum</a>'); $forum_text = ''; while( $phpbb_post = tep_db_fetch_array($phpbb_post_query) ) { // Remove HTML tags $post_content = strip_tags($phpbb_post['post_text']); // Process PHPBB tags $post_content = phpbb_tags_to_html($post_content); $forum_text .= '<center><b><a href="' . $forum_url . 'op=modload&name=phpbb2&file=viewforum.php&f=' . $phpbb_post['forum_id'] . '">' . $phpbb_post['post_subject'] . '</a></b></center><br>' . $post_content . "\n"; } $forum_text = '<MARQUEE behavior= "scroll" align= "center" direction= "up" height="160" scrollamount= "2" scrolldelay= "20" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>'.$forum_text.'</MARQUEE>' . "\n"; $info_box_contents = array(); $info_box_contents[] = array('align' => 'center', 'text' => $forum_text); new infoBox($info_box_contents); // close the connection tep_db_close2(); tep_db_connect() or die('Unable to connect to database server!'); ?> </td> </tr> <!-- external_forum_eof //--> Just let me know if this works so I will included with the next version of the box. Edited October 11, 2005 by enigma1 Quote
gregy Posted October 11, 2005 Posted October 11, 2005 ok i removed scrolling .. what i would like to have is only showing last 5 or x topics .. only titles i.e. - topic - topic2 - topic3 you can see example at www.vstopnice.com on right (Forum) where it displays now only one topic .. cause other (unvisible lines) are replies to this topic .. but text of topic is deleted .. as i wanted .. i hope you understand now :) Quote
blessix Posted October 11, 2005 Posted October 11, 2005 Hello Thanks a lot for your reply. I tried the code, but it won?t work properly. The first time I did get a database error. (im using the same database for osc and phpbb, phpbb is instald in www.mydomein.nl/phpBB2 ond osc in www.mydomein.nl/catalog) when i remove the database connection in the beginning end at the and, and leave it the same as the original forum_phpbb.php it works, but than it gives page not found on this url http://www.car-designer.nl/phpBB2/=modload&name=phpbb2&file=viewforum.php&f=1 I changed your original code to this <?php/* $Id: information.php,v 1.6 2003/02/10 22:31:00 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ $phpbb_post_query = tep_db_query("select pt.post_subject, pt.post_text, p.forum_id from phpbb_posts p left join phpbb_posts_text pt on p.post_id=pt.post_id order by pt.post_id desc limit " . MAX_DISPLAY_PHPBB_BOX_POSTS); ?> <!-- information //--> <tr> <td> <?php $forum_url = "http://car-designer.nl/phpBB2"; $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_FORUM); new infoBoxHeading($info_box_contents, true, true, tep_href_link(FILENAME_BBMODULES, 'op=modload&name=phpbb2&file=index.php', 'NONSSL')); $forum_text = ''; while( $phpbb_post = tep_db_fetch_array($phpbb_post_query) ) { // Remove HTML tags $post_content = strip_tags($phpbb_post['post_text']); // Process PHPBB tags $post_content = phpbb_tags_to_html($post_content); $forum_text .= '<center><b><a href="' . $forum_url . 'op=modload&name=phpbb2&file=viewforum.php&f=' . $phpbb_post['forum_id'] . '">' . $phpbb_post['post_subject'] . '</a> </b></center><br>' . $post_content . "\n"; $forum_text .= "<center><br />\n---------\n</center><br />" . "\n"; } $forum_text = '<MARQUEE behavior= "scroll" align= "center" direction= "up" height="160" scrollamount= "2" scrolldelay= "20" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>'.$forum_text.'</MARQUEE>' . "\n"; $info_box_contents = array(); $info_box_contents[] = array('align' => 'center', 'text' => $forum_text); new infoBox($info_box_contents); ?> </td> </tr> <!-- information_eof //--> So I'm not sure what is going wrong Quote
Guest Posted October 11, 2005 Posted October 11, 2005 but than it gives page not found on this urlhttp://www.car-designer.nl/phpBB2/=modload...ewforum.php&f=1 Ok replace this line: $forum_text .= '<center><b><a href="' . $forum_url . 'op=modload&name=phpbb2&file=viewforum.php&f=' . $phpbb_post['forum_id'] . '">' . $phpbb_post['post_subject'] . '</a> with this: $forum_text .= '<center><b><a href="' . $forum_url . '?op=modload&name=phpbb2&f=' . $phpbb_post['forum_id'] . '">' . $phpbb_post['post_subject'] . '</a> And set your url to the viewforum page so: $forum_url = "http://www.car-designer.nl/phpBB2/viewforum.php" Let me know if this works so I could change it for the next version. The dbase connection is in case you use a separate dbase for the external forum. You also need to setup the arrow for the forum box to the correct url. So now this should be new infoBoxHeading($info_box_contents, true, true, 'http://www.car-designer.nl/phpBB2/index.php', 'NONSSL')); --------------------------------------------------------------------- ok now to have only the topic headers: replace this part of the code line: <br>' . $post_content . "\n"; with this: ' . "\n"; Now the code picks up the threads so if a response to a thread has no header it will not display. Quote
blessix Posted October 11, 2005 Posted October 11, 2005 :thumbsup: :thumbsup: :thumbsup: :thumbsup: :thumbsup: It works! THANKS A LOT I removed a ) at 'NONSSL')); For your reference hier is the total php file; <?php/* $Id: information.php,v 1.6 2003/02/10 22:31:00 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ $phpbb_post_query = tep_db_query("select pt.post_subject, pt.post_text, p.forum_id from phpbb_posts p left join phpbb_posts_text pt on p.post_id=pt.post_id order by pt.post_id desc limit " . MAX_DISPLAY_PHPBB_BOX_POSTS); ?> <!-- information //--> <tr> <td> <?php $forum_url = "http://www.YOURSITE.com/viewforum.php"; $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_FORUM); new infoBoxHeading($info_box_contents, true, true, 'http://www.YOURSITE.com/index.php', 'NONSSL'); $forum_text = ''; while( $phpbb_post = tep_db_fetch_array($phpbb_post_query) ) { // Remove HTML tags $post_content = strip_tags($phpbb_post['post_text']); // Process PHPBB tags $post_content = phpbb_tags_to_html($post_content); $forum_text .= '<center><b><a href="' . $forum_url . '?op=modload&name=phpbb2&f=' . $phpbb_post['forum_id'] . '">' . $phpbb_post['post_subject'] . '</a> </b></center><br>' . $post_content . "\n"; $forum_text .= "<center><br />\n---------\n</center><br />" . "\n"; } $forum_text = '<MARQUEE behavior= "scroll" align= "center" direction= "up" height="160" scrollamount= "2" scrolldelay= "20" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>'.$forum_text.'</MARQUEE>' . "\n"; $info_box_contents = array(); $info_box_contents[] = array('align' => 'center', 'text' => $forum_text); new infoBox($info_box_contents); ?> </td> </tr> <!-- information_eof //--> Once again, thanks Quote
gregy Posted October 11, 2005 Posted October 11, 2005 (edited) already deleted that string .. but still appears "blank lines" $phpbb_post_query = tep_db_query("select pt.post_subject, pt.post_text, p.forum_id from phpbb_posts p left join phpbb_posts_text pt on p.post_id=pt.post_id order by pt.post_id desc limit 5"); ?> <!-- information //--> <tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_FORUM); new infoBoxHeading($info_box_contents, false, false, false, $column_location); $forum_text = ''; while( $phpbb_post = tep_db_fetch_array($phpbb_post_query) ) { $post_content = strip_tags($phpbb_post['post_text']); $forum_text .= '<b><a href="' . tep_href_link(FILENAME_BBMODULES, 'op=modload&name=phpbb2&file=viewforum.php&f=' . $phpbb_post['forum_id'], 'NONSSL') . '">' . $phpbb_post['post_subject'] . '</a></b>' . "\n"; } $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => $forum_text); new infoBox($info_box_contents); ?> </td> </tr> <!-- information_eof //--> now only one topic subject appears? :wacko: Edited October 11, 2005 by gregy Quote
Guest Posted October 11, 2005 Posted October 11, 2005 ok the blank lines take place because no subject is entered on a reply. So in that case I moded the code to pickup the topic title. 2 changes needed. 1. Replace the sql query to this: $phpbb_post_query = tep_db_query("select pt.post_subject, pt.post_text, p.forum_id, t.topic_title from phpbb_posts p left join phpbb_posts_text pt on p.post_id=pt.post_id left join phpbb_topics t on t.topic_id=p.topic_id order by pt.post_id desc limit " . MAX_DISPLAY_PHPBB_BOX_POSTS); 2. Just below this line of code: while( $phpbb_post = tep_db_fetch_array($phpbb_post_query) ) { add this: if( !strlen($phpbb_post['post_subject']) ) $phpbb_post['post_subject'] = $phpbb_post['topic_title']; Quote
gregy Posted October 11, 2005 Posted October 11, 2005 hmm .. this MAX_DISPLAY_PHPBB_BOX_POSTS is not doing well .. this variable is not added anywhere in language file ... Quote
Guest Posted October 11, 2005 Posted October 11, 2005 Its in the new version of the module, it is stored in the dbase, you could try a number there like 3. Quote
gregy Posted October 11, 2005 Posted October 11, 2005 yes it works ... but now it shows i.e. topic1 topic1 topic2 topic3 topic3 topic3 depends on how many replies there is for a topic :( Quote
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.
Note: Your post will require moderator approval before it will be visible.