ThWboard Support-Forum (Archiv)

Ort: / Boardübersicht / Probleme und Fragen / ThWboard News


Seite 1 von 1

5c0rp1on schrieb am 09.06.2005 um 16:44 Uhr

Hoi Hoi,
also ich hab mal versucht die News zu testen. Allerdings kommt dann dieser Fehler

Parse error: parse error in /home/httpd/vhosts/5c0rp1ons-Hell.de/httpdocs/forum/thwbnews.php on line 56

[quote]<?php
/* $Id: thwbnews.php,v 1.4 2002/11/06 20:43:45 pbaecher Exp $ */

/*
*
* ThWboard News
*
* WARNING: This script requires thwboard beta 2.8+
*
* This is a basic newsscript using thwboard as news database.
* In order to use this script, you need to create a news board,
* and enter its ID below. You can post news by creating a new
* thread in this board and your users may comment these news
* by posting replies (optional)
*
* To alter the layout/design you can edit the variable
* $tpl_newsrow. This is the template for a news item.
*
* Then, simply include() this script on your main page.
*
*
*
* (c) 2002 ThWboard Development Team
*/

/* ----------------- config -------------------
path to your thwboard directory (relative to this script)
don't forget the slash at the end! */
$thwbpath = 'http://www.5c0rp1ons-hell.de/forum/';

/* should this script open a MySQL connection?
1 - yes
0 - no, use existing */
$mysqlconnect = 0;

/* print() news directly or store them in $news_output?
1 - print() news
0 - store output in $news_output */
$print_news = 1;

/* news are taken from this boardid */
$boardid = 2;

/* amout of news to display at a time */
$newscount = 10;

/* dont display more than $maxchars, link to the thread instead. 0 to disable */
$maxchars = 100;

/* the date format for your news -- see www.php.net/date */
$date_format = 'd.m.Y';

/* newsrow template. available inserts:
{date}, {topic}, {text}, {author}, {commentcount}, {threadid}, {more} */
$tpl_newsrow = 'http://www.5c0rp1ons-hell.de/forum/templates/newsrow.html'
<b>{topic}</b><br>
<font size="1">{date} - {commentcount} <a href="'.$thwbpath.'showtopic.php?threadid={threadid}">Kommentar(e)</a></font><br>
<table width="20%" border="0" cellspacing="0" cellpadding="0">
<tr>
{text}
</tr>
</table><table> <tr> <td>
{more}<br>
</td>
</tr></table>
<br><br>
';

/* ------------ configuration end --------------------- */


require($thwbpath.'./inc/config.inc.php');
require($thwbpath.'./inc/functions.inc.php');
require($thwbpath.'./inc/thwbcode.inc.php');
if( $mysqlconnect )
{
mysql_connect($mysql_h, $mysql_u, $mysql_p);
mysql_select_db($mysql_db);
}

$oldquotes = get_magic_quotes_runtime();
set_magic_quotes_runtime(0);
################################################################################
// Creating config array
################################################################################

//$lan_instruct = LANG_SELECT_INSTRUCT;
$r_registry = thwb_query("SELECT keyname, keyvalue, keytype FROM " . $pref . "registry");
while ( $registry = mysql_fetch_array($r_registry) )
{
switch( $registry['keytype'] )
{
case 'integer':
case 'boolean':
$config[$registry['keyname']] = intval($registry['keyvalue']);
break;

case 'array':
if( $registry['keyvalue'] )
{
$array = explode("\n", $registry['keyvalue']);
while( list($k, $v) = @each($array) )
$array[$k] = '"'.addslashes(trim($v)).'"';
eval("\$config[\$registry['keyname']] = array(".implode(',', $array).");");
}
break;

default:
$config[$registry['keyname']] = $registry['keyvalue'];
}
}
{

$r_style = thwb_query("SELECT styletemplate, colorbg, color1, CellA, CellB, color4, colorbgfont, col_he_fo_font, color_err, col_link, col_link_v, col_link_hover, stdfont, boardimage, newtopicimage, border_col FROM ".$pref."style WHERE styleid=1");

$style = mysql_fetch_array($r_style);
$style['smallfont'] = '<font face="' . $style['stdfont'] . '" size="1">';
$style['smallfontend'] = '</font>';
$style['stdfont'] = '<font face="' . $style['stdfont'] . '" size="2">';
$style['stdfontend'] = '</font>';


}
/* select threads */
$r_thread = mysql_query('SELECT
threadid,
threadtopic,
threadtime,
threadauthor,
threadreplies,
threadcreationtime
FROM '.$pref.'thread WHERE boardid='.$boardid.' ORDER BY threadcreationtime DESC LIMIT '.$newscount);

$a_thread = array();
$a_threadid = array();
while( $thread = mysql_fetch_array($r_thread) )
{
$a_thread[$thread['threadid']] = $thread;
$a_threadid[] = $thread['threadid'];
}
mysql_free_result($r_thread);


/* select postids */
$r_post = mysql_query('SELECT
threadid,
postid
FROM '.$pref.'post WHERE threadid IN('.implode(',', $a_threadid).') ORDER BY posttime DESC');
$a_postid = array();
while( $post = mysql_fetch_array($r_post) )
$a_postid[$post['threadid']] = $post['postid'];
mysql_free_result($r_post);


/* select posttexts */
$r_post = mysql_query('SELECT
threadid,
posttext
FROM '.$pref.'post WHERE postid IN('.implode(',', $a_postid).')');
while( $post = mysql_fetch_array($r_post) )

$a_thread[$post['threadid']]['posttext'] = $post['posttext'];




mysql_free_result($r_post);



$news_output = '';
global $maxchars;

while( list(, $thread) = each($a_thread) )
{
$pos2 = $maxchars;
if( $maxchars && strlen($thread['posttext']) > $maxchars )
{
if ( strpos($thread['posttext'], 'Attachment: [b]' ,1) ==true )
{
if ( strpos($thread['posttext'], 'Attachment: [b]' ,1) > $pos2 )
{
$pos2 = $maxchars ;
}
else
{
$pos2 = strpos($thread['posttext'], 'Attachment: [b]');
}
}
else
{
if ( strpos($thread['posttext'], '[code]' ) == true )
{
$pos2 = strpos($thread['posttext'], '[code]' ,1);
}
else
{
if ( strpos($thread['posttext'], '[url' ) == true )
{
$pos2 = strpos($thread['posttext'], '[url' ,1);
}
else
{
$counttext = substr($thread['posttext'], 0, $maxchars);
$count = substr_count($counttext,']');
if (intval($count / 2) <> ($count / 2))
{
$pos = $count;
for ($i = 1; $i <= $count+ 1; $i++)
{
$pos = strpos($thread['posttext'], ']', $pos ) + 1;
$pos2 = $pos;
}
}
}
}
}
$newtext = substr($thread['posttext'], 0, $pos2);
$more = '[<a href ="'.$thwbpath.'showtopic.php?threadid='.$thread['threadid'].'">more</a>]';
$newtext .= "....";
$pos2 = '';
$pos = '';
//HACK insert end

$thread['posttext'] = $newtext;
}
else
{
$more = '';
}
// change to suit your site preferences
$backcolor = '<td bgcolor="#c6c6c6">'.$style['stdfont'].'<FONT COLOR= WHITE>';
$backcolorend = $style['stdfontend'].'</FONT></td>';
$row = $tpl_newsrow;
$row = str_replace('{more}', $more, $row);
$row = str_replace('{topic}', parse_code($thread['threadtopic']), $row);
$row = str_replace('{text}', $backcolor.parse_code($thread['posttext'], 1, 1, 1, 1).$backcolorend, $row);
$row = str_replace('{author}', $thread['threadauthor'], $row);
$row = str_replace('{date}', date($date_format, $thread['threadcreationtime']), $row);
$row = str_replace('{threadid}', $thread['threadid'], $row);
$row = str_replace('{commentcount}', $thread['threadreplies'], $row);

$news_output .= $row;

}

unset($a_thread);
set_magic_quotes_runtime($oldquotes);

if( $print_news )
// change to suit location of /templates folder (relative to this script)
$smilieurl ='../templates';
$news_output = str_replace('templates', $smilieurl, $news_output);
print $news_output;
?>[/quote]

PhoenixDH schrieb am 09.06.2005 um 18:09 Uhr

Jetzt müsste man halt wissen was in Zeile 56 drin steht !

ragga schrieb am 09.06.2005 um 18:24 Uhr

darum auch mein vorschlag der durchnummerierung der zeilen :)

5c0rp1on schrieb am 09.06.2005 um 18:35 Uhr

In Zeile 56 steht folgendes:
<b>{topic}</b><br>

theDon schrieb am 09.06.2005 um 20:38 Uhr

$tpl_newsrow = 'http://www.5c0rp1ons-hell.de/forum/templates/newsrow.html'

Du sollst da keine URI angeben, sondern den Template-Text.

5c0rp1on schrieb am 09.06.2005 um 21:01 Uhr

Welcher Template Text? Ich habe da auch schonmal nichts drin gehabt, ging aber genauso wenig ^^

EDIT: Ich hab den Text da nochmal weg und jetzt kommt folgende Fehlermeldung

Fatal error: Call to undefined function: thwb_query() in /home/httpd/vhosts/5c0rp1ons-Hell.de/httpdocs/forum/thwbnews.php on line 88

Line 88 ist diese hier:

$r_registry = thwb_query("SELECT keyname, keyvalue, keytype FROM " . $pref . "registry");

ragga schrieb am 09.06.2005 um 21:17 Uhr

ich würd mal sagn das da eine include fehlt wie zB zum header und von dort gehtz weiter zu ddenn funktionen weil dort thwb_query "ist"


Then, simply include() this script on your main page. hast dsa gmacht??? anscheinend nicht

theDon schrieb am 09.06.2005 um 21:36 Uhr

So gehoert das:

$tpl_newsrow = '<b>{topic}</b><br>
<font size="1">{date} - {commentcount} <a href="'.$thwbpath.'showtopic.php?threadid={threadid}">Kommentar(e)</a></font><br>
<table width="20%" border="0" cellspacing="0" cellpadding="0">
<tr>
{text}
</tr>
</table><table> <tr> <td>
{more}<br>
</td>
</tr></table>
<br><br>
';

Und es fehlt auch kein include(), du hast einfach nur die Kommentare nicht richtig gelesen. in $thwbpath gehoert ein _relativer_ Pfad, keine URI.

5c0rp1on schrieb am 10.06.2005 um 12:04 Uhr

Ah jetzt hab ich es zum laufen gebracht aber irgendwie fehlt da der Style von dem Board

http://www.5c0rp1ons-hell.de/forum/thwbnews.php

theDon schrieb am 10.06.2005 um 14:31 Uhr

Das ist so beabsichtigt. Du sollst das schliesslich include()n.

ragga schrieb am 10.06.2005 um 20:43 Uhr

hab ich eh scho obn gschriebn!!1
also dort wo du das script habn willst einfach includen!!!! und dann sollts gehn

Seite 1 von 1