[personal profile] marahmarie posting in [community profile] style_system

I'm reading an old tutorial on [livejournal.com profile] s2_bloggish on how to add custom modules into your sidebar but when I copy the s2 shown there into my custom theme layer I get the message Compile error: line 181, column 1: Can't set non-existent property 'sidebar_primary'. Does anyone know what the right wording is to convert the s2 over to Dreamwidth?

Code in question:

set sidebar_primary =  [
                    [ "userprofile", "Userpic Title", "0", "1" ],
                    [ "viewlinks", "Viewlinks Title" ],
                    [ "customtext" ],
                    [ "calendar" ],
                    [ "links", "Links Title" ],
                    [ "tags", "Tags Title" ],
                    [ "pagesummary", "Summary Title" ],
                    [ "syndicate", "Syndicate Title" ],
                    [ "poweredby", "Poweredby Title" ],

                ]; 

ETA: as [personal profile] ninetydegrees has rightfully pointed out, I linked and am referring in the title and throughout the post to the wrong thing altogether. I probably meant to refer to this: http://s2-bloggish.livejournal.com/4940.html


ETA2, 4-27: solved this by comparing Carrie's code to ninety's, then stared at strings in DW's Cookbook until it just kind of clicked. DW syntax that works is as follows (in which less is more but sometimes more is less, so I just did whatever worked - you can probably vary wildly from the syntax I chose and still succeed if you know what you're doing):

function print_module_customtext() {
    var Page p = get_page();
    open_module("customtext", $*text_module_customtext, $*text_module_customtext_url);
        close_module();

  open_module("customtext", $*text_module_customtext, $*text_module_customtext_url);
     """
     ***put your free text here***
     """;
  close_module();

  open_module("customtext", $*text_module_customtext, $*text_module_customtext_url);
     """
     ***put your second free text selection here***
     """;
  close_module();


  open_module("customtext", $*text_module_customtext, $*text_module_customtext_url);
     """
     ***put your third free text selection here; you can rinse and repeat pretty much indefinitely***
     """;
  close_module();

} 

With many thanks to [personal profile] ninetydegrees as always for being super-helpful (and for having super-helpful links!).

Date: 2014-04-27 12:08 am (UTC)
ninetydegrees: Art: self-portrait (Default)
From: [personal profile] ninetydegrees
This code doesn't let you add custom modules; it lets you change their position and their titles, which are not customizable in Bloggish (or LJ layouts in general).

If you want to create a new module, you have to create a certain number of properties, create the function for the module itself then call the function where other module functions are called (i.e. a group with _show, _order and _section, a print_module function then some bits added to modules_init and handle_module_group_array).

If you're not very familiar with S2, the easiest way to do this is to look at the simpler modules like customtext or poweredby and search for them in Core2 --http://www.dreamwidth.org/customize/advanced/layersource?id=550&fmt=html-- to see where the related code is then copy the code, change the names and edit the bits related to the module title and content.

I don't know what you know so sorry if I'm too vague or repeated things you already knew. Let me know what you need.

Edit: and mmmag has a layer which shows exactly this! http://style-system.dreamwidth.org/41643.html?thread=256427#cmt256427

Edit: this is of course, if you want to have custom modules which are not directly below or above the existing custom module. Like profile/custom/tags/custom, etc... Otherwise something like http://style-system.dreamwidth.org/78674.html#comments would work (although the code may have changed a bit; you'd need to check Core2). Editing other existing modules to add a custom module below them is a also possibility.
Edited (accuracy! and awesomeness) Date: 2014-04-27 12:15 am (UTC)

Re: Questions (edited)

Date: 2014-04-27 03:38 am (UTC)
foxfirefey: A guy looking ridiculous by doing a fashionable posing with a mouse, slinging the cord over his shoulders. (geek)
From: [personal profile] foxfirefey
"print safe" doesn't do anything in user level layers except print things out like usual. When it's in system layers, it'll print out something without escaping the output, because it knows it can print it out without exposing anybody to exploits.

Re: Questions (edited)

Date: 2014-04-27 03:54 am (UTC)
foxfirefey: A wee rat holds a paw to its mouth. Oh, the shock! (myword)
From: [personal profile] foxfirefey
Hmm, maybe try just a regular print? Maybe I am wrong and it doesn't print if it can't use print safe!

Profile

Dreamwidth style system discussion

February 2026

S M T W T F S
1234567
89 1011121314
15161718192021
22232425262728

Style Credit

Expand Cut Tags

No cut tags
Page generated Mar. 5th, 2026 04:11 pm
Powered by Dreamwidth Studios