+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 14
Like Tree2Likes

Thread: HELP PLEASE: want to have a random quote display

  1. #1
    catrisit's Avatar
    catrisit is offline x10Hosting Member catrisit is an unknown quantity at this point
    Join Date
    Feb 2010
    Posts
    11

    Question HELP PLEASE: want to have a random quote display

    I used to have a script running on my front page that pulled a random quote in from a text file..

    for some reason it didn't work on X10's servers

    i'd really like to get it running again but need suggestions as to how and what will work on these servers..

    help much appreciated, thanks

    website: http://www.spiritlanguage.org.uk

  2. #2
    cybrax's Avatar
    cybrax is offline x10 Elder cybrax is on a distinguished road
    Join Date
    Aug 2009
    Location
    UK
    Posts
    699

    Re: HELP PLEASE: want to have a random quote display

    It helps tremendously if you could post up the code you are trying to use.
    The code must flow.
    Project 157: Latest UK Jobs direct to your mobile phone
    New Domain under construction: Lovelogic.net
    home for some new projects that we can't keep here ;)


  3. #3
    vv.bbcc19's Avatar
    vv.bbcc19 is offline Community Advocate vv.bbcc19 is just really nice
    Join Date
    Jun 2010
    Location
    India
    Posts
    1,505

    Re: HELP PLEASE: want to have a random quote display

    This worked for me for a while
    PHP Code:
    stop(); quoteTxt.autoSize "center"randomQuote = new LoadVars(); randomQuote.onLoad = function() {     quotes this.quotes.split(";");     quoteTimer setInterval(newQuote10000);     newQuote() }; randomQuote.load("quotes.txt"); function newQuote() {     randomNum Math.floor(Math.random()*quotes.length);     quoteTxt.text quotes[randomNum];     quoteTxt._y = ((450-(quoteTxt._height/2))/2); } 


    ---------- Post added at 02:30 PM ---------- Previous post was at 02:29 PM ----------

    stop(); quoteTxt.autoSize = "center";
    randomQuote = new LoadVars();

    randomQuote.onLoad = function() {
    quotes = this.quotes.split(";");
    quoteTimer = setInterval(newQuote, 10000);
    newQuote() };
    randomQuote.load("quotes.txt");
    function newQuote() { randomNum = Math.floor(Math.random()*quotes.length);
    quoteTxt.text = quotes[randomNum];
    quoteTxt._y = ((450-(quoteTxt._height/2))/2);
    }
    BCV | Community Support Representative
    █ x10Hosting - Giving Away Hosting Since 2004
    Premium Hosting | VPS Services

  4. #4
    catrisit's Avatar
    catrisit is offline x10Hosting Member catrisit is an unknown quantity at this point
    Join Date
    Feb 2010
    Posts
    11

    Re: HELP PLEASE: want to have a random quote display

    thanks vv.

    i will try that out and let you know how i get along

    @cybrax: i don't have any scripting on their just now - i was using a cgi i got from 'Matt's scripts' that called a .txt file...

    ---------- Post added at 10:33 AM ---------- Previous post was at 09:52 AM ----------

    @vv

    i tried the php script in my page and modified the .htaccess file [i thought] appropriately :S
    now my site is not very happy... http://www.spiritlanguage.org.uk

    this is the original cgi i used:

    #!/usr/bin/perl -w
    use CGI;

    my $datafile="randomtext.txt";

    my $item_separator="\n\%\n";

    my $cgi=new CGI;
    print $cgi->header("text/plain");

    sub cdie {
    print "ERROR: ";
    print @_;
    exit;
    }

    open(IDATA, "<", $datafile) or cdie("Data file not readable");
    local $/=$item_separator;
    my @items=map {s/$item_separator$//;$_} <IDATA>;
    close IDATA;
    print $cgi->escapeHTML($items[rand @items]);

    any thoughts?

    ---------- Post added at 10:34 AM ---------- Previous post was at 10:33 AM ----------

    p.s. i have removed the additional .htaccess and cleared the cache but the site is still not working... oops!

  5. #5
    vv.bbcc19's Avatar
    vv.bbcc19 is offline Community Advocate vv.bbcc19 is just really nice
    Join Date
    Jun 2010
    Location
    India
    Posts
    1,505

    Re: HELP PLEASE: want to have a random quote display

    ahah,
    understood your problem..need time to check back.Testing the same anyway again.

  6. #6
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: HELP PLEASE: want to have a random quote display

    You shouldn't need to set anything in .htaccess to get PHP to work. Make sure you're using a file extension of ".php", not ".html".

    Please use [php], [html] or [code] tags (as appropriate) to separate and format code.

    CGI scripts were disabled awhile back due to abuse.

    Please don't use tables for layout and presentational HTML (e.g. <font> elements). Stick to semantic HTML and CSS.
    Last edited by misson; 05-26-2011 at 06:52 PM.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  7. #7
    catrisit's Avatar
    catrisit is offline x10Hosting Member catrisit is an unknown quantity at this point
    Join Date
    Feb 2010
    Posts
    11

    Re: HELP PLEASE: want to have a random quote display

    @misson: thanks i will see how i get on when i try again..

    problem with not using tables is my front page is quite reliant on them (see for yourself): http://www.spiritlanguage.org.uk

    ---------- Post added at 09:08 PM ---------- Previous post was at 09:07 PM ----------

    p.s. your 'tables' link is down

  8. #8
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: HELP PLEASE: want to have a random quote display

    Quote Originally Posted by catrisit View Post
    problem with not using tables is my front page is quite reliant on them (see for yourself): http://www.spiritlanguage.org.uk
    Not using tables isn't the problem, the reliance on them is, which is why I brought it up.

    Quote Originally Posted by catrisit View Post
    p.s. your 'tables' link is down
    Goes to show why cool URIs don't change. The URL for "Why avoiding tables (for layout) is important" has changed only slightly, but it makes a big difference in whether it can be found.
    Last edited by misson; 05-29-2011 at 05:12 PM.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  9. #9
    catrisit's Avatar
    catrisit is offline x10Hosting Member catrisit is an unknown quantity at this point
    Join Date
    Feb 2010
    Posts
    11

    Re: HELP PLEASE: want to have a random quote display

    ok @vv.bbcc19, i put the php code in it's own file and called it into my frontpage ( http://wwwspiritlangauge.org.uk ) with:

    " include 'http://www.spiritlanguage.org.uk/randomtext.php' "

    but it doesn't seem to be working. any ideas?
    dinomirt96 and karimirt47 like this.

  10. #10
    vv.bbcc19's Avatar
    vv.bbcc19 is offline Community Advocate vv.bbcc19 is just really nice
    Join Date
    Jun 2010
    Location
    India
    Posts
    1,505

    Re: HELP PLEASE: want to have a random quote display

    It was a tested code..anyways,I will get back to you in a couple of days.
    Quote Originally Posted by catrisit View Post
    ok @vv.bbcc19, i put the php code in it's own file and called it into my frontpage ( http://wwwspiritlangauge.org.uk ) with:

    " include 'http://www.spiritlanguage.org.uk/randomtext.php' "

    but it doesn't seem to be working. any ideas?


    ---------- Post added at 10:46 AM ---------- Previous post was at 10:44 AM ----------

    Code:
    stop();
    quoteTxt.autoSize = "center";
    randomQuote = new LoadVars();
    randomQuote.onLoad = function() {
    quotes = this.quotes.split(";");
    quoteTimer = setInterval(newQuote, 10000);
    newQuote()
    };
    randomQuote.load("quotes.txt");
    function newQuote() {
    randomNum = Math.floor(Math.random()*quotes.length);
    quoteTxt.text = quotes[randomNum];
    quoteTxt._y = ((450-(quoteTxt._height/2))/2);
    }
    Test this out and pls get back..
    BCV | Community Support Representative
    █ x10Hosting - Giving Away Hosting Since 2004
    Premium Hosting | VPS Services

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Quote It! - Share your favorite quotes
    By sankalpgarud98 in forum Off Topic
    Replies: 99
    Last Post: 01-01-2012, 05:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers