Oct. 9th, 2009


[info]thesewarmstars

How to change entry title colors?

Does anyone know how to change the color of the text in an entry title?

I would also like to know how to change the color of the text in the titles of the modules (i.e. Page Summary, Tags), if anyone knows that.

Thanks!

Aug. 30th, 2007

[info]carriep63

[Paid] Multi-Level Tags in Sidebar

This code is almost identical to the tutorial found at the livejournal expressive community. That is because I blatantly stole it and adapted it slightly to work for Bloggish by changing the classes and one measly line of code.

As usual, you may change the stuff in green.

[Edit] Just when I thought I went and did something clever, I found out it's unecessary. Looks like the original code was written for Bloggish, too. Here it is.

function print_module_tags(string title) {

  # Specify your delimiter.  One character only -- extra chars get truncated.
  var string delimiter = ":";

  # Do you want to show the tag use counts?
  var bool show_count = true;

  # Specify the text to show just before the use count, if any
  var string pre_count = "(";

  # Specify the text to show just after the use count, if any
  var string post_count = ")";

  ### Don't change below unless you know what you are doing!

  var Page p = get_page();
  var string list = "";

  if (size $p->visible_tag_list() > 0) {
    if ($delimiter->length() > 1) {
      $delimiter = $delimiter->substr(0, 1);
    }

    var string[] closing_html;
    var string[] prev_tags;
    var int tag_list_pos = 0;
    var string tier_code = "";
    $closing_html[0] = "";
    $prev_tags[0] = "";
    foreach var TagDetail t ($p->visible_tag_list()) {
      var string[] tags;

      if ($t.name) {
        var int array_counter = 0;
        var string buffer = "";
        foreach var string char ($t.name) {
          if($char == $delimiter) {
            $tags[$array_counter] = $buffer;
            $array_counter = $array_counter + 1;
            $buffer = "";
          }
          else {
            $buffer = $buffer + $char;
          }
        }
        $tags[$array_counter] = $buffer;

        var int pos = 0;
        foreach var string tier($tags) {
          if (size $closing_html <= $pos) {
            $closing_html[$pos] = "";
          }

          if (size $prev_tags <= $pos) {
            $prev_tags[$pos] = "";
          }

          if (size $tags == ($pos + 1)) {
            $tier_code = """<a href="$t.url">$tier</a>""";
            if ($show_count) {
              $tier_code = $tier_code + """ ${pre_count}${t.use_count}${post_count}""";
            }
          }
          else {
            $tier_code = """$tier""";
          }

          if ($prev_tags[$pos] == "") {
            $list = $list + """<ul class="module-list"><li class="module-list-item">$tier_code""";
            $closing_html[$pos] = "</li></ul>";
          }
          elseif ($tags[$pos] != $prev_tags[$pos]) {
            var int i = 0;
            foreach var string html ($closing_html) {
              if ($i > $pos) {
                $list = $list + $closing_html[$i];
                $closing_html[$i] = "";
              }
              $i++;
            }

            if ($closing_html[$pos] == "") {
              $list = $list + """<ul class="module-list"><li class="module-list-item">$tier_code""";
              $closing_html[$pos] = "</li></ul>";
            }
            else {
              $list = $list + """</li><li class="module-list-item">$tier_code""";
            }
          }
          else {
           }
          $pos++;
        }
        $prev_tags = $tags;
      }
      $tag_list_pos++;
    }

    var int i = 0;
    var string remaining_html = "";
    foreach var string html ($closing_html) {
      if ($html != "") {
        $remaining_html = $html + $remaining_html;
        $closing_html[$i] = "";
      }
      $i++;
    }
    $list = $list + $remaining_html;
  }

  open_module("categories", $title, "");
  print """$list""";
  var string tags_url = $p.journal->base_url() + "/tag/";

  close_module();
}


How to use this code


In order for this code to display your tags properly, you will need to rename them using your delimiter (default is :). For example, I've used:

movies:anchorman
movies:the notebook
movies:stranger than fiction.
music:cas haley
music:andrew stein
music:jasonmraz:tv
music:open mic night
music:the white stripes



Tweaking with CSS


I personally like my inner links to have a different list style to differentiate them a bit more, so I used the following CSS for that:


.module-categories ul ul li{
list-style-type:circle;
margin: 3px 0 1px 15px;
padding-left:0;
background:none;
}

[info]carriep63

[paid] Arranging sidebar modules, Changing module titles

Use the following code in a theme layer and rearrange the lines of code in the order you want your modules. If there are modules you don't want, just delete that line of code. The titles are in green. You may change these to whatever you like, or delete them to keep the default titles.

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" ],
];



If you are using the Three Column layout, you will want to break up these modules between the two sidebars. Here you can define a primary and a secondary sidebar. You can pick and choose which modules go in which sidebar.


1st Sidebar
set sidebar_primary =  [
     [ "userprofile", "Userpic Title", "0", "1" ],
     [ "viewlinks", "Viewlinks Title" ],
     [ "customtext" ],
     [ "calendar" ],
     [ "links", "Links Title" ],
];




2nd Sidebar
set sidebar_secondary=  [
     [ "tags", "Tags Title" ],
     [ "pagesummary", "Summary Title" ],
     [ "syndicate", "Syndicate Title" ],
     [ "poweredby", "Poweredby Title" ],
];

[info]carriep63

[paid] Adding Modules

Insert the following code into a theme layer in order to add modules to your sidebar. You may change the parts in green to suit your needs.

function print_module_customtext(string title, string text, string titlelink_url) {
var Page p = get_page();


##### First Box #####
$title = "Unfold";
  open_module("customtext",$title, "");
     """
     And the words retreat breathing histories into stories untold
     And I unfold.

     """;
  close_module();



##### Second Box #####
var string title2;

$title2 = "Childlike Wildlife";
  open_module("customtext2", $title2, "");
     """
     I do not become me
     For path tunnels or straightaways

     """;
  close_module();



##### Third Box #####
var string title3;

$title3 = "Tonight, Not Again";
  open_module("customtext3", $title3, "");
     """
     The night.
     She brushed her hands upon my flushed cheek.

     """;
  close_module();

}



In order for these codes to actually show up, you have to have a customtext box defined in your layer. If you don't already have the "rearranging sidebar modules" code in your layer, you will need to insert that as well.

    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" ],

                ];

[info]carriep63

[paid] Random Quote Module

Someone in another community asked about a random quote generator for the Bloggish style. Again, I didn't write the code, merely pieced it together for the Bloggish style.

Insert this code into a theme layer to have random quotes in a module. Change the red parts to suit your needs.
random quote module )