Displaying a single random quote

  • Author
    Posts
  • #42638

    missmoopants
    Member

    Hello, I’ve searched and searched but I can find nothing on this topic, but apologies if this is a repeat.

    I would like to display a random line of text (quotes from friends, random thoughts etc.) on my sidebar. So far, I’ve set up a database and added some quotes, which display randomly, one-at-a-time, when using the following link:

    http://baseportal.com/cgi-bin/baseportal.pl?htx=/missmoopants/Feed

    How can I display the output in my sidebar “legally”?

    Thanks,
    Wendy.

    #42803

    nosysnoop
    Member

    Does it come in html code? You can add the html code into a text widget and place it into your sidebar. But javascript code isn’t allowed due to security issues.

    #42840

    missmoopants
    Member

    I can set it up to output to an absolute link on wordpress, but I don’t know how to make an absolute link for a widget. I’m sure there’s an easy way to just display this text, but it’s something I have no idea about.

    #42841

    cornell
    Member

    Have they given you code to put in your sidebar? Can you post it here for us to see?

    Inserting an absolute link in a widget is the same as normal, just put it in a text widget, save it and drag it to the appropriate place on the sidebar.

    As nosy says though, if it’s javascript you haven’t got a hope.

    Collin

    #42842

    cornell
    Member

    Hmm, having had a quick look at the overview on baseportal they want the user to paste HTML code into a file/webpage.

    I have a feeling that some of the code used will be stripped by wp.com as “unsafe”. Unfortunately this means that it won’t work. Best thing to do is try it.

    Example of the code I found:

    <code>html></head><title>Highscore</title></head>
    <body bgcolor=ffffff>
    <h2>Highscore</h2>
    <include src=introduction>
    <do action=all>
    <table width=90% border=1>
    <tr><td>Name</td><td>Punkt</td>
    <loop sort=- range=0,10 code=perl>
    out "<tr><td><b>$Name</b></td><td>$Score</td></tr>";
    $overall+=$Score;
    if($Score>$max) { $max=$Score; $maxName=$Name; }
    </loop>
    </table>
    Overall: $overall<br>
    Highest Score: $max by $maxName<br>
    Average: <perl>out $overall/10;</perl>
    </body></html></code>

    #42871

    missmoopants
    Member

    Thanks for that. I tried it and I failed. I tried variations, but WordPress strips out some of the required code. Why is it that the things that seem like the should be the easiest are always the hardest????

    #42884

    missmoopants
    Member

    Right. Workaround time. I have now outputted the file as an xml page so I can use an RSS feed instead. It’s half working. I now have the title field from the DB xml displaying as the title of my RSS widget, but the random quote does not show, but it does appear as a tooltip when I hover my mouse over the text.

    Also, it’s not randomly picking a quote: just putting the same entry from the db in, even though the page at the DB end displays different quotes.

    I’m still working on it, so what I’ve described above maybe slightly out if you view my blog.

    Any help is greatly appreciated.

    Below is the code I’ve used to create the xml:

    <?xml version=”1.0″?>
    <rss version=”2.0″>
    <channel>
    <loop Id==? db=main>
    <title>Random Quotes</title>
    <description>$Text</description>
    <font color=”white”><link>http://google.com</link></font&gt;
    </loop>
    </channel>
    </rss>

    #43012

    missmoopants
    Member

    Yet another update. I now have two RSS feeds: one that kind of works the way I want it to and the one with the code above (not quite right).

    It does randomly change, but only about once an hour, Ctrl-Shift-Refresh does not change it. Why would this be?

    #43213

    drmike
    Member

    The sidebars are cached. They only update every so often.

    #43231

    missmoopants
    Member

    Oh. That’s annoying.

    Thanks for letting me know about that.

    So, the workaround to the workaround won’t work the way I want it to either. Will anything???

    #43233

    timethief
    Member

    In a word “no”.

    #43241

    missmoopants
    Member

    Well, I’m out of ideas then. How can I get some text to appear randomly on a page or the sidebar at each refresh?

    I really don’t want to have to link off to another site if possible.

    #43242

    engtech
    Member

    This isn’t possible at wordpress.com

    #43244

    missmoopants
    Member

    Not a lot is…

    #43246

    cornell
    Member

    No, but then the service doesn’t disappear like certain others we could mention either…

    ;)

    #43247

    missmoopants
    Member

    True…it just seems that the most basic of functions is impossible. I still have no idea about page hits (as opposed to blog entry hits, and I hate that I have to put up with pre-designed templates that you can’t over-ride with basic HTML (like letters appearing automatically in upper case).

    Swings and roundabouts I guess. Just very frustrating when trying to figure out what *is* possible and wasting too much time on it in the process.

    #43248

    cornell
    Member

    I understand your frustration. That’s why I kept my hosted blog rather than move it all here. It’s more work but I can do whatever I want with it. :)

    #43282

    timethief
    Member

    I’ve left a comment on missmoopants’ blog to let her know about “twitter”
    http://wordpress.com/forums/topic.php?id=5772&replies=7

    #43283

    missmoopants
    Member

    Thanks very much for that timetheif, but I don’t think that’s what I’m after. That seems to revolve around friends, SMSing and instant updates. I just want to display a random quote from a database/list of random quotes that refreshes each time the screen is refreshed. Am I missing something with Twitter?

    #43284

    timethief
    Member

    I haven’t used “twitter” and I guessed it wouldn’t be a perfect fit for what you wanted at all but I thought I should share its existence with you any way. :) http://wordpress.com/forums/topic.php?id=5772&replies=9

The topic ‘Displaying a single random quote’ is closed to new replies.