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
http://www.shuttertalk.com
The online bible for all
http://www.publicbible.com
You are not logged in. Please login or register.
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
I think I'm very stupid
I don't understand HOW to install this mod
Great french stupid man I am ...
Um... just copy the file into your punbb folder. Use it the same way as if you were using extern.php...
héhé ... ok thanx Cuteseal : I put the mod in the root of my site ... (I have said : I'm very stupid ...)
I test ...
OK ... It works
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 ...
Anything is possible, my friend
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...)
I'm not a php coder : I would like if it was possible ... it seems it's possible so thanx for the answer
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...
Julius
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.
hey cuteseal can you make the code so that the avatar of the news poster will be showed ?
btw: Great mod there
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.
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.
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... why!!! =P
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.
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
exc work flavius thanks.
Great!! but what do you mean by 2 styles and how i gonna change the word commentarii
Nevermind, i got it now
Fare-Ed sorry.. that's romanian language i must of forgot about that..
2 styles that means that you just comment the style you want out with //... it's all there
Far-Ed i added a language array so that you can control the 'subject' and 'comments' with your lang.
Download externnews.php here
thanks for your support:)
I hope I can get some help with this even though the topic is old.
My code looks like this atm:
// 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] . "...";
//}
But I still don't get the full topic:
http://hallonsoda.poller.se/forum/exter … &fid=1
thats extern.php you need to download the externnews.php eariler in this topic...
Evil-E I took your poll thats on the main page of your site and got this error. Just thought you should know.
Warning: Cannot modify header information - headers already sent by (output started at /home/woutk.pcextreme.nl/www/siteconfig.php:11) in /home/woutk.pcextreme.nl/www/poll/poll_cookie.php on line 21
thats extern.php you need to download the externnews.php eariler in this topic...
Thanks thanks. I owe you one.
Powered by PunBB, supported by Informer Technologies, Inc.