Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Webpage smarty

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Feature Requests
View previous topic :: View next topic  
Author Message
Enquest
Smarty Regular


Joined: 14 May 2003
Posts: 79

PostPosted: Fri May 30, 2003 2:54 pm    Post subject: Webpage smarty Reply with quote

I don't know if this is the right place. But the smarty webpage should have be able to have a small window on the main page with the latest topics in the forum. Just to show that the smarty community is alive and kicking.

Second there should be a way for the Admins to ad intressting topics or intressting Q&A of the forum to a FAQ.

Why it would be great to manage al those good answers...
_________________
-----------------------
Learning my self by trying to help others
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Fri May 30, 2003 5:43 pm    Post subject: Reply with quote

@enquest: I've been thinking that myself. Any ideas on how something like that should be setup?
Back to top
View user's profile Send private message
Enquest
Smarty Regular


Joined: 14 May 2003
Posts: 79

PostPosted: Fri May 30, 2003 6:01 pm    Post subject: Reply with quote

Well I believe phpbb has a plugin that does the first thing so that wouldn't be to hard.

The other one could be a bit harder. Maybe you need to write a little app that gives the admin powers to but a topic under a Faq.
I would copy the table out off PHPbb or just make point at it. Should not be that hard for some with a bit more expierince then I have!
_________________
-----------------------
Learning my self by trying to help others
Back to top
View user's profile Send private message
luigi
Smarty n00b


Joined: 14 Jun 2003
Posts: 2

PostPosted: Sat Jun 21, 2003 10:35 am    Post subject: Reply with quote

I'm using this script, I don't remember if I've originally taken it from some phpBB mod, however this is my modified version. Just include it in your page, and you have your last X posts in the "$posts" array.
NB: the script relies on PEAR::MDB abstraction layer, but you should get the idea on how to adapt it for your own use.

Code:

<?php
///////////////////////////////////////////////////////////
// MOD Name:  Last X Post
///////////////////////////////////////////////////////////
//

define('IN_PHPBB', true);
$forum_relative_url = str_replace('includes', 'forum', dirname(__FILE__));
$ServerPath = $forum_relative_url.DIRECTORY_SEPARATOR.'config.php';
$Constants  = $forum_relative_url.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR.'constants.php';

$PostNumber = 5;       // How Many Posts To Display

include_once($ServerPath);
include_once($Constants);

$sql = 'SELECT DISTINCT ptxt.post_subject, ptxt.post_id, post.post_time'
      .' FROM ' . POSTS_TEXT_TABLE . ' AS ptxt, ' . POSTS_TABLE . ' AS post, ' . TOPICS_TABLE . ' AS topic'
      .' WHERE  topic.forum_id != 0 AND post.post_id = ptxt.post_id AND post.topic_id = topic.topic_id'
      .' AND post.post_id = topic.topic_last_post_id'
      .' ORDER BY post.post_time DESC';
//echo $sql;
$result = @$db->limitQuery($sql, null, 0, $PostNumber);
if(MDB::isError($result)) {
    $msg      = 'Errore nel reperimento dei post';
    $code     = $db->errorCode($result);
    $userinfo = $db->errorMessage($result);
    $posts = null;
} else {
    $numrows = $db->numRows($result);
    if(!$numrows) {
        // No results
        $posts = null;
    } else {
        $posts = array();
        for($i=0; $i<$numrows; $i++) {
            list(
                $post['title'],
                $post['ID'],
                $post['time']
            ) = $db->fetchInto($result);
            if(empty($post['title'])) {
                $sql = 'SELECT topic_title'
                      .' FROM ' . TOPICS_TABLE . ' as topic'
                      .' LEFT JOIN ' . POSTS_TABLE . ' as post ON topic.topic_id=post.topic_id'
                      .' WHERE  post.post_id=' . $db->getIntegerValue($post['ID']);
                $res = @$db->query($sql);
                if(!MDB::isError($res) && $db->numRows($res)) {
                    list($post['title']) = $db->fetchRow($res);
                }
            }

            $post['date'] = date("Y-m-d H:i:s", $post['time']);
            $posts[$i] = $post;
        }
        @$db->freeResult($result);
    }
}
?>
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Feature Requests All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP