Posted: 25 Jul 2012, 13:33
================
Database and Demo for phpBB3 BBCodes, Mods and Smilies
https://phpbb3bbcodes.com/
Any help for this?Rhyno3000 wrote:Heya I just applied this in my forum.... Can some one give me the code for the donation goal to get the percent working.... couldn't find it in the file
Stoker wrote:Try:number_format($forum_goals_posts_percent, 2),
Thats what Im using.
Code: Select all
<?php
/**
*
* @package phpBB3
* @version $Id: functions_forum_goals.php v1.0.3 2011/05/12 $
* @copyright (c) 2011 PhpBB3 BBCodes
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Include only once.
*/
if (!defined('INCLUDES_FUNCTIONS_FORUM_GOALS_PHP'))
{
define('INCLUDES_FUNCTIONS_FORUM_GOALS_PHP', true);
if (!empty($config['forum_goals_posts_enable']) && $config['forum_goals_posts'] > 0)
{
$forum_goals_posts_percent = ($total_posts * 100) / $config['forum_goals_posts'];
$forum_goals_posts_rest = $config['forum_goals_posts'] - $total_posts;
$template->assign_vars(array(
'FPG_ENABLE' => $config['forum_goals_posts_enable'],
'FORUM_POST_GOAL' => $config['forum_goals_posts'],
'FORUM_POST_PERCENT' => number_format($forum_goals_posts_percent, 2),
'FORUM_POST_REST' => $forum_goals_posts_rest,
));
}
if (!empty($config['forum_goals_topics_enable']) && $config['forum_goals_topics'] > 0)
{
$forum_goals_topics_percent = ($total_topics * 100) / $config['forum_goals_topics'];
$forum_goals_topics_rest = $config['forum_goals_topics'] - $total_topics;
$template->assign_vars(array(
'FTG_ENABLE' => $config['forum_goals_topics_enable'],
'FORUM_TOPIC_GOAL' => $config['forum_goals_topics'],
'FORUM_TOPIC_PERCENT' => number_format($forum_goals_topics_percent, 2),
'FORUM_TOPIC_REST' => $forum_goals_topics_rest,
));
}
if (!empty($config['forum_goals_users_enable']) && $config['forum_goals_users'] > 0)
{
$forum_goals_users_percent = ($total_users * 100) / $config['forum_goals_users'];
$forum_goals_users_rest = $config['forum_goals_users'] - $total_users;
$template->assign_vars(array(
'FUG_ENABLE' => $config['forum_goals_users_enable'],
'FORUM_USER_GOAL' => $config['forum_goals_users'],
'FORUM_USER_PERCENT' => number_format($forum_goals_users_percent, 2),
'FORUM_USER_REST' => $forum_goals_users_rest,
));
}
if (!empty($config['forum_goals_files_enable']) && $config['forum_goals_files'] > 0)
{
$total_files = $config['num_files'];
$l_total_file_s = ($total_files == 0) ? 'TOTAL_FILES_ZERO' : 'TOTAL_FILES_OTHER';
$forum_goals_files_percent = ($total_files * 100) / $config['forum_goals_files'];
$forum_goals_files_rest = $config['forum_goals_files'] - $total_files;
$template->assign_vars(array(
'FFG_ENABLE' => $config['forum_goals_files_enable'],
'TOTAL_FILES' => sprintf($user->lang[$l_total_file_s], $total_files),
'FORUM_FILES_GOAL' => $config['forum_goals_files'],
'FORUM_FILES_PERCENT' => number_format($forum_goals_files_percent, 2),
'FORUM_FILES_REST' => $forum_goals_files_rest,
));
}
if ((class_exists('phpbb_gallery_integration')) && !empty($config['forum_goals_gallery_enable']) && $config['forum_goals_gallery'] > 0)
{
$forum_goals_gallery_percent = (phpbb_gallery_config::get('num_images') * 100) / $config['forum_goals_gallery'];
$forum_goals_gallery_rest = $config['forum_goals_gallery'] - phpbb_gallery_config::get('num_images');
$template->assign_vars(array(
'FGG_ENABLE' => $config['forum_goals_gallery_enable'],
'FORUM_GALLERY_GOAL' => $config['forum_goals_gallery'],
'FORUM_GALLERY_PERCENT' => number_format($forum_gallery_topics_percent, 2),
'FORUM_GALLERY_REST' => $forum_goals_gallery_rest,
));
}
if (!empty($config['forum_goals_views_enable']) && $config['forum_goals_views'] > 0)
{
$sql = 'SELECT SUM(topic_views) AS count
FROM ' . TOPICS_TABLE . '
WHERE topic_approved = 1';
$result = $db->sql_query($sql);
$total_views = (int) $db->sql_fetchfield('count');
$forum_goals_views_percent = ($total_views * 100) / $config['forum_goals_views'];
$forum_goals_views_rest = $config['forum_goals_views'] - $total_views;
$template->assign_vars(array(
'FTVG_ENABLE' => $config['forum_goals_views_enable'],
'TOTAL_VIEWS' => $total_views,
'FORUM_VIEW_GOAL' => $config['forum_goals_views'],
'FORUM_VIEW_PERCENT' => number_format($forum_goals_views_percent, 2),
'FORUM_VIEW_REST' => $forum_goals_views_rest,
));
}
}
?>
So would i change this bit in the index.phpStoker wrote:Its in the index.php file
Code: Select all
if (!empty($config['donation_goal_enable']) && $config['donation_goal'] > 0)
{
$donation_goal_number = ($config['donation_achievement'] * 100) / $config['donation_goal'];
$donation_goal_rest = $config['donation_goal'] - $config['donation_achievement'];
$template->assign_vars(array(
'DONATION_GOAL_NUMBER' => number_format($donation_goal_number, 2),
'DONATION_GOAL_REST' => $donation_goal_rest,
));
}
Exactly what i was looking for thanks...Stoker wrote:This is the exact code from index.phpCode: Select all
if (!empty($config['donation_goal_enable']) && $config['donation_goal'] > 0) { $donation_goal_number = ($config['donation_achievement'] * 100) / $config['donation_goal']; $donation_goal_rest = $config['donation_goal'] - $config['donation_achievement']; $template->assign_vars(array( 'DONATION_GOAL_NUMBER' => number_format($donation_goal_number, 2), 'DONATION_GOAL_REST' => $donation_goal_rest, )); }