Page 1 of 1

No view all news?

Posted: Sat Feb 20, 2010 9:28 pm
by gaogier
Hello

I am having problems viewing all news, found here, http://runehints.com at the bottom of the news, you will see the view all news dose not work.

However, if you go here, http://www.runehints.com/oldestindex.php Our very old design I dug out, works fine.


Heres the code.

Code: Select all

<?php
include('header.inc');
 
    ?>
 
 
                <td width="5"><img src="image/specer.png" width="1" height="1"></td>
                <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                      <tr align="left" valign="top">
                        <td width="8"><img src="image/th-midbody-left.jpg" width="8" height="29"></td>
                        <td class="t-header-bg"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                          <tr align="left" valign="top">
                            <td width="30" height="29" align="center" valign="middle"><img src="image/arrow.jpg" width="17" height="9"></td>
                            <td width="5"><img src="image/specer.png" width="1" height="1"></td>
                            <td valign="middle" class="th_text">RuneHints and RuneScape News</td>
                          </tr>
                        </table></td>
                        <td width="8"><img src="image/th-midbody-right.jpg" width="8" height="29"></td>
                      </tr>
                    </table></td>
                  </tr>
                  <tr>
                    <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                      <tr align="left" valign="top">
                        <td width="1" bgcolor="#756649"><img src="image/specer.png" width="1" height="1"></td>
                        <td width="1" bgcolor="#A18E6E"><img src="image/specer.png" width="1" height="1"></td>
                        <td width="1" bgcolor="#474B48"><img src="image/specer.png" width="1" height="1"></td>
                        <td bgcolor="675a45"><?php
 
function displayNews($all = 0) {
global $sitestyle;
 
 
require_once ('../mysql_connect1.php');//connect to db
 
function bbcode($text=""){
   if($text==""){
      return "";
   }
   $pattern=array();
   $replacement=array();
   $pattern[]='#\[url:(.*?)\](.*?)\[/url:(.*?)\]#';
   $replacement[]='<a href="\\2">\\1</a>';
   
   $pattern[]='#\[url=(.*?)?:(.*?)\](.*?)\[/url\]?:(.*?)\]#';
   $replacement[]='<a href="\\1">\\3</a>';
   
   $pattern[]='#\[b:(.*?)\](.*?)\[/b:(.*?)\]#';
   $replacement[]='<b>\\2</b>';
   
   $pattern[]='#\[u:(.*?)\](.*?)\[/u:(.*?)\]#';
   $replacement[]='<u>\\2</u>';
   
   $pattern[]='#\[i:(.*?)\](.*?)\[/i:(.*?)\]#';
   $replacement[]='<i>\\2</i>';
   
   $pattern[]='#\[img:(.*?)\](.*?)\[/img:(.*?)\]#';
   $replacement[]='<img src="\\2">';
   
   $pattern[]='#\[color=(.*?):(.*?)\](.*?)\[/color:(.*?)\]#';
   $replacement[]='<font color="\\1">\\3</font>';
   
   $pattern[]='#\[size=(.*?):(.*?)\](.*?)\[/size:(.*?)\]#';
   $replacement[]='<font size="\\1">\\3</font>';
 
   $pattern[]='#\[flash=(.*?), (.*?):(.*?)\](.*?)\[/flash:(.*?)\]#';
   $replacement[]='   <object classid="clsid:D27CDB6E-AE6D-11²CF-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=5,0,0,0" width="\\1" height="\\2">
  <param name="movie" value="\\4" />
  <param name="play" value="false" />
  <param name="loop" value="false" />
  <param name="quality" value="high" />
  <param name="allowScriptAccess" value="never" />
  <param name="allowNetworking" value="internal" />
  <embed src="\\4" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="\\1" height="\\2" play="false" loop="false" quality="high" allowscriptaccess="never" allownetworking="internal"></embed>
  </object>';
   
   $pattern[]='#\[list?=(.*?):(.*?)\](.*?)\[/list:(.*?)\]#';
   $replacement[]='<UL>convert_list(\\3)</UL>';
   
   return preg_replace($pattern, $replacement, $text);
}
 
function convert_list($text=""){
   if($text==""){
      return "";
   }
   $pattern=array();
   $replacement=array();
   $pattern[]='#\[*:(.*?)\](.*?)[/*:(.*?)]#';
   $replacement[]='<LI>\\2</LI>';
   return preg_replace($pattern, $replacement, $text);
}
 
if ($all == 0) {   
  $topic_query = "SELECT * FROM `phpbb_topics` WHERE `forum_id`= '63' ORDER BY `topic_time` DESC LIMIT 7"; // do topic query
}else{
$topic_query = "SELECT * FROM `phpbb_topics` WHERE `forum_id`= '63' ORDER BY `topic_time` DESC"; // do topic query
   }
  $topic_result = mysql_query ($topic_query);
while ($topic_row = mysql_fetch_assoc($topic_result)) {
$tt = $topic_row['topic_time'];
$topic = $topic_row['topic_id'];
  $poster = $topic_row['topic_poster'];
$first = $topic_row['topic_first_post_id'];
$title = $topic_row['topic_title'];
$topic_replies = $topic_row['topic_replies'];
$topic_runescape = $topic_row['topic_runescape'];
$post_query = "SELECT * FROM `phpbb_posts` WHERE  `topic_id` = '$topic' AND `poster_id` = '$poster' AND `post_id` = '$first'"; // do post subject query
$post_result = mysql_query($post_query);
while ($post_row = mysql_fetch_assoc($post_result)){
   $post_id = $post_row['post_id'];
}
$use_query = "SELECT `username`, `user_avatar`, `user_email`, `user_rank` FROM `phpbb_users` WHERE `user_id` = '$poster'"; // do user query
$use_result = mysql_query($use_query);
while ($use_row = mysql_fetch_assoc($use_result)){
$user = $use_row['username'];
$user_avatar = $use_row['user_avatar'];
$user_email = $use_row['user_email'];
$rank = $use_row['user_rank'];   
}
$news_query = "SELECT `post_text` FROM `phpbb_posts` WHERE `post_id`='$post_id'";
$news_result = mysql_query($news_query);
while ($news_row = mysql_fetch_assoc($news_result)){
   $news = $news_row['post_text'];
$news=bbcode($news);
}
$rank_result = mysql_query("SELECT `rank_title` FROM `phpbb_ranks` WHERE `rank_id`='$rank'");
while($rforumsank_row = mysql_fetch_assoc($rank_result)){
   $ranks = $rank_row['rank_title'];
}
$date = date("D M jS, Y g:i a", $tt);
if ($topic_replies == 0){
$reply = '<a href="http://www.runehints.com/forums/posting.php?mode=reply&f=63&t='.$topic.'">Nobody has commented on this piece of news yet. Be the first!</a>';
$post_new ="";
}else{
$reply =  'comments(<a href="http://www.runehints.com/forums/viewtopic.php?t='.$topic.'">'.$topic_replies.'</a>) |';
$post_new = '<a href="http://www.runehints.com/forums/posting.php?mode=reply&f=63&t='.$topic.'">Post a comment</a>';
}
if ($topic_runescape == 1){
   $news1 = 'This news topic is taken straight from <a href="http://runescape.com">Runescape.com</a><br />_____________________________________________<br /><br />'.$news;
}else{
   $news1 = $news;
}
// Replace newlines //
$news2 = str_replace("\n", "\n<br />\n", $news1);
  ?><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td height="1" align="left" valign="top" bgcolor="#474B48"><img src="image/specer.png" width="1" height="1"></td>
                          </tr>
                          <tr>
                            <td align="left" valign="top" bgcolor="#675A45"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                  <tr>
                                    <td align="left" valign="top" class="box_01"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                      <tr>
                                        <td align="left" valign="middle" class="normal_text02"><a href="http://www.runehints.com/forums/viewtopic.php?t=<?php echo $topic; ?>"><?php echo $title; ?></a></td>
                                      </tr>
                                    </table></td>
                                  </tr>
                                  <tr>
                                    <td align="left" valign="top" class="box_02"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                      <tr>
                                        <td align="left" valign="top" class="normal_text03"><a href="http://www.runehints.com/forums/memberlist.php?mode=viewprofile&u=<?php echo $poster; ?>"><?php echo $user; ?></a> on <?php echo $date;?></td>
                                      </tr>
                                    </table></td>
                                  </tr>
                                </table></td>
                              </tr>
                              <tr>
                                <td align="left" valign="top" class="box_03"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                  <tr>
                                    <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                          <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                              <tr align="left" valign="top">
                                                <td width="92" height="97"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                                    <tr>
                                                      <td align="left" valign="top" class="pic"><img src="<?php echo $user_avatar; ?>" ></td>
                                                    </tr>
                                                    <tr>
                                                      <td align="left" valign="top"><?php echo $ranks; ?></td>
                                                    </tr>
                                                </table></td>
                                                <td width="10">&nbsp;</td>
                                                <td><div align="justify">
                                                  <p><span class="text_01"><?php echo "$news2"; ?></span></p>
                                                  <span class="text_99"><br><center><?php echo $reply. ' '. $post_new;?></center>
                                                    </span>
                                                </div></td>
                                              </tr>
                                          </table></td>
                                        </tr>
                                    </table></td>
                                  </tr>
                                </table></td>
                              </tr>
                              <tr>
                                <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                  
                                </table></td>
                              </tr>
                            </table></td>
                          </tr>
                        </table></td>
  </tr>
</table><?php
}
   
/* if we aren't displaying all news,
* then give a link to do so */
if ($all == 0) {
echo "<center><a href=\"{$_SERVER['PHP_SELF']}" .
"?action=all\" class=\"text_01\">View all news</a></center>\n";
}
   //mysql_close();
//}
 
?>
</td>
                        <td width="1" bgcolor="#756649"><img src="image/specer.png" width="1" height="1"></td>
                        <td width="1" bgcolor="#A18E6E"><img src="image/specer.png" width="1" height="1"></td>
                        <td width="1" bgcolor="#474B48"><img src="image/specer.png" width="1" height="1"></td>
                      </tr>
                    </table></td>
                  </tr>
                  <tr>
                    <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                      <tr align="left" valign="top">
                        <td width="26"><img src="image/th-midbodybot-left.jpg" width="26" height="12"></td>
                        <td valign="bottom"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td height="9" align="left" valign="top" bgcolor="#675A45"><img src="image/specer.png" width="1" height="1"></td>
                          </tr>
                          <tr>
                            <td height="1" align="left" valign="bottom" bgcolor="#474B48"><img src="image/specer.png" width="1" height="1"></td>
                          </tr>
                          <tr>
                            <td height="1" align="left" valign="bottom" bgcolor="#A18E6E"><img src="image/specer.png" width="1" height="1"></td>
                          </tr>
                          <tr>
                            <td height="1" align="left" valign="top" bgcolor="#756649"><img src="image/specer.png" width="1" height="1"></td>
                          </tr>
                        </table></td>
                        <td width="26"><img src="image/th-midbodybot-right.jpg" width="26" height="12"></td>
                      </tr>
                    </table></td>
                  </tr>
                  <tr>
                    <td height="5" align="left" valign="top"><img src="image/specer.png" width="1" height="1"></td>
                  </tr>
                </table></td>
                <td width="5"><img src="image/specer.png" width="1" height="1"></td>
              </tr>
              
            </table>
 
 
<?php
include('footer.inc');
 
    ?>
I think its this part of the code, but not 100% sure.

I think its line 2.

Code: Select all

<?php
 
//function displayNews($all = 0) {
//global $sitestyle;
 
 
require_once ('../mysql_connect1.php');//connect to db
 
function bbcode($text=""){
   if($text==""){
      return "";
   }
   $pattern=array();
   $replacement=array();
   $pattern[]='#\[url:(.*?)\](.*?)\[/url:(.*?)\]#';
   $replacement[]='<a href="\\2">\\1</a>';
   
   $pattern[]='#\[url=(.*?)?:(.*?)\](.*?)\[/url\]?:(.*?)\]#';
   $replacement[]='<a href="\\1">\\3</a>';
   
   $pattern[]='#\[b:(.*?)\](.*?)\[/b:(.*?)\]#';
   $replacement[]='<b>\\2</b>';
   
   $pattern[]='#\[u:(.*?)\](.*?)\[/u:(.*?)\]#';
   $replacement[]='<u>\\2</u>';
   
   $pattern[]='#\[i:(.*?)\](.*?)\[/i:(.*?)\]#';
   $replacement[]='<i>\\2</i>';
   
   $pattern[]='#\[img:(.*?)\](.*?)\[/img:(.*?)\]#';
   $replacement[]='<img src="\\2">';
   
   $pattern[]='#\[color=(.*?):(.*?)\](.*?)\[/color:(.*?)\]#';
   $replacement[]='<font color="\\1">\\3</font>';
   
   $pattern[]='#\[size=(.*?):(.*?)\](.*?)\[/size:(.*?)\]#';
   $replacement[]='<font size="\\1">\\3</font>';
 
   $pattern[]='#\[flash=(.*?), (.*?):(.*?)\](.*?)\[/flash:(.*?)\]#';
   $replacement[]='   <object classid="clsid:D27CDB6E-AE6D-11²CF-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=5,0,0,0" width="\\1" height="\\2">
  <param name="movie" value="\\4" />
  <param name="play" value="false" />
  <param name="loop" value="false" />
  <param name="quality" value="high" />
  <param name="allowScriptAccess" value="never" />
  <param name="allowNetworking" value="internal" />
  <embed src="\\4" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="\\1" height="\\2" play="false" loop="false" quality="high" allowscriptaccess="never" allownetworking="internal"></embed>
  </object>';
   
   $pattern[]='#\[list?=(.*?):(.*?)\](.*?)\[/list:(.*?)\]#';
   $replacement[]='<UL>convert_list(\\3)</UL>';
   
   return preg_replace($pattern, $replacement, $text);
}
 
function convert_list($text=""){
   if($text==""){
      return "";
   }
   $pattern=array();
   $replacement=array();
   $pattern[]='#\[*:(.*?)\](.*?)[/*:(.*?)]#';
   $replacement[]='<LI>\\2</LI>';
   return preg_replace($pattern, $replacement, $text);
}
 
if ($all == 0) {   
  $topic_query = "SELECT * FROM `phpbb_topics` WHERE `forum_id`= '63' ORDER BY `topic_time` DESC LIMIT 7"; // do topic query
}else{
$topic_query = "SELECT * FROM `phpbb_topics` WHERE `forum_id`= '63' ORDER BY `topic_time` DESC"; // do topic query

However, If I remove, this,

Code: Select all

//function displayNews($all = 0) {
//global $sitestyle;
 
and replace it with this,

Code: Select all

function displayNews($all = 0) {
global $sitestyle;
 
I get this error Parse error: syntax error, unexpected $end in /home/gaogier/public_html/index.php on line 266