26 (edited by DrNet 2009-02-17 19:34)

Re: Replace date with Topic

hi there how to install it please its so complicated can some 1 help if you dont mind

the one  Replace date with Topic   and how to install a addons / themes thanks

27

Re: Replace date with Topic

I think your best option is to make a folder called topic_title_on_index inside extensions/ and make a file (inside the folder) called manifest.xml and put the following in and try it out:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">
 
<!--
/**
 * @copyright topic_title_on_index Copyright (C) 2008 hcs
 * @copyright Copyright (C) 2008 PunBB, partially based on code copyright (C) 2008 FluxBB.org
 * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
 * @package topic_title_on_index
 */
-->
 
<extension engine="1.0">
    <id>topic_title_on_index</id>
    <title>Topic title on forum index </title>
    <version>1.0.0 Beta</version>
    <description>Replace the Last Post link on the index page for the name of the topic instead of the date format.</description>
    <author>hcs</author>
 
    <minversion>1.3</minversion>
    <maxtestedon>1.3.2</maxtestedon>
 
    <hooks>
        <hook id="in_qr_get_cats_and_forums"><![CDATA[
$query['SELECT'] .=', t.subject, u.id as poster_id';
$query['JOINS'][] = array(
    'LEFT JOIN'    => 'topics AS t',
    'ON'        => 'f.last_post_id=t.last_post_id'
);
$query['JOINS'][] = array(
    'LEFT JOIN'    => 'users AS u',
    'ON'        => 'f.last_poster=u.username'
);
        ]]></hook>
 
        <hook id="in_start"><![CDATA[
function words($string, $words)
{
    return implode(" ", array_slice(explode(' ', $string), 0, $words)) . '...';
}
 
function relative_time($timestamp)
{
    $ago = ' temu';
    $d = time() - $timestamp;
    if ($d < 60)
    if ($d==1)
        return $d. " sekunde" .$ago;
    elseif (($d%10)>=2 && ($d%10)<=4 && ($d < 12 || $d > 14))
        return $d. " sekundy" .$ago;
    else
        return $d. " sekund" .$ago;       
    else
    {
        $d = floor($d / 60);
        if($d < 60)
                if ($d==1)
            return $d. " minute" .$ago;
        elseif (($d%10)>=2 && ($d%10)<=4 && ($d < 12 || $d > 14))
            return $d. " minuty" .$ago;
        else
            return $d. " minut" .$ago;     
        else
        {
            $d = floor($d / 60);
            if($d < 24)
                    if ($d==1)
                return $d. " godzine" .$ago;
            elseif (($d%10)>=2 && ($d%10)<=4 && ($d < 12 || $d > 14))
                return $d. " godziny" .$ago;
            else
                return $d. " godzin" .$ago; 
            else
            {
                $d = floor($d / 24);
                if($d < 7)
                    return $d." d".(($d==1)?'zień':'ni')." temu";
                else
                {
                    $d = floor($d / 7);
                    if($d < 4)
                       if ($d==1)
                return $d. " tydzień" .$ago;
            elseif (($d%10)>=2 && ($d%10)<=4 && ($d < 12 || $d > 14))
                return $d. " tygodnie" .$ago;
            else
                return $d. " tygodni" .$ago;
                }//Week
            }//Day
        }//Hour
    }//Minute
}
 
$words = 4;
        ]]></hook>
 
        <hook id="in_normal_row_pre_display"><![CDATA[
if(strpos($forum_page['item_body']['info']['lastpost'], $lang_index['No post info']) === false && strpos($forum_page['item_body']['info']['lastpost'], $lang_common['Never']) === false)
    $forum_page['item_body']['info']['lastpost'] = '<li class="info-lastpost"><span class="label">'.$lang_index['Last post'].'</span> <strong><a href="'.forum_link($forum_url['post'], $cur_forum['last_post_id']).'">'.forum_htmlencode(words($cur_forum['subject'], $words)).'</a></strong> <cite>'.relative_time($cur_forum['last_post']).' '.sprintf($lang_index['Last poster'], '<a href="'.forum_link($forum_url['user'], $cur_forum['poster_id']).'">'.forum_htmlencode($cur_forum['last_poster']).'</a>').'</cite></li>';
        ]]></hook>
 
    </hooks>
 
</extension>
Sorry. Unactive due to personal life.

28

Re: Replace date with Topic

Utchin wrote:

I think your best option is to make a folder called topic_title_on_index inside extensions/ and make a file (inside the folder) called manifest.xml and put the following in and try it out:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">
 
<!--
/**
 * @copyright topic_title_on_index Copyright (C) 2008 hcs
 * @copyright Copyright (C) 2008 PunBB, partially based on code copyright (C) 2008 FluxBB.org
 * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
 * @package topic_title_on_index
 */
-->
 
<extension engine="1.0">
    <id>topic_title_on_index</id>
    <title>Topic title on forum index </title>
    <version>1.0.0 Beta</version>
    <description>Replace the Last Post link on the index page for the name of the topic instead of the date format.</description>
    <author>hcs</author>
 
    <minversion>1.3</minversion>
    <maxtestedon>1.3.2</maxtestedon>
 
    <hooks>
        <hook id="in_qr_get_cats_and_forums"><![CDATA[
$query['SELECT'] .=', t.subject, u.id as poster_id';
$query['JOINS'][] = array(
    'LEFT JOIN'    => 'topics AS t',
    'ON'        => 'f.last_post_id=t.last_post_id'
);
$query['JOINS'][] = array(
    'LEFT JOIN'    => 'users AS u',
    'ON'        => 'f.last_poster=u.username'
);
        ]]></hook>
 
...........................

Thanks man it worked .. 1 more question please

any addon ? i want to install i should put in the folder extenstions?

example : Spam Protection or any addon where should i put it

and for the styles/themes also where should i put the folder or upload it

Thank you for your help

Re: Replace date with Topic

Great extension. I had modded my index.php to do this same thing but this is a lot better.