Use php number_format for better readability of ranks

Discuss about Seo Panel development - classes,plugins,common function etc

Moderators: hellow0rld, eugene, sendtogeo

Use php number_format for better readability of ranks

Postby Karel » Sun Dec 20, 2015 11:35 am

Especially Alexa ranks are hard to read with out a thousand separator.

I've modded rank.ctrl.php a little to improve readability for alexa ranks. Unfortunately only for the rank difference, but this works for all themes. The actual rank must be modded in active theme for example in \themes\classic\views\rank\rankreport.ctp.php. But I'm looking for a way to make it universal without modifying every theme. Any one a so solution for this?

\controllers\rank.ctrl.php
Find:
Code: Select all
               if ($rankDiff[$col] > 0) {
                  $rankDiff[$col] = "<font class='$greaterClass'>($rankDiff[$col])</font>";
               }elseif ($rankDiff[$col] < 0) {
                  $rankDiff[$col] = "<font class='$lessClass'>($rankDiff[$col])</font>";


Replace:
Code: Select all
               if ($rankDiff[$col] > 0) {
                  $rankDiff[$col] = "<font class='$greaterClass'>(".number_format($rankDiff[$col], 0, ',', '.').")</font>";
               }elseif ($rankDiff[$col] < 0) {
                  $rankDiff[$col] = "<font class='$lessClass'>(".number_format($rankDiff[$col], 0, ',', '.').")</font>";


I've formatted the number for European style. So a .(dot) is a thousand seperator. If you want a , as thousand separator switch the . and , in the number_format.

Request for the developers! Please consider use of formatted numbers everywhere for better readability and let users/admins choose what thousand separator they want. (option in admin panel)
http://www.php-fusion.in | Indian Support Website. »»Need for Staff/Crew««
PHP Fusion is a Light-Weight Open Source Content Management System (CMS).
Ex-Ads.com | Exchange Adwords like text ads
Karel
 
Posts: 17
Joined: Sat Oct 08, 2011 6:54 pm

Return to Seo Panel Development

Who is online

Users browsing this forum: No registered users and 2 guests