Janine (janinedog) wrote in lj_dev,

  • Mood:

S2 Question

I'm trying to use the built-in function "alternate" in my S2 style. However, I'm getting a runtime error (it compiles just fine) and I can't figure out why. I don't know if this is just me using it wrong or if it's a bug. Here's what I did...

In MonthPage::print_body(), I have this chunk of code:

var string cell_bgcolor;
foreach var MonthDay d ($.days) {
    $cell_bgcolor = alternate($*comment_bar_one_bgcolor.as_string, $*comment_bar_two_bgcolor.as_string);
    if ($d.has_entries) {
        "<table border='0' cellpadding='2' cellspacing='0' width='100%'><tr>";
        "<td style='background-color: $cell_bgcolor;'>";
        "<dt><a class='nav' href='$d.url'><strong>";
        print lang_ordinal($d.day);

I'm getting this error when I load my Month page (the line numbers change on refresh):

Error running style: Died in S2::run_code running MonthPage::print(): Undefined subroutine &S2::Builtin::alternate called at /home/lj/cgi-bin/LJ/S2.pm line 1250, line 21.

So, presumably, it does not like my call to alternate(). Any idea why? If it matters, I'm basing my style off of Punquin Elegant.


  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded