Re: PunNewz

Hey pgregg.

I see... Well I'll add that 'ORDER BY' if I know how smile

27

Re: PunNewz

Oh, ok... smile

 Make Line 266:
$msg = $db->query('SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.status, u.registered, u.admin_note, p.id, p.poster, p.poster_id, p.poster_ip, p.poster_email, p.message, p.smilies, p.posted, p.edited, p.edited_by FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id WHERE p.topic_id='.$id.' ORDER BY posted LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());

All on one line (if the above code isn't).

Re: PunNewz

lol thanks smile

29

Re: PunNewz

Is there any way to customize the appearance ?

eg: adding background colors to the title etc etc ?

30

Re: PunNewz

simmo wrote:

Is there any way to customize the appearance ?

eg: adding background colors to the title etc etc ?

Um, re-read this thread again... cuteseal already posted the CSS that does this.

Re: PunNewz

Thanks pgregg and crissipos,

I've fixed the error with the ORDER by (line 266), and have uploaded the new file to my site.

Cheers,
Julian

Digital photography news, reviews, discussions and more!
http://www.shuttertalk.com

The online bible for all
http://www.publicbible.com

32

Re: PunNewz

I think I'm very stupid smile

I don't understand HOW to install this mod sad

Great french stupid man I am ...

Re: PunNewz

Um... just copy the file into your punbb folder.  Use it the same way as if you were using extern.php...

Digital photography news, reviews, discussions and more!
http://www.shuttertalk.com

The online bible for all
http://www.publicbible.com

34

Re: PunNewz

héhé ... ok thanx Cuteseal : I put the mod in the root of my site ... (I have said : I'm very stupid ...)

I test ...

35 (edited by Rod 2004-07-25 12:20)

Re: PunNewz

OK ... It works smile

So ... I would like if it's possible, instead to send user to the forum, use the function <?php self ?> to have ... example ...

http://www.domain.com/urlofyourpagewithpunNewz.php

If you want to read comments ...

http://www.domain.com/urlofyourpagewith … ?=comments

Re: PunNewz

Anything is possible, my friend smile

Feel free to modify it to suit your needs.  I'm using a modified version on my front page.  Just change the links in externnews.php (around line 262...)

Digital photography news, reviews, discussions and more!
http://www.shuttertalk.com

The online bible for all
http://www.publicbible.com

37

Re: PunNewz

I'm not a php coder : I would like if it was possible ... it seems it's possible smile so thanx for the answer smile

38

Re: PunNewz

With this, all the news items on the front page must be in ONE catagory. So wouldn't it be better if the administrator could vink (or something) that that topic must appear on the front page when posting a new topic?
That would be better I think... smile
Julius

Re: PunNewz

I suppose you could do that... but you would need an extra column in the db to store the info.

I post news in particular forums only, so it suits my needs just fine. big_smile

Digital photography news, reviews, discussions and more!
http://www.shuttertalk.com

The online bible for all
http://www.publicbible.com

40

Re: PunNewz

hey cuteseal can you make the code so that the avatar of the news poster will be showed ?

btw: Great mod there smile

41 (edited by FaRe-Ed 2004-10-29 02:22)

Re: PunNewz

How can i limit the page being that displayed on the frontpage? I've tried to limit it to only showing one latest post by using this

<? php include('http://host.com/forums/extern.php?action=new&show=1&fid=9'); ?>

but it doesn't work...is there a way to fix it? Help will be appreciated.

if mONey is lOSt nOThINg is lOSt,
if cHArACtER is lOSt sOMeTHiNG is lOSt,
bUT,
if rELiGIon and eDUcATiON aRE lOSt eVErYThINg is lOSt.

42

Re: PunNewz

Fare-ed you must be doing something wrong

<? include "http://localhost/forum/externnews.php?action=new&show=10&fid=7"; ?>

and the externnews is this:

<?php
/***********************************************************************

  Copyright (C) 2002, 2003, 2004  Rickard Andersson (rickard@punbb.org)

  This file is part of PunBB.

  PunBB 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.

  PunBB 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.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  MA  02111-1307  USA

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

// The maximum number of topics that will be displayed
$show_max_topics = 3;

// The length at which topic subjects will be truncated (for HTML output)
$max_subject_length = 30;


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

// DO NOT EDIT ANYTHING BELOW THIS LINE! (unless you know what you are doing)


$pun_root = './';
@include $pun_root.'config.php';

// If PUN isn't defined, config.php is missing or corrupt
if (!defined('PUN'))
    exit('The file \'config.php\' doesn\'t exist or is corrupt. Please run install.php to install PunBB first.');

// Disable error reporting for uninitialized variables
//error_reporting(E_ERROR | E_WARNING | E_PARSE);

// Turn off magic_quotes_runtime
set_magic_quotes_runtime(0);

// Attempt to load the common language file
@include $pun_root.'lang/'.$language.'/'.$language.'_common.php';
if (!isset($lang_common))
    exit('There is no valid language pack \''.$language.'\' installed. Plese check $language setting in config.php.');

// Load the functions script
require $pun_root.'include/functions.php';

// Load DB abstraction layer and try to connect
require $pun_root.'include/dblayer/common_db.php';

// Load parser
require $pun_root.'include/parser.php';

// Get the forum config
$result = $db->query('SELECT * FROM '.$db->prefix.'config') or error('Unable to fetch forum config', __FILE__, __LINE__, $db->error());
while ($cur_config_item = $db->fetch_row($result))
    $pun_config[$cur_config_item[0]] = $cur_config_item[1];


// Make sure we have permission to read the forums
if ($pun_config['p_guests_read'] == '0')
    exit('No permission');


//
// Converts the CDATA end sequence ]]> into ]]>
//
function escape_cdata($str)
{
    return str_replace(']]>', ']]>', $str);
}


//
// Show recent discussions
//
if ($_GET['action'] == 'new')
{
    $order_by = 't.posted';
    $forum_sql = '';

    // Was a forum ID supplied?
    if (isset($_GET['fid']))
    {
        $fid = intval($_GET['fid']);
        if (!empty($fid))
            $forum_sql = 'f.id='.$fid.' AND ';
    }


        $show = intval($_GET['show']);
        if ($show < 1 || $show > 50)
            $show = $show_max_topics;

        $saveddate="";

        // Fetch $show topics
        $result = $db->query('SELECT t.id, t.poster, t.subject, t.num_replies, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON t.forum_id=f.id WHERE t.moved_to IS NULL AND '.$forum_sql.'f.admmod_only=0 ORDER BY '.$order_by.' DESC LIMIT '.$show.'') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
        while ($cur_topic = $db->fetch_assoc($result))
        {
            if ($pun_config['o_censoring'] == '1')
                $cur_topic['subject'] = censor_words($cur_topic['subject']);

            if (pun_strlen($cur_topic['subject']) > $max_subject_length)
                $subject_truncated = trim(substr($cur_topic['subject'], 0, ($max_subject_length-5))).' ...';
            else
                $subject_truncated = $cur_topic['subject'];

            $id = $cur_topic['id'];
            $msg = $db->query('SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.status, u.registered, u.admin_note, p.id, p.poster, p.poster_id, p.poster_ip, p.poster_email, p.message, p.smilies, p.posted, p.edited, p.edited_by FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id WHERE p.topic_id='.$id.' ORDER BY posted LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
            $cur_post = $db->fetch_assoc($msg);

            //Display first paragraph only (comment out next four lines to turn off)
            /*
            $paragraph = preg_split("/\s*\n+/", $cur_post['message']);
            if ($paragraph[1]) {
                $cur_post['message'] = $paragraph[0] . "...";
            }*/

            $newsheading = '<a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($subject_truncated).'</a>';
            echo "\t<div><b>".$newsheading."</b></div>\n";

            $cur_post['message'] = parse_message($cur_post['message'], $cur_post['smilies']);
            echo "\t<div>".$cur_post['message']."</div><br>\n";

            echo "\t<div><i>Posted by ".$cur_topic['poster']." at ".date('h:i A', $cur_topic['posted'])." on ".date('l, d F Y', $cur_topic['posted'])." [ <a href='".$pun_config['o_base_url']."/viewtopic.php?id=".$cur_topic['id']."&action=new'>comentarii ".$cur_topic['num_replies']."</a> ]"."</i></div>\n";
            echo "\t ###############################<br><br>\n";
        }
    

    exit;
}
else
    exit('Bad request');

But I still want to know how can the avatar of the poster is showed.

43

Re: PunNewz

i wanted a link in every news item that said "edit" if you were logged in as admin so i included the following lines in externnews.php:

            If ($cur_user['status'] == PUN_ADMIN)
                $edit = '<td align="right"><a href='.$pun_root.'edit.php?id='.$cur_post['id'].'">Redigera nyheten</a></td>';
            else
                $edit = '';

then i made the script echo the $edit variable after every news-item, but it did not work.. i dont get the link to show... sad why!!! =P

Most people are other people. Their thoughts are someone else's opinions, their lives a mimicry, their passions a quotation - Oscar Wilde

44

Re: PunNewz

Because you don't need to show that link when your logged in.

You can set that link to be there allways but if you click on it and your not admin it will say you do not have permision. smile

Re: PunNewz

hihi, I made a mod of cuteseals mod

my changes:
   - 2 Styles avalable, just change the comments.
   - added email link to poster.
   - added avatar to poster.
   - cleaned the code just for the news.

You can download my externnews.php here

Guess what ??? username seth was allready taken :(

Re: PunNewz

exc work flavius thanks.

El Mejor Lugar de la Red - Corporación Azakur4

47 (edited by FaRe-Ed 2004-10-30 02:48)

Re: PunNewz

Great!! but what do you mean by 2 styles and how i gonna change the word commentarii

Nevermind, i got it now smile

if mONey is lOSt nOThINg is lOSt,
if cHArACtER is lOSt sOMeTHiNG is lOSt,
bUT,
if rELiGIon and eDUcATiON aRE lOSt eVErYThINg is lOSt.

Re: PunNewz

Fare-Ed sorry.. that's romanian language big_smile i must of forgot about that..

2 styles that means that you just comment the style you want out with //... it's all there smile

Guess what ??? username seth was allready taken :(

Re: PunNewz

Far-Ed i added a language array so that you can control the 'subject' and 'comments' with your lang.

Download externnews.php here

Guess what ??? username seth was allready taken :(

Re: PunNewz

thanks for your support:)

if mONey is lOSt nOThINg is lOSt,
if cHArACtER is lOSt sOMeTHiNG is lOSt,
bUT,
if rELiGIon and eDUcATiON aRE lOSt eVErYThINg is lOSt.