Use php number_format for better readability of ranks

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

Moderators: sendtogeo, hellow0rld, eugene

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?

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>";

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) | Indian Support Website. »»Need for Staff/Crew«« PHP Fusion is a Light-Weight Open Source CMS. | Exchange Adwords like text ads
Posts: 18
Joined: Sat Oct 08, 2011 6:54 pm

Re: Use php number_format for better readability of ranks

Postby andy123 » Tue Jun 04, 2019 6:02 am

Thanks for sharing the information php number format.
Posts: 354
Joined: Thu Dec 20, 2018 5:57 am
Location: India

Return to Seo Panel Development

Who is online

Users browsing this forum: No registered users and 1 guest