It is currently Tue Feb 19, 2019 3:22 pm


All times are UTC


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Using phpBB 2.0.21 and CH mod v2.1.6c - need to copy search
PostPosted: Mon Nov 20, 2006 9:10 pm 
Newbie
Newbie

Joined: Tue Nov 07, 2006 8:09 pm
Posts: 37
Hi!

I have been using this mod on phpBB. I want to copy the 'view unanswered posts' search function then edit it to view all topics, but I am a little lost.

This is what I have.

Code:
#
#-----[ OPEN ]------------------------------------------
#
includes/class_search.php

#
#-----[ FIND ]------------------------------------------
#
class topics_search_unanswered extends topics_search
{
   function read()
   {
      global $db, $user;

      $this->forum_id = 0;
      $this->total_topics = 0;
      $this->data_ext = array();

      // get topics without replies
      $sql = 'SELECT t.*
               FROM ' . TOPICS_TABLE . ' t
               WHERE t.topic_replies = 0
                  AND t.forum_id IN(' . implode(', ', $this->authed_forums()) . ')
                  AND t.topic_moved_id = 0
               ORDER BY t.topic_last_post_id DESC';
      $result = $db->sql_query($sql, false, __LINE__, __FILE__);

      // read results
      if ( ($this->total_topics = $db->sql_numrows($result)) && ($this->total_topics > intval($this->parms['start'])) )
      {
         $db->sql_rowseek(intval($this->parms['start']), $result);
         $this->do_read($result, intval($this->parms['ppage']));
      }
      $db->sql_freeresult($result);
      $this->total_items = $this->total_topics;
   }
}

#
#-----[ AFTER, ADD ]------------------------------------------
#

class topics_search_all_posts extends topics_search
{
   function read()
   {
      global $db, $user;

      $this->forum_id = 0;
      $this->total_topics = 0;
      $this->data_ext = array();

      // get topics without replies
      $sql = 'SELECT t.*
               FROM ' . TOPICS_TABLE . ' t
               WHERE t.forum_id IN(' . implode(', ', $this->authed_forums()) . ')
                  AND t.topic_moved_id = 0
               ORDER BY t.topic_last_post_id DESC';
      $result = $db->sql_query($sql, false, __LINE__, __FILE__);

      // read results
      if ( ($this->total_topics = $db->sql_numrows($result)) && ($this->total_topics > intval($this->parms['start'])) )
      {
         $db->sql_rowseek(intval($this->parms['start']), $result);
         $this->do_read($result, intval($this->parms['ppage']));
      }
      $db->sql_freeresult($result);
      $this->total_items = $this->total_topics;
   }
}


#
#-----[ OPEN ]------------------------------------------
#
search.php


#
#-----[ FIND ]------------------------------------------
#
   case 'unanswered':
      $user->read_cookies();
      $search->display_topics();
      break;

#
#-----[ AFTER, ADD ]------------------------------------------
#

   case 'all_posts':
      $user->read_cookies();
      $search->display_topics();
      break;

#
#-----[ OPEN ]------------------------------------------
#
index.php


#
#-----[ FIND ]------------------------------------------
#
   'S_ACTION' => $config->url($requester, array(POST_FORUM_URL => $forum_id), true),

#
#-----[ AFTER, ADD ]------------------------------------------
#
   'L_SEARCH_ALL_POSTS' => $lang['Search_all_posts'],
   'U_SEARCH_ALL_POSTS' => append_sid("includes/class_search.$phpEx?search_id=all_posts&search_forum=$forum_id"),
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php

#
#-----[ FIND ]------------------------------------------
#
#
$lang['Search_unanswered'] = 'View unanswered posts';

#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['Search_all_posts'] = 'View all topics'

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/topics_box.tpl
#
#-----[ FIND ]------------------------------------------
#
      <!-- BEGIN mark --><a href="{forum_header.U_MARK_READ}" class="gensmall">{forum_header.L_MARK_READ}</a><br /><!-- END mark -->

#
#-----[ IN-LINE FIND ]------------------------------------------
#
{L_MARK_TOPICS_READ}</a>

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
- <a href="{U_SEARCH_ALL_POSTS}">{L_SEARCH_ALL_POSTS}</a>

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM


Any help would be appreciated. I asked this question over at the CH mod forum website, but I didn't get a satisfactory answer. The designer of the mod doesn't speak English very well, and he speaks tech-speak much more fluently than I do, so there was a lot lost in translation.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ]  Moderators: Moderators, Support Team

All times are UTC


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

Search for:
Jump to:  
cron
Hosting | Domains | Servers | Extras | Order | Support | Contacts | FreeHostia © 2011