I'm reading an old tutorial on
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
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
ninetydegrees as always for being super-helpful (and for having super-helpful links!).
no subject
Date: 2014-04-27 12:08 am (UTC)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.
Questions (edited)
Date: 2014-04-27 12:28 am (UTC)Yes, indeed, *headdesk*; maybe this was what I should've linked to?
http://s2-bloggish.livejournal.com/4940.html
Oh OK, just saw your edits - and yes, awesomeness; I'll check those out and amend this reply only if I need more info and/or help from you - thanks! :)
Can I ask...the module is not showing up (with nor without the edits I've made to it) and I was wondering if
print safe $*text_module_customtext_content;has anything to do with it (I can just barely understand s2 but the only thing I can recall aboutprint safeis that I've not been using it since I was still on LJ - and even on LJ I think I used it for the blog title link alone).Direct link to my theme layer (it's viewable) with code from the second link you gave me at the bottom:
http://www.dreamwidth.org/customize/advanced/layersource?id=116552&fmt=html
Re: Questions (edited)
Date: 2014-04-27 03:38 am (UTC)Re: Questions (edited)
Date: 2014-04-27 03:52 am (UTC)Re: Questions (edited)
Date: 2014-04-27 03:54 am (UTC)Re: Questions (edited) - and wiki pages are broken - literally
Date: 2014-04-27 12:43 pm (UTC)print safeor not (or more specifically, I don't know if usingprint safeis what kept the code from printing! and that's still an interesting question, either way) but I wound up just digging into it myself, and found that LJ uses some code we don't use so I replaced theirs with ours, where needed (but LJ uses some code we just don't need) and tookprint safeout altogether (but did not replace it with any form ofprintsince strings print withoutprintbeing called). I'm not running the code 'live' just yet so it's hidden via my CSS for now, but you can see the result of the syntax I chose in my source (I've updated the OP with it, as well).Also, can someone please fix the wiki (check the page I just linked you to)? The page is broken (printing backend code, it looks like) across the entire top half of it.