Log in

No account? Create an account
[theme] - [smoothsailing] - [mood icon to left of metadata] - S2 Layers — LiveJournal [entries|archive|friends|userinfo]
S2 Layers

[ website | advanced customization ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

[Links:| how to post tags page ]
[affiliated communities| fblayers ]

[theme] - [smoothsailing] - [mood icon to left of metadata] [Aug. 19th, 2006|07:01 pm]
S2 Layers


[Tags|, , ]

# add colons because hard-coding it is silly
set text_meta_location          = "Location:";
set text_meta_mood              = "Mood:";
set text_meta_music             = "Music:";
set layout_arrangement_metadata = "block";

function Entry::print_metadata() {
  var string tags_header         = "Tags"; # text for tags header,    "Current Tags"
  var string tags_joiner         = ":";            # text for tags joiner,    ":"
  var string tags_sep            = ", ";           # text for tags separator, ", "
  var bool   show_edit_tags_link = false;          # set to true if you want edit tags link as tags header

  var string currents_open       = """<div class="entryMetadata"><ul>"""; # html for opening of currents container
  var string currents_close      = """</ul></div>"""; # html for closing of currents container

  var bool   loc_after_mood      = false;               # set to true to print location after mood
  var bool   vanilla_loc         = false;               # set to true to delinkify location

  # if you need data specific to the meta to be in these strings you'll have to set those individually down further
  # one example is provided with meta_label_open
  var string meta_label_open     = """<li><span class="entryMetadata-label">""";   # html for opening of metadata label
  var string meta_label_close    = """</span>"""; # html for closing of metadata label
  var string meta_val_open       = """<span class="entryMetadata-content">""";               # html for opening of metadata value
  var string meta_val_close      = """</span></li>""";     # html for closing of metadata value

  var Link   edit_tags           = $this->get_link("edit_tags"); # helper var to see if remote user can edit tags

  if (((size $.metadata > 0) or ((size $.tags > 0) and ($*tags_aware))) and ($.itemid != int($*layout_guestbook_entryid))) {
    if($.metadata{"mood"} == "" and $loc_after_mood) {
      # if we're printing loc after mood but we have no mood, set loc_after_mood to false
      $loc_after_mood = false;
    var string currents = "";             # make var for printing

    if(defined $.mood_icon) {
      var Image i = $.mood_icon;
      $currents = $currents + """<table border="0"><tr><td><img src="$i.url" width="$i.width" height="$i.height" alt="$.metadata{"mood"}" title="$.metadata{"mood"}" /></td><td>""";

    $currents           = $currents + $currents_open; # add opening of currents container

    foreach var string k ($.metadata){  # step thru metadata
      var string text = $k;             # set text to key
      var string val  = $.metadata{$k}; # get val
      if ($k == "mood"){                # if mood, set text to mood property
        $text = $*text_meta_mood;
      elseif ($k == "music") {          # if music, set text to music property
        $text = $*text_meta_music;
      } elseif ($k == "location") {     # if location, set text to loc variable
        $text = $*text_meta_location;
        if($vanilla_loc) {              # if vanilla loc, striphtml() it
          $val = striphtml($val);
      if(not ($k == "location" and $loc_after_mood)) {
        # if we're doing loc right now and printing loc after mood, skip it
        # if we're doing loc right now and we're not printing loc after mood, print it now
        # if we're not doing loc right now, print this piece of meta

        # add the meta
        $currents = $currents + """$meta_label_open$text$meta_label_close$meta_val_open$val$meta_val_close""";

      if($k == "mood" and $loc_after_mood) {
        # if we just now did the mood and we're printing loc after mood, print the loc
        $k    = "location";           # set meta key to "location"
        $text = $*text_meta_location; # set text to loc variable
        $val  = $.metadata{$k};       # get val

        # if we have a loc, do stuff
        if($val != "") {

          # if vanilla loc, striphtml() it
          if($vanilla_loc) {
            $val = striphtml($val);

          # in this layout, each piece of meta gets its own class
          $meta_label_open  = """<div class="current$k"><strong>""";

          # add the meta
          $currents         = $currents + """$meta_label_open$text$meta_label_close$meta_val_open$val$meta_val_close""";
    if ((size $.tags > 0) and ($*tags_aware) and ($*layout_position_entrytags == "metadata")) {
      var string k      = "tags"; # set key to "tags"

      var int tcount = 0; # set counter for tags
      if($edit_tags.url != "" and $show_edit_tags_link) { # if remote user can edit tags, let's give them a link
        $tags_header = """<a href="$edit_tags.url">$tags_header</a>""";

      # add text, open val container
      $currents = $currents + """$meta_label_open$tags_header$tags_joiner$meta_label_close$meta_val_open""";

      # build tag list
      foreach var Tag t ($.tags) {
        $currents = $currents + """<a rel="tag" href="$t.url">$t.name</a>""";

        # if we haven't hit the last tag, add a separator
        if ($tcount != size $.tags) { $currents = $currents + $tags_sep; }

      # close val container
      $currents = $currents + $meta_val_close;

    # close currents container
    $currents = $currents + $currents_close;

    if(defined $.mood_icon) {
      $currents = $currents + """</td></tr></table>""";

    # print currents
    println "$currents";

[User Picture]From: dreamon_dreamer
2006-08-20 02:47 am (UTC)
you rock!
(Reply) (Thread)
[User Picture]From: dreamon_dreamer
2006-08-20 02:58 am (UTC)
ok, sorry if this is a dumb question, i haven't done anything with layers in a minute.

do i need to just create a new layer, and paste the code as is? or do i need to do something more?
(Reply) (Thread)
[User Picture]From: kunzite1
2006-08-20 03:06 am (UTC)
if you don't have any other layers attached to your style, you can create a theme layer for smooth sailing, copy/paste my code, save the layer. make sure it compiles with no errors. go to your styles page, edit the smoothsailing style, attach the theme layer, save the style, and you should be good to go.
(Reply) (Parent) (Thread)
[User Picture]From: dreamon_dreamer
2006-08-20 03:43 am (UTC)
got it. thanks.
(Reply) (Parent) (Thread)
[User Picture]From: woodycakes
2006-09-01 06:47 pm (UTC)
thanks for this, but is there any way i could put pictures instead of the words, music, mood, tag? thanks!
(Reply) (Thread)
[User Picture]From: beautyfulevil
2006-09-14 05:36 am (UTC)
I'm not the one who wrote the above post, but I know of some code that might help you out.
http://community.livejournal.com/mintyapple/15211.html - She gives the layer code for adding images instead of music, mood, and tag. It works in Smooth Sailing, as I'm using it in my journal right now. :D
(Reply) (Parent) (Thread)
[User Picture]From: cresselia
2007-07-25 11:23 pm (UTC)
...would you happen to have another link to that code? The link you gave doesn't work anymore. D:
(Reply) (Parent) (Thread)
[User Picture]From: therapy
2007-08-01 05:06 am (UTC)
Hey, I saw you managed to get the coding to replace the words with images.

I've been trying to work it out myself but I'm stuffed so I was wondering if you could give me the link please that you used to substitute them. I'd appreciate it. :)
(Reply) (Parent) (Thread)
[User Picture]From: cresselia
2007-08-01 05:34 am (UTC)
It's here. ^^
(Reply) (Parent) (Thread)
[User Picture]From: therapy
2007-08-01 05:39 am (UTC)
Thank you very much! :)
(Reply) (Parent) (Thread)
[User Picture]From: chicketieboo
2009-08-11 11:38 pm (UTC)
The entry for that is gone too =(
(Reply) (Parent) (Thread)
[User Picture]From: unbrokensky
2006-10-27 05:59 am (UTC)
Oh my gosh, I think I love you. That was way too easy.

One question, though. After adding your coding, my metadata stuff looks like this. Wonderful, in it's own right, but... is there any way to move the mood pic to the right just a couple of pixels? And maybe make the space between the pic and the metadata text a little smaller? I'm kind of a perfectionist that way... :S

Anyway, thanks so much for this coding! =D
(Reply) (Thread)
From: albionete
2007-01-01 07:47 am (UTC)
This is great thanks! ^^

But my mood and music are on the same line anyway I can make the music on one line and the mood on another? Like:

mood: blah
music: blah - blah
(Reply) (Thread)
[User Picture]From: laurak23
2007-05-28 01:18 am (UTC)
Did you ever figure out a way to fix that? I'm having the same problem...
(Reply) (Parent) (Thread)
From: albionete
2007-05-28 02:12 am (UTC)
Nope. x.X I just gave up.
(Reply) (Parent) (Thread)
[User Picture]From: laurak23
2007-05-28 02:26 am (UTC)
Hm, bummer. :\ Well if I figure it out, I'll comment here. :)
(Reply) (Parent) (Thread)
From: albionete
2007-05-28 07:40 pm (UTC)
Thanks so much!!!!
(Reply) (Parent) (Thread)
[User Picture]From: laurak23
2007-05-28 07:52 pm (UTC)
You're welcome!

And iconlove!
(Reply) (Parent) (Thread)
From: albionete
2007-05-28 08:03 pm (UTC)
Hell yes!! <3 <3
(Reply) (Parent) (Thread)
[User Picture]From: laurak23
2007-05-28 08:04 pm (UTC)
Hahaha. I love that icon, too. XD
(Reply) (Parent) (Thread)
From: albionete
2007-05-28 08:06 pm (UTC)
XDD Me too
(Reply) (Parent) (Thread)
From: ankhutenshi
2007-09-11 08:10 pm (UTC)
ILU! ♥ Thanks, it works perfectly!
(Reply) (Thread)
From: jessilestrange
2010-01-02 11:27 am (UTC)
(Reply) (Thread)
[User Picture]From: denorios
2010-04-09 02:01 pm (UTC)
I'm using this, and it's moved all the metadata in line with one another, and brought the tags line below the rest of the metadata, but instead of moving my moodicon to the left, it's just disappeared completely. Help?
(Reply) (Thread)