View Single Post
  #81  
Old 10-02-2005, 04:09 AM
joeMJ joeMJ is offline
 
Join Date: Feb 2005
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oups?

Problem: You cannot use old parser, connect dies within script.

I finally got this to work. A friend of mine found out, that the db connect was broken and the new parser didn't work because of that issue. Here's what I did on my page to get this working in 3.5 including new Parser and Fix within db connect (including advertising after 3 news):

See this line:
$xdb = mysql_select_db("$dbname", $connection) or die ("Could not select database.");

PHP Code:
<?php
require_once("./global.php");
require_once(
'./includes/class_bbcode.php');

$splitval="lest mehr hier";
$cats="19"//"2,3,4,5,6";
$newsitems=10;
$forumspath="http://www.tralala.de/tralala";

$servername="localhost";
$dbusername="tralala";
$dbpassword="tralala";
$dbname="tralalatabelle";

//**************************************************************************************************************//

$iidx 0;

$bbparser =& new vB_BbCodeParser($vbulletinfetch_tag_list()); 

$connection mysql_connect("$servername","$dbusername","$dbpassword") or die ("Cannot connect to server.");
$xdb mysql_select_db("$dbname"$connection) or die ("Could not select database.");

$sql "SELECT threadid, title, forumid, replycount, postusername, postuserid, lastposter, dateline, iconid FROM thread WHERE forumid IN ($cats) AND sticky = '0' ORDER BY threadid DESC LIMIT $newsitems";
$sql_result mysql_query($sql$connection) or die ("Could not execute query.".mysql_error());

if (!
$sql_result
echo 
"Could not get news.";
else
{
 while (
$row mysql_fetch_array($sql_result)) 
 {
   
$threadid $row["threadid"];
   
$title $row["title"];
   
$forumid $row["forumid"];
   
$replycount $row["replycount"];
   
$postusername $row["postusername"];
   
$postuserid $row["postuserid"];
   
$lastposter $row["lastposter"];
   
$iconid $row["iconid"];
   
$dateline $row["dateline"];

   
$sql2 "SELECT postid, threadid, username, userid, title, dateline, pagetext, iconid FROM post WHERE threadid = \"$threadid\" ORDER BY postid ASC LIMIT 1";
   
$sql_result2 mysql_query($sql2$connection) or die ("Could not execute query in second sql statement.".mysql_error());

   if (!
$sql_result2
     echo 
"Could not get news.";
   else
   {
     while (
$row2 mysql_fetch_array($sql_result2)) 
     {
       
$ptext $row2["pagetext"];
       
$dateposted date("j.n.Y G:i",$dateline);
       
$commenttext "Kommentar";
       
       if( 
$replycount!=)
        
$commenttext .= "e";

       
$outxt=$bbparser->do_parse($ptexttruetruetruetruetruetrue);

       
$trimmed explode($splitval$outxt);
       
$outxt=$trimmed[0];

       
$sql3 "SELECT title FROM forum WHERE forumid = \"$forumid\" LIMIT 1";
       
$sql_result3 mysql_query($sql3$connection) or die ("Could not execute query in second sql statement.");
       
$row3 mysql_fetch_array($sql_result3);
       
$forumname $row3["title"];
      
       
$towrite .= "<div>$outxt</div>";

       
$towrite .= "<hr size='1'>";
       
       
$towrite .= "<div align='center'>";
       
$towrite .= "Geschrieben von <a href=\"$forumspath/member.php?s=&amp;action=getinfo&amp;userid=$postuserid\"><b>$postusername</b></a> am <i>$dateposted</i><br>";
       
$towrite .= "Kategorie: <a href=\"$forumspath/forumdisplay.php?s=&amp;forumid=$forumid\">$forumname</a><br>";
       
$towrite .= "<a href=\"$forumspath/showthread.php?s=&amp;threadid=$threadid\">$replycount $commenttext</a>";
       
$towrite .= "</div>";
       
       
$towrite .= "<hr size='1'>";

       if( 
$iidx++ % == )
         
$towrite .= "<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0' bgcolor='#f7f7f7'><tr><td align='center'><iframe src='http://tralala.com/werbung.tralala' width='470' height='68' scrolling='no' marginheight='0' marginwidth='0' frameborder='0'></iframe></td></tr></table>";

       
$towrite .= "<hr size='1'>";

       
     }
   }
 }


echo 
$towrite;

?>
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01096 seconds
  • Memory Usage 1,837KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete