MyBB Community Forums

Full Version: How to split a php command?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I would like to split up the php in this file (inc/language/english/index.lang.php)
$l['stats_posts_threads'] = "Threads: {1} <br />Posts: {2}";
into 2 different code for example:
$l['stats_posts_threads'] = "Threads: {1}";
$l['stats_posts_posts'] = "Posts: {2}";

Is this possible? And then just change the (index_stats) in the template editor from
<div class="Stats_Text"></div><div id="Stats_Bubble">{$lang->stats_posts_threads}</div><br />
<div class="Stats_Text"></div><div id="Stats_Bubble">{$lang->stats_numusers}</div>
<div class="Stats_Text"></div><div id="Stats_Bubble">{$lang->stats_newestuser}</div>
<div class="Stats_Text"></div><div id="Stats_Bubble">{$lang->stats_mostonline}</div>
</span>
</td>
</tr>
to
<div class="Stats_Text"></div><div id="Stats_Bubble">{$lang->stats_posts_threads}</div><br />
<div class="Stats_Text"></div><div id="Stats_Bubble">{$lang->stats_posts_posts}</div><br />
<div class="Stats_Text"></div><div id="Stats_Bubble">{$lang->stats_numusers}</div>
<div class="Stats_Text"></div><div id="Stats_Bubble">{$lang->stats_newestuser}</div>
<div class="Stats_Text"></div><div id="Stats_Bubble">{$lang->stats_mostonline}</div>
You'd have to change any code that uses this language string, which in this case is only one:
index.php:298:	$lang->stats_posts_threads = $lang->sprintf($lang->stats_posts_threads, my_number_format($stats['numposts']), my_number_format($stats['numthreads']));

You could try using $stats['numposts'] and $stats['numthreads'] directly in the template, maybe it would work.

However for your specific code example, you could even add the div br to the original language string. If your board uses multiple languages, that may be a solution.