Giter Club home page Giter Club logo

Comments (10)

scottchiefbaker avatar scottchiefbaker commented on July 18, 2024

I would support this if it's done correctly. If you've already done it to your repo can you post that code?

from krumo.

STaRDoGG avatar STaRDoGG commented on July 18, 2024

Scott:

Glad to hear. =)

No, I haven't done that to mine, or have my own repo of it. I just downloaded it late last night and have been styling it to my own liking. Other than that I've done no coding on it. I thought I'd come here and post the request instead of doing it myself, since you guys are more intimately knowledgeable of how you've done it's coding, it would probably be less "hacky" then.

from krumo.

scottchiefbaker avatar scottchiefbaker commented on July 18, 2024

Also, I've manually done it to my own krumo class, but it'd be nice if it was done to this repo version as well

Sorry I misunderstood. One thing Krumo could use is some CSS clean ups. I'd be curious to see what you've come up with.

from krumo.

STaRDoGG avatar STaRDoGG commented on July 18, 2024

I'll be happy to send my style to ya once I finish it, for you to include (or not) if you choose. It would probably be a bit easier for me to maybe email it to you instead of creating my own full repo of Krumo just for the style sheet.

Regarding the quote: yes, just changing those hard coded strong and em tags is the extent of the 'coding' I've done to the class, those were done with a simple Find & Replace.

Oh yea, I forgot, I also changed some of the Type names in the class to shorten them up a bit (i.e. "String" to "Str", "Integer" to "Int", "Boolean" to "Bool") but that's about it. Idea there was to make the most of screen real estate for viewing the actual data such as the keys and values. Plus I'm sort of used to seeing those types spelled out short like that instead of long. =)

from krumo.

STaRDoGG avatar STaRDoGG commented on July 18, 2024

Well, I messed around with it a bit and whipped up a little bit of code. Here's where I left off (ignore the ugly theme, it's not done. Got sidetracked with this alignment code):

2015-04-29_21-06-47

Where you see the dashes on the right side of some keys is where I left off wrestling with the code. Putting " " (a plain space) as the padding, ends up showing a little info icon saying it contains spaces, along with the spacebar looking icon/text in place of the blank spaces, which is no good for this. If I try to use the html entity "&160;" it'll add those characters to the key instead of a blank space, which is also no good. Using chr(13) does the same as the former. So not sure about how to do this as of right now.

It's possible that adding spaces to the keys themselves might not be the best way to do this; maybe adding padding to the Type that comes after it would be better, but that's a whole different barrel of monkeys.

Here's the code I have so far, which is also possibly not the 'best way' of accomplishing this, as opposed to possibly some built-in PHP array functions instead.

Inserted between in private static function _array():

        } else {
            $sort = 0;
        }

and

        $childCount = count($data);
                /* Padding Begin ----------------------------------------------------- */

                /* Holds the highest key length per array loop*/
                $intHighest = 0;
                /* Create a new temp array */
                $new = array();

                /* Loop the array, checking the length of each key */
                foreach($data as $key => $value) {

                    /* If this key is the longest one so far, add it's length as the highest */
                    if (strlen($key) > $intHighest) {$intHighest = strlen($key);}
                }

                /* Now loop it again, padding the shorter keys to match the longest key */
                foreach($data as $key => $value) {


                    $key = str_pad($key, $intHighest, "-", STR_PAD_RIGHT);
                    $new[$key] = $value;
                }

                /* Save the newly padded array back as the main array */
                $data = $new;

                /* Padding End ------------------------------------------------------- */

from krumo.

scottchiefbaker avatar scottchiefbaker commented on July 18, 2024

I thought about this some more, and it only works if you use a monospace font for your keys. The default (and most) CSS theme uses variable width fonts, which make this less feasible :(

from krumo.

STaRDoGG avatar STaRDoGG commented on July 18, 2024

You're right, I use Source Code Pro as my Krumo font. I add this to my style.css:

@import url(http://fonts.googleapis.com/css?family=Source+Code+Pro:500);

I suppose it could be added in the Krumo config as an option, with a note mentioning 'if using a monospace font the keys will show as justified'?

from krumo.

STaRDoGG avatar STaRDoGG commented on July 18, 2024

I just added this to the krumo.ini:

[align]
; If you use a monospace font in your Krumo CSS, this will justify the arrays (Default: false)
align_arrays = true

And this to the code:

$config_align = Krumo::_config('align','align_arrays', false);

if ($config_align) {
    ...
}

from krumo.

mmucklo avatar mmucklo commented on July 18, 2024

This is an old thread, but reading this it seems that the best way to do this would be to bit the bullet and use html tables here, I could be wrong...

from krumo.

scottchiefbaker avatar scottchiefbaker commented on July 18, 2024

Reworking the whole thing in tables would be pretty complex. It may be "cheating" but doing it with a monospace font isn't a bad way to go.

from krumo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.