Welcome, Guest. Please Login or Register.
November 05, 2024, 02:54:41 PM
Home Help Search Log in Register
News: If you are still using YaBB SE, please consider upgrading to SMF as soon as possible.

YaBB SE Community  |  English User Help  |  English Help  |  Use of announcement boards « previous next »
Pages: [1] Reply Ignore Print
Author Topic: Use of announcement boards  (Read 1280 times)
Thomas
Full Member
***
Posts: 203


WWW
Use of announcement boards
« on: January 31, 2003, 10:36:50 AM »
Reply with quote

I use an announcement board to generate news on my frontside. I call it with:
<!--#include virtual="/forum/index.php?action=news;board=18;limit=15" -->

Is there a way to include just 1 post (limit=1) and then put in an ad (468x400) and then include post 2-8 (limit=2-8  ???).

Hope someone can help me with this.

/MR.T
Logged
Spaceman-Spiff
Mod Team
YaBB God
*****
Posts: 3689


My $txt[228]

Re:Use of announcement boards
« Reply #1 on: January 31, 2003, 10:41:27 AM »
Reply with quote

u might need to edit News.php
or add the banned inside your topic :P
Logged

   My mods, ysePak, codes, tutorials
    Support question IMs = bad.
Thomas
Full Member
***
Posts: 203


WWW
Re:Use of announcement boards
« Reply #2 on: January 31, 2003, 01:25:45 PM »
Reply with quote

I hope to implement the banner (468x400) permanently after post #1 on my frontside.
If I put it in my topic it wil follow the topic, and thats not what I want.

Any other sugestions?

/MR.T
Logged
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:Use of announcement boards
« Reply #3 on: January 31, 2003, 02:21:56 PM »
Reply with quote

Modify News.php to take a limit and a start.  Make the query end like this: LIMIT $start,$limit.

That should work.

-[Unknown]
Logged
Thomas
Full Member
***
Posts: 203


WWW
Re:Use of announcement boards
« Reply #4 on: January 31, 2003, 02:36:24 PM »
Reply with quote

This sounds like a good solution, but I am afraid I need som more information on how to do this.
Hope you can help me Unknown.

/MR.T
Logged
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:Use of announcement boards
« Reply #5 on: January 31, 2003, 06:52:55 PM »
Reply with quote

Hmmm... I'm away from my development computer.....

Just add $start to the global line (it will start with global...), then find the line that looks like "LIMIT $limit" and change it to "LIMIT $start,$limit".

-[Unknown]
Logged
Thomas
Full Member
***
Posts: 203


WWW
Re:Use of announcement boards
« Reply #6 on: February 01, 2003, 06:57:54 PM »
Reply with quote

I tried it out, but I then got the following errors on my frontpage:
Parse error: parse error, unexpected T_GLOBAL in /home/dykkesid/www/forum/News.php on line 31

Fatal error: Call to undefined function: () in /home/dykkesid/www/forum/index.php on line 292
If you are one your devolopement computer Unknown, would it be to much to ask of you to put out the complete news.php and the 2 include scripts to call just post 1 and post 2-15?

/MR.T
Logged
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:Use of announcement boards
« Reply #7 on: February 01, 2003, 07:20:34 PM »
Reply with quote

<?
/*****************************************************************************/
/* News.php                                                                   */
/*****************************************************************************/
/* YaBB: Yet another Bulletin Board                                          */
/* Open-Source Project started by Zef Hemel ([email protected])                 */
/* Software Version: YaBB SE                                                 */
/* ========================================================================= */
/* Software Distributed by:    http://www.yabbse.org                         */
/* Support, News, Updates at:  http://www.yabbse.org/community               */
/*                             http://www.yabbforum.com/community            */
/* ========================================================================= */
/* Copyright (c) 2001-2002 The YaBB SE Development Team                      */
/* Software by: The YaBB SE Development Team                                 */
/*****************************************************************************/
/* This program is free software; you can redistribute it and/or modify it   */
/* under the terms of the GNU General Public License as published by the     */
/* Free Software Foundation; either version 2 of the License, or (at your    */
/* option) any later version.                                                */
/*                                                                           */
/* This program is distributed in the hope that it will be useful, but       */
/* WITHOUT ANY WARRANTY; without even the implied warranty of                */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General */
/* Public License for more details.                                          */
/*                                                                           */
/* The GNU GPL can be found in gpl.txt in this directory                     */
/*****************************************************************************/

$newsphpver = 'YaBB SE 1.5.1RC1';

global $scripturl, $db_prefix, $txt, $db_name, $db_server, $db_user, $db_passwd, $cgi, $imagesdir, $board, $limit, $template, $ext, $locale, $timeformatstring, $start;

if (!defined('YaBBSE'))
   die('Hacking attempt...');

$dbcon = mysql_connect($db_server, $db_user, $db_passwd);
mysql_select_db ($db_name);

$types_to_register = array('GET', 'POST', 'COOKIE', 'SESSION', 'SERVER');
foreach ($types_to_register as $type)
{
   $arr = @${'HTTP_' . $type . '_VARS'};
   if (@count($arr) > 0)
      extract($arr, EXTR_OVERWRITE);
}

if(!defined('LC_TIME'))
   define('LC_TIME', 'LC_TIME');
setlocale (LC_TIME, $locale);

if ($limit == null)
   $limit = 5;
if ($start == null)
   $start = 0;

if ($board == null)
{
   print 'No Board Specified!';
   exit;
}

$request = db_query("
   SELECT t.*,b.*,c.*
   FROM {$db_prefix}topics as t, {$db_prefix}boards as b, {$db_prefix}categories as c
   WHERE b.ID_CAT=c.ID_CAT
      AND c.memberGroups=''
      AND b.ID_BOARD=$board)");
if (mysql_fetch_array($request) == null)
{
   print 'You can not display a board that is in a category with MemberGroups or the board ID does not exist. Please check the board number before trying again.';
   exit;
}

$request = db_query("
   SELECT t.*,m.*
   FROM {$db_prefix}topics as t, {$db_prefix}messages as m
   WHERE t.ID_BOARD=$board
      AND m.ID_MSG=t.ID_FIRST_MSG)
   ORDER BY m.posterTime DESC
   LIMIT $start,$limit");

define('YaBBSE_news', 1);

while ($row = mysql_fetch_array($request))
{
   $news_icon = '<img src="' . $imagesdir . '/' . $row['icon'] . '.gif" align="absmiddle" />';
   $news_title = $row['subject'];
   $news_date = strftime($timeformatstring, $row['posterTime']);
   $news_tmp = $row['posterName'];
   $request2 = db_query("SELECT realName FROM {$db_prefix}members WHERE (memberName='$news_tmp') LIMIT 1");
   if ($tmp = mysql_fetch_array($request2))
      $news_poster = '<a href="' . $scripturl . '?action=viewprofile;user=' . $row['posterName'] . '">' . $tmp['realName'] . '</a>';
   else
      $news_poster = $news_tmp;

   $news_body = DoUBBC($row['body']);
   $news_checkcomment = ($row['numReplies'] == 1) ? $txt['yse_news_1'] : $txt['yse_news_2'];
   $news_comments = '<a href="' . $cgi . ';action=display;threadid=' . $row['ID_TOPIC'] . ';start=0">' . $row['numReplies'] . ' ' . $news_checkcomment . '</a>';
   $news_newcomment = '<a href="' . $cgi . ';action=post;threadid=' . $row['ID_TOPIC'] . ';title=Post+reply;start=' . $row['numReplies'] . '">' . $txt['yse_news_3'] . '</a>';
   if ($template == null)
      include('news_template.php');
   else
   {
      if ($ext == null)
         include($template . '.php');
      else
         include($template . '.' . $ext);
   }
}
exit;
?>

Call it with ;start=0;limit=1, and then ;start=1;limit=7.

-[Unknown]
Logged
Thomas
Full Member
***
Posts: 203


WWW
Re:Use of announcement boards
« Reply #8 on: February 01, 2003, 09:05:37 PM »
Reply with quote

Thanks :), but the only thing I got was:

Hacking attempt...

on my frontpage.

Could this be because of I am use 1,5 and it seems like this is 1,51?

/MR.T
Logged
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:Use of announcement boards
« Reply #9 on: February 01, 2003, 09:09:00 PM »
Reply with quote

In that case, remove these lines:

if (!defined('YaBBSE'))
   die('Hacking attempt...');

-[Unknown]
Logged
Thomas
Full Member
***
Posts: 203


WWW
Re:Use of announcement boards
« Reply #10 on: February 01, 2003, 09:18:42 PM »
Reply with quote

Upss

Then I got:

Fatal error: Call to undefined function: db_query() in /home/dykkesid/www/forum/News.php on line 60

/MR.T
Logged
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:Use of announcement boards
« Reply #11 on: February 01, 2003, 09:59:11 PM »
Reply with quote

Oops, that was something I did to count queries real quick (and then changed back :$)

Change any "db_query" to "mysql_query".

-[Unknown]
Logged
Thomas
Full Member
***
Posts: 203


WWW
Re:Use of announcement boards
« Reply #12 on: February 02, 2003, 09:15:05 AM »
Reply with quote

Thank you very much for the help Unknown. :)

I had to do a few other changes as well. You can see it in action on www.dykkesiden.com

I hav enow set up a webboard (468x400) between post 1 and 2 :) :)

The script for 1,5 is:
<?
/*****************************************************************************/
/* News.php                                                                   */
/*****************************************************************************/
/* YaBB: Yet another Bulletin Board                                          */
/* Open-Source Project started by Zef Hemel ([email protected])                 */
/* Software Version: YaBB SE                                                 */
/* ========================================================================= */
/* Software Distributed by:    http://www.yabbse.org                         */
/* Support, News, Updates at:  http://www.yabbse.org/community               */
/*                             http://www.yabbforum.com/community            */
/* ========================================================================= */
/* Copyright (c) 2001-2002 The YaBB SE Development Team                      */
/* Software by: The YaBB SE Development Team                                 */
/*****************************************************************************/
/* This program is free software; you can redistribute it and/or modify it   */
/* under the terms of the GNU General Public License as published by the     */
/* Free Software Foundation; either version 2 of the License, or (at your    */
/* option) any later version.                                                */
/*                                                                           */
/* This program is distributed in the hope that it will be useful, but       */
/* WITHOUT ANY WARRANTY; without even the implied warranty of                */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General */
/* Public License for more details.                                          */
/*                                                                           */
/* The GNU GPL can be found in gpl.txt in this directory                     */
/*****************************************************************************/

$newsphpver = 'YaBB SE 1.5.1RC1';

global $scripturl, $db_prefix, $txt, $db_name, $db_server, $db_user, $db_passwd, $cgi, $imagesdir, $board, $limit, $template, $ext, $locale, $timeformatstring, $start;

$dbcon = mysql_connect($db_server, $db_user, $db_passwd);
mysql_select_db ($db_name);

$types_to_register = array('GET', 'POST', 'COOKIE', 'SESSION', 'SERVER');
foreach ($types_to_register as $type)
{
   $arr = @${'HTTP_' . $type . '_VARS'};
   if (@count($arr) > 0)
      extract($arr, EXTR_OVERWRITE);
}

setlocale (LC_TIME, $locale);

if ($limit == null)
   $limit = 5;
if ($start == null)
   $start = 0;

if ($board == null)
{
   print 'No Board Specified!';
   exit;
}

$request = mysql_query("SELECT t.*,b.*,c.* FROM {$db_prefix}topics as t,{$db_prefix}boards as b,{$db_prefix}categories as c WHERE (b.ID_CAT=c.ID_CAT && c.memberGroups='' && b.ID_BOARD=$board)");
if (mysql_fetch_array($request) == null)
{
   print 'You can not display a board that is in a category with MemberGroups or the board ID does not exist. Please check the board number before trying again.';
   exit;
}

$request = mysql_query("SELECT t.*,m.* FROM {$db_prefix}topics as t,{$db_prefix}messages as m WHERE (t.ID_BOARD=$board && m.ID_MSG=t.ID_FIRST_MSG) ORDER BY m.posterTime DESC LIMIT $start,$limit");

while ($row = mysql_fetch_array($request))
{
   $news_icon = '<img src="' . $imagesdir . '/' . $row['icon'] . '.gif" align="absmiddle" />';
   $news_title = $row['subject'];
   $news_date = strftime($timeformatstring, $row['posterTime']);
   $news_tmp = $row['posterName'];
   $request2 = mysql_query("SELECT realName FROM {$db_prefix}members WHERE (memberName='$news_tmp') LIMIT 1");
   while ($tmp = mysql_fetch_array($request2))
      $news_poster = '<a href="' . $scripturl . '?action=viewprofile;user=' . $row['posterName'] . '">' . $tmp['realName'] . '</a>';
 
   $news_body = DoUBBC($row['body']);
   $news_checkcomment = ($row['numReplies'] == 1) ? $txt['yse_news_1'] : $txt['yse_news_2'];
   $news_comments = '<a href="' . $cgi . ';action=display;threadid=' . $row['ID_TOPIC'] . ';start=0">' . $row['numReplies'] . ' ' . $news_checkcomment . '</a>';
   $news_newcomment = '<a href="' . $cgi . ';action=post;threadid=' . $row['ID_TOPIC'] . ';title=Post+reply;start=' . $row['numReplies'] . '">' . $txt['yse_news_3'] . '</a>';
   if ($template == null)
      include('news_template.php');
   else
   {
      if ($ext == null)
         include($template . '.php');
      else
         include($template . '.' . $ext);
   }
}
exit;
?>

Thanks again Unknown.

/MR.T
Logged
Thomas
Full Member
***
Posts: 203


WWW
Re:Use of announcement boards
« Reply #13 on: April 16, 2003, 07:22:56 AM »
Reply with quote

Here is the code for 1.51.
Thanks to [Unkown].
This allows me to set in pictures/ads or whatever between which posts I want. Very nice feature :)
See it in action at www.dykkesiden.com

Quote<?
/*****************************************************************************/
/* News.php                                                                   */
/*****************************************************************************/
/* YaBB SE: Yet another Bulletin Board Splinter Edition                      */
/* Open-Source Project inspired by Zef Hemel ([email protected])              */
/* Software Version:           YaBB SE 1.5.1                                 */
/* Software by:                The YaBB SE Development Team                  */
/* ========================================================================= */
/* Software Distributed by:    http://www.yabbse.org                         */
/* Copyright 2001-2003 by:     http://www.lewismedia.com (Lewis Media)       */
/* Support, News, Updates at:  http://www.yabbse.org/community               */
/* Inspired and Ported From:   http://www.yabbforum.com                      */
/*****************************************************************************/
/* This program is free software; you may redistribute it and/or modify it   */
/* under the terms of the provided license as published by Lewis Media.      */
/*                                                                           */
/* This program is distributed in the hope that it will be useful, but       */
/* WITHOUT ANY WARRANTY; without even the implied warranty of                */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the provided    */
/* license for more information.                                             */
/*                                                                           */
/* See license.txt for details of the YaBB SE license. The latest version    */
/* of this license can be found at the distributor's site seen above.        */
/*****************************************************************************/

$newsphpver = 'YaBB SE 1.5.1';

global $scripturl, $db_prefix, $txt, $db_name, $db_server, $db_user, $db_passwd, $cgi, $imagesdir, $board, $limit, $template, $ext, $locale, $timeformatstring, $start;

if (!defined('YaBBSE'))
   die('Hacking attempt...');

$dbcon = mysql_connect($db_server, $db_user, $db_passwd);
mysql_select_db ($db_name);

$types_to_register = array('GET', 'POST', 'COOKIE', 'SESSION', 'SERVER');
foreach ($types_to_register as $type)
{
   $arr = @${'HTTP_' . $type . '_VARS'};
   if (@count($arr) > 0)
      extract($arr, EXTR_OVERWRITE);
}

if(!defined('LC_TIME'))
   define('LC_TIME', 'LC_TIME');
setlocale (LC_TIME, $locale);

if ($limit == null)
   $limit = 5;
if ($start == null)
 $start = 0;

if ($board == null)
{
   print 'No Board Specified!';
   exit;
}

$request = mysql_query("SELECT t.*,b.*,c.* FROM {$db_prefix}topics as t,{$db_prefix}boards as b,{$db_prefix}categories as c WHERE (b.ID_CAT=c.ID_CAT && c.memberGroups='' && b.ID_BOARD=$board)");
if (mysql_fetch_array($request) == null)
{
   print 'You can not display a board that is in a category with MemberGroups or the board ID does not exist. Please check the board number before trying again.';
   exit;
}

$request = mysql_query("SELECT t.*,m.* FROM {$db_prefix}topics as t, {$db_prefix}messages as m WHERE (t.ID_BOARD=$board && m.ID_MSG=t.ID_FIRST_MSG) ORDER BY m.posterTime DESC LIMIT $start,$limit");

define('YaBBSE_news', 1);

while ($row = mysql_fetch_array($request))
{
   $news_icon = '<img src="' . $imagesdir . '/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" />';
   $news_title = $row['subject'];
   $news_date = strftime($timeformatstring, $row['posterTime']);
   $news_tmp = $row['posterName'];
   $request2 = mysql_query("SELECT realName FROM {$db_prefix}members WHERE (memberName='$news_tmp') LIMIT 1");
   if ($tmp = mysql_fetch_array($request2))
      $news_poster = '<a href="' . $scripturl . '?action=viewprofile;user=' . $row['posterName'] . '">' . $tmp['realName'] . '</a>';
   else
      $news_poster = $news_tmp;

   $news_body = DoUBBC($row['body']);
   $news_checkcomment = ($row['numReplies'] == 1) ? $txt['yse_news_1'] : $txt['yse_news_2'];
   $news_comments = '<a href="' . $cgi . ';action=display;threadid=' . $row['ID_TOPIC'] . ';start=0">' . $row['numReplies'] . ' ' . $news_checkcomment . '</a>';
   $news_newcomment = '<a href="' . $cgi . ';action=post;threadid=' . $row['ID_TOPIC'] . ';title=Post+reply;start=' . $row['numReplies'] . '">' . $txt['yse_news_3'] . '</a>';

   if ($template == null)
      include('news_template.php');
   else
   {
      if ($ext == null)
         include($template . '.php');
      else
         include($template . '.' . $ext);
   }
}
exit;
?>

/MR.T
Logged
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  English User Help  |  English Help  |  Use of announcement boards « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.079 seconds with 21 queries.