Display topics solved in Index page  Topic is solved

Discussion, requests and support for the Topic solved MOD.
No testing here
Forum rules
No testing here.
All testing must be done in the testing area.

Display topics solved in Index page

Postby ma_khan » 16 Sep 2009, 12:42

Is there a way to display the number of topics solved in the index page so that people can find out how many posts were there are how many were solved... Thanks

Please let me know.
ma_khan
 
Posts: 5
Joined: 16 Sep 2009, 12:38

Re: Display topics solved in Index page

Postby tumba25 » 17 Sep 2009, 02:00

You'd have to scan trough all rows in the topics table. With some thousand topics that might take a while. I'd run some cron script for that. Just count the topics where topic_solved > 0.
What is a Regular Expression?

  1. Regular Expressions are a means by which IT People confuse non IT people
  2. Regular Expressions are horribly cryptic
  3. Regular Expressions give the wrong answer
User avatar
tumba25
Site Admin
 
Posts: 287
Joined: 25 Jun 2007, 16:41
Location: Tumba, Sweden.

Re: Display topics solved in Index page

Postby ma_khan » 17 Sep 2009, 16:13

Thanks tumba25,

That did get me the result. But I am really new with PHPBB 3 and really confused with all the changes :)

I need to display this result along with the statistics at the bottom of the index.php page with the other default statistics that are shown. I know I would need to have one modification in lang file. But can u please tell me where do i need to put this sql query to get the result displayed in the index.php page please.

I dont really have a large database so I am directly running the query as

Code: Select all
mysql> select count(*) from phpbb_topics where topic_solved>0;


and this is working like a charm on MySql ... but I need this on my index.php page... please help... Thanks in advance...
ma_khan
 
Posts: 5
Joined: 16 Sep 2009, 12:38

Re: Display topics solved in Index page

Postby tumba25 » 17 Sep 2009, 17:23

That should go in index.php and index_body.html.
What is a Regular Expression?

  1. Regular Expressions are a means by which IT People confuse non IT people
  2. Regular Expressions are horribly cryptic
  3. Regular Expressions give the wrong answer
User avatar
tumba25
Site Admin
 
Posts: 287
Joined: 25 Jun 2007, 16:41
Location: Tumba, Sweden.

Re: Display topics solved in Index page

Postby ma_khan » 17 Sep 2009, 19:00

Hi I tried that, but not successful... I am listing the change I made may be you can correct me where I am wrong...

\index.php

Search :
Code: Select all
$template->assign_vars(array(


Add before:
Code: Select all
// Start of the total topics solved information on the index page

$sql = 'SELECT count(*) FROM '. TOPICS_TABLE . " WHERE topic_solved > 0";
           
           $result = $db->sql_query($sql);
           
           while ($row = $db->sql_fetchrow($result))
            {
                   $total_topics_solved = $row['count(*)'];
            }
           
      $db->sql_freeresult($result); 
     
// End of the total topics solved information on the index page   


Search:
Code: Select all
'NEWEST USER'


Add after in a new line after that line

Code: Select all
'TOTAL_TOPICS_SOLVED' => sprintf($user->lang['TOTAL_TOPICS_SOLVED'], $total_topics_solved),


\language\en\common.php

Search:
Code: Select all
));


Add Before in a new line:

Code: Select all
'TOTAL_TOPICS_SOLVED'      => 'Total Topics Solved %s',


\styles\prosilver\template\index_body.html

Search:
Code: Select all
{NEWEST_USER}


Add in-line After
Code: Select all
• {TOTAL_TOPICS_SOLVED}


I have tried purging the cache, web browser cache and refreshing the templates and themes for prosilver... Please help and thanks for the help so far.
ma_khan
 
Posts: 5
Joined: 16 Sep 2009, 12:38

Re: Display topics solved in Index page

Postby tumba25 » 17 Sep 2009, 19:16

Do you get any result? If so, what result do you get? Any error messages?

ma_khan wrote:
Code: Select all
// Start of the total topics solved information on the index page
$sql = 'SELECT count(*) FROM '. TOPICS_TABLE . " WHERE topic_solved > 0";
           $result = $db->sql_query($sql);
           while ($row = $db->sql_fetchrow($result))
            {
                   $total_topics_solved = $row['count(*)'];
            }
      $db->sql_freeresult($result); 
// End of the total topics solved information on the index page

You can drop the while loop, you only want one row.
Code: Select all
// Start of the total topics solved information on the index page
  $sql = 'SELECT count(*) FROM '. TOPICS_TABLE . " WHERE topic_solved > 0";
  $result = $db->sql_query($sql);
  $row = $db->sql_fetchrow($result);
  $total_topics_solved = $row['count(*)'];
  $db->sql_freeresult($result); 
// End of the total topics solved information on the index page


ma_khan wrote:
Code: Select all
  'TOTAL_TOPICS_SOLVED'      => 'Total Topics Solved %s',
Try %d
What is a Regular Expression?

  1. Regular Expressions are a means by which IT People confuse non IT people
  2. Regular Expressions are horribly cryptic
  3. Regular Expressions give the wrong answer
User avatar
tumba25
Site Admin
 
Posts: 287
Joined: 25 Jun 2007, 16:41
Location: Tumba, Sweden.

Re: Display topics solved in Index page

Postby ma_khan » 17 Sep 2009, 19:40

Nope no effect with the current changes as well.. The odd thing is that there is no change on the index.php page... there is no change even in the Statistics area... I must be missing something for sure...

I know that our SQL query is running good.. I created a test php page with our query and it returns correct data... Is there any other page that I might need to modify, other than common.php, index.php and index_body.htm???
ma_khan
 
Posts: 5
Joined: 16 Sep 2009, 12:38

Re: Display topics solved in Index page  Topic is solved

Postby tumba25 » 17 Sep 2009, 19:58

Sounds like a cache error. Try setting "Recompile stale style components" to yes, it's in ACP > General > Load settings. And then purge the cache and refresh the style. Also make sure you are editing the same template that you use.
What is a Regular Expression?

  1. Regular Expressions are a means by which IT People confuse non IT people
  2. Regular Expressions are horribly cryptic
  3. Regular Expressions give the wrong answer
User avatar
tumba25
Site Admin
 
Posts: 287
Joined: 25 Jun 2007, 16:41
Location: Tumba, Sweden.

Re: Display topics solved in Index page

Postby ma_khan » 17 Sep 2009, 20:12

Yes it was a caching problem as you said... We were doing everything right ... :)

PHPBB was not able to purge my cache files.. once I gave the cache folder 777 permissions... we are good to go...

I have got it... Thanks!
ma_khan
 
Posts: 5
Joined: 16 Sep 2009, 12:38


Return to Topic solved

Who is online

Users browsing this forum: No registered users and 1 guest

cron