?

Log in

No account? Create an account

Previous Entry | Next Entry

Removing specific dates/times?

  • Apr. 14th, 2008 at 12:04 PM
I'm not sure if this is even possible, or if it falls in the scope of this community...but here's a shot:

I have a few pages in my livejournal that function more like content pages on a website than blog entries (for example, http://watchmebe.livejournal.com/1984/05/22/)
I would love to be able to remove the date/time entirely from these entries and only these entries. Is this even possible?

:)
(Not quite sure what to tag this with, so I've left it blank)

Comments

( 5 comments — Leave a comment )
av8rmike
Apr. 14th, 2008 05:49 pm (UTC)
Sure, it's possible, but you'll need to override the print_entry() function, if you aren't already. Was that date the only one you were interested in checking?
watchmebe
Apr. 14th, 2008 06:43 pm (UTC)
I was also hoping to change May 21, 1984!
av8rmike
Apr. 14th, 2008 08:35 pm (UTC)
Refresh my memory-- Are you already using a custom print_entry() function in a theme layer? If so, I'd probably need to see the code to integrate the changes.
watchmebe
Apr. 14th, 2008 08:41 pm (UTC)
If I'm looking at the correct thing, I believe this is the print_entry function from my theme layer:


unction print_entry(Page p, EntryLite e, Color bgcolor, Color fgcolor, bool hide_text) {
var bool showposter = false;
if (not $e.poster->equals($e.journal)) { $showposter = true; }

var Comment c;
var Entry en;
if ($e isa Comment) {
$c = $e as Comment;
} else {
$en = $e as Entry;
}

var string id = "";
if (defined $c) {
$id = " id=\"asset-$e.journal.username-$c.talkid\"";
} else {
$id = " id=\"asset-$e.journal.username-$en.itemid\"";
}

"""
[Error: Irreparable invalid markup ('<div$id>') in entry. Owner must fix manually. Raw contents below.]

If I'm looking at the correct thing, I believe this is the print_entry function from my theme layer:


unction print_entry(Page p, EntryLite e, Color bgcolor, Color fgcolor, bool hide_text) {
var bool showposter = false;
if (not $e.poster->equals($e.journal)) { $showposter = true; }

var Comment c;
var Entry en;
if ($e isa Comment) {
$c = $e as Comment;
} else {
$en = $e as Entry;
}

var string id = "";
if (defined $c) {
$id = " id=\"asset-$e.journal.username-$c.talkid\"";
} else {
$id = " id=\"asset-$e.journal.username-$en.itemid\"";
}

"""
<div$id class="post-asset asset">
<div class="asset-inner">
<div class="asset-header">
<div class="asset-header-inner">
<div class="asset-header-content">
<div class="asset-header-content-inner">
<h2 class="asset-name page-header2">""";

if (defined $en) {
if (defined $en.security_icon) {
"""<span class="lj-entry-securityicon">$en.security_icon</span>&nbsp;""";
}
}

var string subject = "";
var string datetime = "";

if ($e.subject != "") {
$subject = striphtml($e.subject);
$datetime = lang_posted_by_date_and_time($e, $showposter, true, true);
} else {
$subject = lang_posted_by_date_and_time($e, $showposter, true, false);
$datetime = lang_posted_by_date_and_time($e, $showposter, false, true);
}

"""<a href="$e.permalink_url">$subject</a>""";
"</h2>";

"""
<div class="asset-meta">
<ul class="asset-meta-list">
<li class="item"><span><abbr class="datetime">$datetime</abbr></span></li>
</ul>
</div>
</div></div></div>
</div> <!-- end asset-header -->
<div class="asset-content">
<div class="asset-body">""";

var bool showuserpic = $*opt_userpic_main;
if ($p.view == "friends") {
$showuserpic = $*opt_userpic_friends;
}
if ($p.view == "entry") {
$showuserpic = $*opt_userpic_entrypage;
}

var string userpic = ($showuserpic and defined $e.userpic) ? ($e.userpic + "<br />") : "";
if ($showuserpic) {
if ($bgcolor) {
"""<div class="user-icon" style="border: 1px; padding: 2px; background-color: $bgcolor;">$userpic""";
} else {
"""<div class="user-icon">$userpic""";
}
}

var string posted = "";
if ($p.view == "friends") {
if (not $e.poster->equals($e.journal)) {
$posted = $posted + colored_ljuser($e.poster, $bgcolor, $fgcolor) + "<br />";
}
$posted = $posted + colored_ljuser($e.journal, $bgcolor, $fgcolor);
} else {
if (not $e.poster->equals($e.journal)) {
$posted = $posted + $e.poster;
}
}
print "$posted";

if ($showuserpic) {
print "</div>";
}

$e->print_text();

"</div>\n";
if (defined $en) {
$en->print_metadata();
}

"</div>\n";
$p->print_reply_container({"target" => "entrycomment", "class" => "quickreply"});
$e->print_linkbar();

"""<div class="asset-footer"></div>\n</div>\n</div>\n""";
if ($*entry_footer != "") {
println safe $*entry_footer;
}
}
av8rmike
Apr. 14th, 2008 09:09 pm (UTC)
OK, well as far as I can tell, that function is unmodified from the base layout. There's a few lines in that function you'll need to modify, and it might get a little confusing. I'd recommend copying and pasting your existing code into a Notepad document (not Word), just in case something gets screwed up, so you have a backup. Find this section of the code:
    """
          <div class="asset-meta">
            <ul class="asset-meta-list">
              <li class="item"><span><abbr class="datetime">$datetime</abbr></span></li>
            </ul>
          </div>
        </div></div></div>
        </div> <!-- end asset-header -->
        <div class="asset-content">
            <div class="asset-body">""";
Change it to look like this section (I highlighted the changes):
    var Date checkdate = new Date;
    $checkdate.year = 1985;
    $checkdate.month = 1;
    $checkdate.day = 1;
    if ($checkdate->compare($e.time) > 0){
        """\n
          <div class="asset-meta">
            <ul class="asset-meta-list">
              <li class="item"><span><abbr class="datetime">$datetime</abbr></span></li>
            </ul>
          </div>""";
    }

    """
        </div></div></div>
        </div> <!-- end asset-header -->
        <div class="asset-content">
            <div class="asset-body">""";
What this does is for every post dated older than Jan. 1, 1985, it removes the date and the blank space below the entry title. If you decide to make more back-dated posts in later years, you can change the $checkdate variable's values. Let me know if you have any problems.
( 5 comments — Leave a comment )

Latest Month

March 2016
S M T W T F S
  12345
6789101112
13141516171819
20212223242526
2728293031  

S2 Help Communities

Tags

Powered by LiveJournal.com
Designed by chasethestars