Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Box scroll with last topic from a phpBB


Guest

Recommended Posts

Posted

How i make a box scroll with last topic from a phpBB i have installed a topics extractor in my phpBB it work in a normal php page but i dont know how insert it in a box of OS please help me!

Bye

  • Replies 50
  • Created
  • Last Reply
Posted

you will have to access the dbase, table "phpbb_posts_text" then retrieve the last entry and load it into your box.

Posted
you will have to access the dbase, table "phpbb_posts_text" then retrieve the last entry and load it into your box.

 

 

I have the file that i can extract the topics it's a php file.

I most create a box with this "include ('topic.php') but when i make a box with this code i see an error in my os!!

Why??

Posted

Allright, can you post the php code of this box? Should be fairly simple to just retrieve the last post entry.

Posted

I've try this but don't work!!!!! :(

<?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
*/
?>
<!-- information //-->
	  <tr>
		<td>
<?php

 include('topic.php');

?>
		</td>
	  </tr>
<!-- information_eof //-->

Posted

the box is empty just includes this topic.php file. Post the topic.php lets see if the necessary code is there.

Posted

My friend thanks for contrib, but it no Work because i have the my root in this order:

/Catalog

/phpBB2

 

I see this error: 1146 - Table 'db_1.phpbb_posts_text' doesn't exist

 

select post_subject, post_text from phpbb_posts_text order by post_id desc limit 3

 

I not have on same DB the forum not is integrated with OS.

Bye

Posted

Well if its on a different directory its still fine. If you do not have the phpbb dbase integrated with the osc however I don't know because I don't know the specifics of the dbase. This will work with the phpbb osc integration contribution. So double check with the phpmyadmin if the phpbb_posts_text table is in the dbase or another name like phpbb2_posts_text.

 

I mean if you have it in different directory it doesn't matter the dbase difference will be the problem but perhaps its only the table naming that is incorrect here.

Posted

But if you help me with ad only infobox that it recalls the file and show it?

i make it but in the index of my OS i see a dql error in top page, but i see the topics of my forum!!

Posted

get phpmyadmin and post the structure of the table. You will also have to change the links eventually since the forum is outside your catalog. However the display will work as long as the data base table is the correct one

 

What is the name of the dbase table for the phpbb version you have?

Probably should look like phpbb_posts_text So you will have to post the columns from that table.

(like post_id etc)

Posted

This is the structure of phpbb_posts_text:

 

 

post_id mediumint(8) No 0

bbcode_uid varchar(10) No

post_subject varchar(60) YES NULL

post_text text YES NULL

Posted

ok do you have a url I can see the problem? The box has this line of code that expects a valid link so maybe is the reason:

 

$forum_text .= '<center><b><a href="' . tep_href_link(FILENAME_BBMODULES, 'op=modload&name=phpbb2&file=index.php', 'NONSSL') . '">' . $phpbb_post['post_subject'] . '</a></b></center><br>' . $phpbb_post['post_text'] . "\n";

 

because that works if you have the forum integrated with the osc so try changing it to this for the different place you have your forum (change the yoursite to a valid path):

 

$forum_text .= '<center><b><a href="http://www.yoursite.com">' . $phpbb_post['post_subject'] . '</a></b></center><br>' . $phpbb_post['post_text'] . "\n";

Posted

My friend not work, the code seek the dbase of the my OS and no of my forum:

1146 - Table 'DB_1.phpbb_posts_text' doesn't exist

 

select post_subject, post_text from phpbb_posts_text order by post_id desc limit 3

 

I have the my forum on db_3 .

i have tried with www.mysite.com/catalog not work!!!

 

I ask that your contrib it's ok for integration, but for external forum!!!

I see this in the contrib "Special thanks to Stew aka exhaust for the suggestion."

Thank you but i cant use it. :(

Posted

Then you will have to connect to the other dbase. And i don't know how, since its not osc specific... and will be very specific to your shop (Because you will have to specify the database, username, password stuff like that since you try to access an external forum from osc, so I cannot help there).

 

Ok now you will have to do a bit of extra work to have the external forum working with your configuration.

 

1. Create an additional set od dbase definitions in your catalog\includes\configure.php

  define('DB_SERVER2', 'db3'); // eg, localhost - should not be empty for productive servers
 define('DB_SERVER_USERNAME2', 'yourusername2');
 define('DB_SERVER_PASSWORD2', 'yourpassword2');
 define('DB_DATABASE2', 'db_3');

 

2. Create a 2nd set of functions in the includes\functions\database.php for the connection & access details

  function tep_db_connect2($server = DB_SERVER2, $username = DB_SERVER_USERNAME2, $password = DB_SERVER_PASSWORD2, $database = DB_DATABASE2, $link2 = 'db_link2') {
global $$link2;

if (USE_PCONNECT == 'true') {
  $$link2 = mysql_pconnect($server, $username, $password);
} else {
  $$link2 = mysql_connect($server, $username, $password);
}

if ($$link2) mysql_select_db($database);

return $$link2;
 }

 function tep_db_close2($link2 = 'db_link2') {
global $$link2;

return mysql_close($$link2);
 }

 function tep_db_query2($query, $link2 = 'db_link2') {
global $$link2;

$result = mysql_query($query, $$link2) or tep_db_error($query, mysql_errno($$link2), mysql_error($$link2));

return $result;
 }

 

3. Then in the box connect to the 2nd dbase just before the query:

 

tep_db_connect2() or die('Unable to connect to database server!');

$phpbb_post_query = tep_db_query.............

 

and at the end just after the new infobox.... close the connection

tep_db_close2()

 

Modify the query to use tep_db_query2 so it will use the correct handle for the dbase.

 

I would had use the same set of functions for the 2nd connection but I haven't examined all possibilities so its better to duplicate the functions at this stage.

 

Thank you but i cant use it.

 

maybe now its possible? :D

Posted

My friend i'm not understand this!

 

3. Then in the box connect to the 2nd dbase just before the query:

 

tep_db_connect2() or die('Unable to connect to database server!');

$phpbb_post_query = tep_db_query.............

 

and at the end just after the new infobox.... close the connection

tep_db_close2()

 

Modify the query to use tep_db_query2 so it will use the correct handle for the dbase.

Posted

ok my friend it's ok the scroll work, but i see in top page on the lefth column the same error message

"close the connection tep_db_close2() 1146 - Table 'DB_3.products' doesn't exist

 

select products_id, products_image, products_tax_class_id, products_price from products where products_status = '1' order by products_date_added desc limit 10"

 

I see the scroll ! and it work!

 

This is the file phpbb_forum.php that i have modified

 

<?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

*/

 

tep_db_connect2() or die('Unable to connect to database server!');

$phpbb_post_query = tep_db_query("select post_subject, post_text from phpbb_posts_text order by 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) ) {

$forum_text .= '<center><b><a href="' . tep_href_link(FILENAME_BBMODULES, 'op=modload&name=phpbb2&file=index.php', 'NONSSL') . '">' . $phpbb_post['post_subject'] . '</a></b></center><br>' . $phpbb_post['post_text'] . "\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>

close the connection

tep_db_close2()

<!-- information_eof //-->

Posted

Ok there are 2 things.

 

1. The close connection has to be inside the php block so:

 

Change this:

?>
</td>
</tr>
close the connection
tep_db_close2()
<!-- information_eof //-->

 

To this:

// close the connection
tep_db_close2()
?>
</td>
</tr>
<!-- information_eof //-->

 

2. the links for the box have to point to your forum. I dont know the url/directory you have your forum in

 

Change this:

$forum_text .= '<center><b><a href="' . tep_href_link(FILENAME_BBMODULES, 'op=modload&name=phpbb2&file=index.php', 'NONSSL') . '">' . $phpbb_post['post_subject'] . '</a></b></center><br>' . $phpbb_post['post_text'] . "\n";

 

To this: (but include the url of the forum, sub-directory, parameters etc)

$forum_text .= '<center><b><a href="http://www.yourforumurlsitehere.com">' . $phpbb_post['post_subject'] . '</a></b></center><br>' . $phpbb_post['post_text'] . "\n";

Posted

I still see the close code outside the php block. Have you made the modifications and uploaded the modified file to your server?

 

This error on the top left

 

close the connection tep_db_close2() 1146 - Table 'Sql77700_3.products' doesn't exist

 

select products_id, products_image, products_tax_class_id, products_price from products where products_status = '1' order by products_date_added desc limit 10

Posted

This is the code

 

 

<?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
*/

 tep_db_connect2() or die('Unable to connect to database server!');
$phpbb_post_query = tep_db_query("select post_subject, post_text from phpbb_posts_text order by 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) ) {
 $forum_text .= '<center><b><a href="http://www.needforexhaust.com/phpBB2">' . $phpbb_post['post_subject'] . '</a></b></center><br>' . $phpbb_post['post_text'] . "\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()
?>
</td>
</tr>
<!-- information_eof //-->

 

 

You can seee the result here http://www.needforexhaust.com/catalog/

 

:(

Posted

Yes this code is ok now. But seems you have another box (another file) where you put the 2nd connection in it? because I see products_id on the top-left of your page. The forum box (bottom-left) seems that pulls-in the subject content from the dbase. It also scrolls its content. Check the other files did you modified another box? because the error comes from somewhere else.

Posted

Ok you need the re-select the original dbase Lets try this (Probably I missed it earlier)

 

Replace the previous code for the closing of the dbase

 

// close the connection

tep_db_close2();

mysql_select_db(DB_DATABASE);

?>

</td>

</tr>

<!-- information_eof //-->

 

 

PS: Everything is possible :D

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...