Thomas Jackson (tjackson) wrote in component_help,
Thomas Jackson

  • Mood:

random text resulting in nullValues

Ok I've got this huge random quote function built into my layout. I have a question regarding a bug I've seen pop up occasionally...

What I have is below the cut:

<b>Contemplative Muse :: </b>
var string[] muses;

$muses[0]="""The universality of our sinfulness is met by the universality of God's grace. - Pastor Robert Rasmus""";
$muses[1]="""It is precious to me though I buy it with great pain - JRR Tolkien""";
$muses[282]="""Our chief want is someone who will inspire us to be what we know we could be. - Ralph Waldo Emerson""";
$muses[283]="""I had hoped to be back here this week under different circumstances, running for re-election. But you know the old saying: you win some, you lose some. And then there's that little-known third category. I didn't come here tonight to talk about the past. After all, I don't want you to think I lie awake at night counting and recounting sheep. I prefer to focus on the future because I know from my own experience that America is a land of opportunity, where every little boy and girl has a chance to grow up and win the popular vote. - Former Vice President Al Gore, at the Democratic Convention""";
$muses[284]="""You've done a nice job decorating the White House. - Jessica Simpson, upon being introduced to Interior Secretary Gale Norton while touring the White House""";

var int randMuse;
$randMuse = rand(0, ((size $muses) - 1));
""" $muses[$randMuse]

Here's the question, everyonce and a while I get the output of this in my layout as "Contemplative Muse :: ", and that's it. I'm wondering if there's any way to do something like;
if ($muses[$randMuse]=="") { """
General Default Quote - General Default Author
"""; } else { """
"""; }

is this right, or even feasible?

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened