?

Log in

[theme] - [tranqii] - [sticky entry] - S2 Layers [entries|archive|friends|userinfo]
S2 Layers

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

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

[theme] - [tranqii] - [sticky entry] [Apr. 1st, 2007|07:12 am]
S2 Layers

s2layers

[kunzite1]
[Tags|, , ]

in response to sdlucly's comment in jdark's s2tranquility2 post.

# -------------------------------
# main page display entries and
# footer
# -------------------------------
function RecentPage::print_body () {
  var bool   enable_sticky      = true;
  var string sticky_subject     = ""; # Welcome
  var string sticky_date        = ""; # Apr. 1st, 2007
  var string sticky_location    = ""; # San Francisco, CA
  var string sticky_mood        = ""; # creative
  var string sticky_music       = ""; # Mirrors on Shoes - LiveJournal
  var string sticky_permalink   = ""; # http://exampleusername.livejournal.com/289.html
  var string sticky_posturl     = ""; # http://exampleusername.livejournal.com/289.html?mode=reply
  var string sticky_poster      = ""; # exampleusername
  var string sticky_userpic     = ""; # http://stat.livejournal.com/img/goat-normal.gif
  var string sticky_userpic_alt = ""; # $.journal.username

  var bool   print_sticky = (not $this isa FriendsPage) and ($.nav.skip == 0) and $enable_sticky;

  # print all entries
  """
  <div id="entries">""";

  if($print_sticky) {
    var string sticky_meta = "";
    if($sticky_subject == "") {
      $sticky_subject = """<i class="nosubject">$*text_nosubject</i>""";
    }
    foreach var string k (["location", "mood", "music"]) {
      var string text = lang_metadata_title($k);
      var string val  = "";
      if($k == "location") {
        $val = $sticky_location;
        if($val != "") {
          $val = """<a href="http://maps.google.com/maps?q=$sticky_location">$sticky_location</a>""";
        }
      } elseif ($k == "mood") {
        $val = $sticky_mood;
      } elseif ($k == "music") {
        $val = $sticky_music;
      }
      if($val != "") {
        $sticky_meta = $sticky_meta + "\n" + "        <b>" + $text + ":</b> " + $val + "<br />";
      }
    }
    if($sticky_poster != "") {
      var UserLite u = UserLite($sticky_poster);
      $sticky_poster = $u->ljuser();
      if($u.username != $.journal.username) {
        $sticky_poster = $sticky_poster + " in " + $.journal->as_string();
      }
      $sticky_poster = "\n" + "        " + $sticky_poster;
    }
    if($sticky_userpic != "") {
      $sticky_userpic = """
      <h3 class="userpic"><img border="0" src="$sticky_userpic" alt="$sticky_userpic_alt" title="$sticky_userpic_alt" /></h3>""";
    }

    """
    <div id="entry_sticky" class="ind-entry">""";

    print $sticky_userpic;

    """
      <h2>$sticky_subject</h2>""";

    var bool h4 = ($sticky_date != "") or ($sticky_meta != "") or ($sticky_poster != "");
    if($h4) {
      """
      <h4>""";
      if($sticky_date != "") {
        """
        <b>$sticky_date</b><br />""";
      }

      print $sticky_meta;

      print $sticky_poster;

      """
      </h4>""";
    }

    """
      <div class="entry-item">""";

    """
        Entry text here
    """;

    """
      </div>""";

    $h4 = ($sticky_permalink != "") or (($sticky_permalink != "") and ($sticky_posturl != ""));

    if($h4) {
      """
      <h4>""";
      "\n";
      "        ";
      var bool print_permalink = get_permalink($sticky_permalink) != "";
      var bool print_posturl   = $sticky_posturl != "";
      if($print_permalink) {
        print get_permalink($sticky_permalink);
      }
      if($print_permalink and $print_posturl) {
        " | ";
      }
      if($print_posturl) {
        """<a href="$sticky_posturl" class="comments" title="$*text_post_comment">$*text_post_comment</a>""";
      }
      """
      </h4>""";
    }

    """
    </div>""";
  }

  foreach var Entry e ( $.entries ) {
    $this->print_entry($e);
    if ($e->viewer_sees_ebox()) {
      """
    <div class="ind-entry"><table align="center"><tr><td>""";
      $e->print_ebox();
      "</td></tr></table></div>";
    }
  }
  """
    </div>""";

  var string range = "most recent entries";
  if ( $.nav.skip > 0 ) {
    $range = "$.nav.skip entries back";
  }

  """
    <div id="footer">
      <p>
        <b>viewing:</b> $range<br />""";

  # go forward/backward if possible
  if ( $.nav.forward_url != "" or $.nav.backward_url != "" ) {
    var string sep;
    var string back;
    var string forward;
    if ( $.nav.backward_url != "" ) {
      $back = """<a href="$.nav.backward_url" title="go earlier">earlier</a>""";
    }
    if ( $.nav.forward_url != "" ) {
      $forward = """<a href="$.nav.forward_url" title="go later">later</a>""";
    }
    if ( $back != "" and $forward != "" ) {
      $sep = " | ";
    }
    """
        <b>go</b>: $back$sep$forward<br />""";
  }
  """
      </p>
    </div>""";
}
linkReply

Comments:
[User Picture]From: sdlucly
2007-04-01 03:36 pm (UTC)
Thanks so very much. It was a bit tricky, with copying the post and adding the small details, but it totally worked. *nods* Thanks so very much. *bounces*
(Reply) (Thread)