Comments (10)
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.
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.
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.
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.
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):
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.
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.
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.
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.
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.
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)
- Escape <!-- and I suppose --> HOT 6
- krumo provide more info on a array-casted object than on the object itself HOT 4
- Feature request (and patch) : shift+click to expand all HOT 8
- Javascript bug in version 0.5.6 HOT 4
- Non-static method called statically HOT 14
- Typo in README.md "Usage" section example HOT 1
- Don't truncate after 50 characters HOT 5
- Undefined index: class:: HOT 7
- Update Packagist? HOT 3
- How to change skin? HOT 17
- krumo not showing private and protected properties HOT 2
- Is it possible to 'queue' so they can be displayed in bulk at once HOT 2
- Dropping VERSION file in favor of a class constant HOT 1
- Using a separate method for returning Krumo dumps instead using KRUMO_RETURN as argument HOT 1
- Drop the INSTALL file HOT 1
- Put composer.lock in .gitignore and drop it HOT 3
- Drop "@static" and "@access public" HOT 2
- Drop KRUMO_DIR, replace with __DIR__ HOT 1
- Change how configuration is operated HOT 2
- Krumo doesn't cleanly support PHP 8.1 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from krumo.