piranha: red origami crane (Default)
[personal profile] piranha
i'm feeling slightly competent now that i've given S2 a semi-serious look. i've been bugged by not having "military" time on my entries, and this isn't an easily customisable feature of the layout i am currently using (generator). so i had to learn enough of S2 to make that happen. it wasn't actually that hard, or maybe i still have what it takes; i've always been good at grasping the overall workings of a programming language even if i don't actually know it yet.


1. go to advanced customization click Your Layers, and create a new user layer specific to your layout of choice (generator). why a new user, and not a layout layer? because if i understand it correctly, if you're just gonna be tweaking some properties and maybe override a function or two, this is the best way to maintain a connection with the original layout, so if that gets improved, your own layout will still inherit all the new stuff ( minus of course in the areas where you're gonna be overriding the original). i picked user instead of theme layer here because i was following an article saying so, but i now see that that's not a good idea, because user layers can get overritten by the customization wizards). gotta change that to a theme layer tomorrow. oh, even though the S2 manual says a user layer doesn't allow for function overrides, it does.

ok, layer created. edit it. name it something useful. compile.

2. go back to advanced customization and click Your Styles. create a new style (with a useful name, like, oh, custom-generator, to distinguish it from the wizard-generator). choose your layout (generator), which brings up more dropdown boxes, and your new user layer should become accessible through the user dropdown menu. save changes.

now you can switch between your previous style(s) and this new one. nifty.

3. use the new style.

4. go back to Your Layers. edit the new user layer. open a new tab, go to advanced customization and click Public Layers. click on your layout (generator), Download. open another tab with the S2 manual. study the code and learn S2 by osmosis. :)

in specific, locate function print_entry. copy the entire function into your edit layer window, underneath the two top lines.

focus on this bit of code:

var string datetime;
    $datetime = $e.time->date_format("med")+"|<b>"
        + $e.time->time_format() + "</b>";


change that last line to:

        + $e.time->time_format("%%HH%%:%%min%%") + "</b>";


compile. refresh your journal. enjoy the lovely military time display. write an LJ entry to preen.
(will be screened)
(will be screened if not validated)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org

Profile

piranha: red origami crane (Default)
renaissance poisson

July 2015

S M T W T F S
   123 4
567891011
12131415161718
19202122232425
262728293031 

Most Popular Tags

Expand Cut Tags

No cut tags