Rev. Ainabarad ([info]ainabarad) wrote in [info]s2flexisquares,
@ 2008-05-08 18:09:00
Previous Entry  Add to memories!  Tell a Friend!  Next Entry
Current mood: stressed
Entry tags:sidebar, solved

SOLVED! - Merging Two Print_Sidebar Functions?
My Layer ID: #10317219

Can someone please tell me how to merge the two function print_sidebar() functions in my theme layer? I feel so dumb, I've been trying to merge them for over an hour now and I'm giving up for now because I just can't figure out what I'm doing wrong. It looks so simple, but-!!@#$#% Thanks so very much in advance.




(Post a new comment)


[info]kentucka
2008-05-08 10:34 pm UTC (link)
what are you trying to do?

the first one only sets a very fixed order, so you won't be able to choose it in the customization wizard.
the second one prints the first four(although there should be 6) as set in the customization wizard, then prints the random quote box.

add the following lines to the second print_sidebar:
  sidebar_order($*sidebar_order_1);
  sidebar_order($*sidebar_order_2);
  sidebar_order($*sidebar_order_3);
  sidebar_order($*sidebar_order_4);
  sidebar_order($*sidebar_order_5);
  sidebar_order($*sidebar_order_6);
  
  # declare and initialize variables
then set the order you like in the customization wizard (the Show? boxes to yes, and the order)

then delete the first # SIDEBAR BOX PLACEMENT print_sidebar function from your layer, and leave the random movie quote one.

(Reply to this)(Thread)


[info]ainabarad
2008-05-08 10:57 pm UTC (link)
I'm trying to merge the extra sidebar box tutorial (either of them, preferably no advertisements though) and this tutorial:
http://community.livejournal.com/s2flexisquares/50815.html

I don't mind using the wizard, but I'd like to set up my theme layer so I don't have to use the wizard. I want the random quote to appear right above the multilevel tags. I really need to figure out how to get it to work properly because there is another tutorial I really want to add for another extra sidebar box if I can ever find it-one with html and a random image, I doubt the same code from my component layer would work the same for that in Flexible Squares. I'm sorry I'm such a ditz. I'm not understanding mixing them at all.

(Reply to this)(Parent)(Thread)


[info]kentucka
2008-05-08 11:18 pm UTC (link)
you can still do what I said in the above comment first, and go from there.

don't worry about the ad, it won't ever be printed on your LJ in your style, because you're a paid user.

afterwards, change your code like so. I had to edit out all the quotes otherwise the code snippet would have become too long for a comment, so just paste it back in.

all I did was: take the 'print first/second/... box' parts, and moved it down after the part that generates the random quotes. and then I put the one line that actually prints the random quote box between some of the boxes that are printed by the customization wizard. if you don't want to it to be after the fourth box, just move it whereever you'd like it.
function print_sidebar() {

  var string header  = "";
  var string content = "";
  
  # declare and initialize variables
  var string[] random_quotes;
  var int      random_quotes_index       = 0;
  var int      random_quote              = 0;

  # set header and quotes array
  $header                                = "FOR MOVIE LOVERS";
  $random_quotes[$random_quotes_index++] = "Don't mock me my friend. It's a condition of mental divergence. I find myself on the planet Ogo, part of an intellectual elite, preparing to subjugate the barbarian hordes on Pluto. But even though this is a totally convincing reality for me in every way, nevertheless Ogo is actually a construct of my psyche. I am mentally divergent, in that I am escaping certain unnamed realities that plague my life here. When I stop going there, I will be well. Are you also divergent, friend?<br><b><small>- 12 Monkeys (1995)</b></small>";
  $random_quotes[$random_quotes_index++] = "Sharks are like dogs, they only bite if you touch their private parts.<br><b><small>- 50 First Dates (2004)</b></small>";
  # and so on... just illustrating here. Paste the rest of the quotes back in here.

  # get random quote index number
  $random_quote                          = rand(0, size($random_quotes) - 1);
  # set content
  $content                               = $random_quotes[$random_quote];
  
  # print the first box as set in customization wizard
  sidebar_order($*sidebar_order_1);
  
  # print the second box as set in customization wizard
  sidebar_order($*sidebar_order_2);
  
  # print the third box as set in customization wizard
  sidebar_order($*sidebar_order_3);
  
  # print the fourth box as set in customization wizard
  sidebar_order($*sidebar_order_4);
  
  # print additional box for the random movie quote
  print_sidebar_box($header, $content);
  
  # print the fifth box as set in customization wizard
  sidebar_order($*sidebar_order_5);
  
  # print the sixth box as set in customization wizard
  sidebar_order($*sidebar_order_6);


}


Edited at 2008-05-08 11:21 pm UTC

(Reply to this)(Parent)(Thread)


[info]ainabarad
2008-05-08 11:41 pm UTC (link)
It's not working properly... See? Weirdness. It's showing up, but it's merging with my icon (so to speak) and the multilevel tags jumped down to beneath the calendar! LOL How do I get them to appear correctly and in the right order?

(Reply to this)(Parent)(Thread)


[info]kentucka
2008-05-08 11:57 pm UTC (link)
change this part:
  # print additional box for the random movie quote
  print_sidebar_box("""<li class="sbartitle">"""+$header+"""</li>""", """<li class="sbaritem">"""+$content+"""</li>""");
the boxes aren't merging, the title just isn't displaying as a proper sidebar title. these <li></li> things need to be added around the header and the content for the box, then it shows like the standard boxes.

I can't tell you more about the order than the tutorial already does: set up the order of the boxes in the wizard first, then move the printing line of code of the additional box in between the ones where you'd like it to appear.

(Reply to this)(Parent)(Thread)


[info]ainabarad
2008-05-09 12:05 am UTC (link)
Okay, I'll wait and use the wizard. *sigh* ;)

Thank you very, very much for helping me.

(Reply to this)(Parent)(Thread)


[info]kentucka
2008-05-09 12:08 am UTC (link)
if you don't want the wizard, which I can empathize with, your alternative is adding all the necessary set statements to your user or theme layer manually, so that you have a working order of boxes.

(Reply to this)(Parent)(Thread)


[info]ainabarad
2008-05-09 12:30 am UTC (link)
Yep. Is there a reference for Flexible Squares properties so I know what lines to add? I haven't found one yet so I keep glancing at this even though it's a completely different layout. I don't know why everything seems so very different. Both styles are s2 after all. I thought maybe mixing sidebar boxes in FS would be as easy as Comp where you just add lines like $p->lay_print_summary(); between extra boxes in function print_free_text(Page p) {. I swear FS seems so very different. Are they really that different? LOL I'm going to attempt (when I find the time - my little boy keeps me busy) to turn my random image/about me component into a FS sidebar box and, if I succeed (so far my attempts to do that today have been complete failures), I'll let you know in case you want to post a tutorial for it.

Oh! Quick question: How can I get the random quote to have "justify" alignment? I tried adding it in a similar way as it is on my comp theme layer and it doesn't work.

(Reply to this)(Parent)(Thread)


[info]kentucka
2008-05-09 09:29 am UTC (link)
real quick because I'm late already:
http://www.livejournal.com/customize/advanced/layerbrowse.bml?id=4472608
I always look at the Flexible Squares source for all the properties.
the show_ decide if certain stuff is displayed
the sidebar_order_ set the order in which that stuff is to be displayed.

more after the weekend :)

(Reply to this)(Parent)


Create an Account
Forgot your login?
Login w/ OpenID
English • Español • Deutsch • Русский…