[paid accounts] Adding more boxes to the sidebar/ Using HTML in boxes in the sidebar

Jun 04, 2005 00:15

1. Create a new theme layer. (Follow the steps in this post to create a theme layer.) If you have already created a theme layer for the style, just add the following code to it.

2. Copy the following and modify the parts in red as you see fit. Paste it in the theme layer and compile.

code )

!tutorial, !old, sidebar, paid accounts

Leave a comment

Comments 192

tikifreak June 6 2005, 00:28:07 UTC
Is there a way to set the size of the sidebar boxes? I have a lot of text to put in the boxes but I don't want it taking up the whole side of my layout!

Any help would be great. Thanks!

Reply

afuna June 7 2005, 10:42:18 UTC
http://www.livejournal.com/customize/ -> Edit Customizations -> Sidebar tab -> Set sidebar width in pixels :)

Reply


roark28 June 7 2005, 14:29:27 UTC
It says I have an error [Compile error: line 225, column 1: Unknown local variable $extra3_title] when I try to add another box. All we have to do is copy/paste another "$extra2_title= """..." and change the "2" to "3", and add a "print_sidebar_box($extra3_title, $extra2_content);" after the other two in the green part right? Thanks ^^

Reply

roark28 June 7 2005, 14:30:33 UTC
I meant "print_sidebar_box($extra3_title, $extra3_content);", sorry.

Reply

cyrnelle June 7 2005, 14:38:02 UTC
You have to declare the variables first. :)

var string extra1_title ="";
var string extra1_content ="";
var string extra2_title ="";
var string extra2_content ="";
var string extra3_title ="";
var string extra3_content ="";

and so on. You didn't have the lines in red.That's why it's saying that the variable is unknown.

Reply

roark28 June 7 2005, 14:39:02 UTC
Ah ok, thanks ^^

Reply


(The comment has been removed)

afuna June 11 2005, 17:43:46 UTC
If you're using the method shown in this tutorial (print_sidebar_box()), you can use css to make your text center-aligned :)

Insert the following code into your print_custom_head() (refer to this tutorial on using print_custom_head() if needed):

.sbarbody{
text-align:center;
}
.sbarbody2{
text-align: center;
}

.sbarbody2 controls how the blurb/freetext is displayed. .sbarbody controls how everything else in the sidebar is displayed :)

Reply

(The comment has been removed)

afuna June 12 2005, 09:46:45 UTC
Heya, sorry but er could you tell me how you want it to appear? I'm not sure what you're aiming for -- the first picture that you posted is what I was thinking of when I thought "centered".

If you can give me a few more details, I might be able to figure out how to accomplish it. Thanks :)

Reply


mumblemutter June 13 2005, 09:55:23 UTC
is it possible to do this as well as add a summary of the posts in the sidebar?

Reply

miome June 13 2005, 14:07:18 UTC
Absolutely. Use the code from the Summary tutorial, but replace the util::print_sidebar function with this:
function util::print_sidebar(string summary)
{
var string extra1_title ="";
var string extra1_content ="";
var string extra2_title ="";
var string extra2_content ="";

$extra1_title = """
  • Title of New Box 1
  • """;
    $extra1_content = """
  • Text for New Box 1. You can use HTML here if you want to.
  • """;

    print_userpic();
    print_sidebar_blurb();
    if($summary != ""){
    print_sidebar_box("
  • Summary
  • ", $summary);
    }
    print_sidebar_linklist();
    print_sidebar_box($extra1_title, $extra1_content);
    print_sidebar_box($extra2_title, $extra2_content);
    print_sidebar_calendar();
    }

    Reply

    mumblemutter June 13 2005, 14:26:53 UTC
    dude. thank you so very very much! you rock like a rocking thing.

    Reply

    stickykeys633 October 12 2005, 18:15:31 UTC
    I'm trying this, but I keep getting the following errors:

    S2 Compiler Output at Wed Oct 12 11:15:10 2005
    Error compiling layer:

    Compile error: line 182, column 1: Can't declare function util::print_sidebar(string) for non-existent class 'util'
    S2::NodeFunction, S2/NodeFunction.pm, 159
    S2::Checker, S2/Checker.pm, 339
    S2::Compiler, S2/Compiler.pm, 34

    Context

    178: print """ | """;
    179: $this->print_postlink();
    180: }
    181:
    182: function util::print_sidebar(string summary)
    183: {
    184: var string extra1_title ="";
    185: var string extra1_content ="";
    186: var string extra2_title ="";

    Reply


    cenedrawood June 19 2005, 19:24:48 UTC
    i get an error like this

    38: var string extra9_content ="";
    39:
    40: $extra1_title = """
  • Friends Filters
  • """;
    41: $extra1_content = """

  • LJ PORTAL
    42:
    I-R-L

    when i try and compile. can you tell me what is the matter, and how to fix it?
  • Reply

    afuna June 20 2005, 17:20:41 UTC
    It's difficult to tell what's wrong. Could you try escaping the HTML and then reposting it? Either replace all < with < and all > with >, or use this tool.

    Also, could you tell us the exact text of the error (should be the top line), as well as which line the error is in? (that line should be in red, or else the line number will be mentioned within the first two-three lines). Thanks ;)

    Reply


    Leave a comment

    Up