Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   HTML (http://www.velocityreviews.com/forums/f31-html.html)
-   -   How do I put random quotes on my web site? (http://www.velocityreviews.com/forums/t164466-how-do-i-put-random-quotes-on-my-web-site.html)

Chris Ianson 03-10-2006 07:44 PM

How do I put random quotes on my web site?
 
Hi, I'm looking for a simple newbie way to put quotes into HTML code, and
have them randomise each time the page is refreshed. What's the easy
solution?

Thanks in advance.



Jim Moe 03-10-2006 08:32 PM

Re: How do I put random quotes on my web site?
 
Chris Ianson wrote:
> Hi, I'm looking for a simple newbie way to put quotes into HTML code, and
> have them randomise each time the page is refreshed. What's the easy
> solution?
>

Client-side: use Javascript. Server-side: use PHP, JSP, perl, etc.
Open a file of quotes, use a random number generator to select a line of
text, print it.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)

Chris Ianson 03-10-2006 11:18 PM

Re: How do I put random quotes on my web site?
 
"Jim Moe" <jmm-list.AXSPAMGN@sohnen-moe.com> wrote in message
news:0LudnSBOR9T5f4zZRVn-tw@giganews.com...
> Chris Ianson wrote:
>> Hi, I'm looking for a simple newbie way to put quotes into HTML code, and
>> have them randomise each time the page is refreshed. What's the easy
>> solution?
>>

> Client-side: use Javascript. Server-side: use PHP, JSP, perl, etc.
> Open a file of quotes, use a random number generator to select a line of
> text, print it.


Sorry, can you show me an example in Java please, with say 2 quotes. I have
no idea what any of that means :S

Thanks!

>
> --
> jmm (hyphen) list (at) sohnen-moe (dot) com
> (Remove .AXSPAMGN for email)




Mitja Trampus 03-10-2006 11:22 PM

Re: How do I put random quotes on my web site?
 
Chris Ianson wrote:
> "Jim Moe" <jmm-list.AXSPAMGN@sohnen-moe.com> wrote in message
> news:0LudnSBOR9T5f4zZRVn-tw@giganews.com...
>> Chris Ianson wrote:
>>> Hi, I'm looking for a simple newbie way to put quotes into HTML code, and
>>> have them randomise each time the page is refreshed. What's the easy
>>> solution?
>>>

>> Client-side: use Javascript. Server-side: use PHP, JSP, perl, etc.
>> Open a file of quotes, use a random number generator to select a line of
>> text, print it.

>
> Sorry, can you show me an example in Java please, with say 2 quotes.


Java and JavaScript are two entirely different things. Java is in fact hidden in the "JSP"
above - Java Server Pages.

> I have
> no idea what any of that means :S


Then no example can help you (enough). The easiest (though shoddiest) way to go is
JavaScript; you can find a script on Google with instruction on how to put it on your
site, requiring no knowledge of what is actually going on.

Chris Ianson 03-11-2006 01:27 AM

Re: How do I put random quotes on my web site?
 
"Mitja Trampus" <nun@example.com> wrote in message
news:aTnQf.794$oj5.294378@news.siol.net...
> Chris Ianson wrote:
>> "Jim Moe" <jmm-list.AXSPAMGN@sohnen-moe.com> wrote in message
>> news:0LudnSBOR9T5f4zZRVn-tw@giganews.com...
>>> Chris Ianson wrote:
>>>> Hi, I'm looking for a simple newbie way to put quotes into HTML code,
>>>> and
>>>> have them randomise each time the page is refreshed. What's the easy
>>>> solution?
>>>>
>>> Client-side: use Javascript. Server-side: use PHP, JSP, perl, etc.
>>> Open a file of quotes, use a random number generator to select a line
>>> of
>>> text, print it.

>>
>> Sorry, can you show me an example in Java please, with say 2 quotes.

>
> Java and JavaScript are two entirely different things. Java is in fact
> hidden in the "JSP" above - Java Server Pages.
>
> > I have
>> no idea what any of that means :S

>
> Then no example can help you (enough). The easiest (though shoddiest) way
> to go is JavaScript; you can find a script on Google with instruction on
> how to put it on your site, requiring no knowledge of what is actually
> going on.


Yes, I have found some JaveScripts, but even though I copy and paste them
exactly I still get script errors in IE6.

Perhaps someone can post a working example here with 2 quotes?



Jonathan N. Little 03-11-2006 01:36 AM

Re: How do I put random quotes on my web site?
 
Chris Ianson wrote:
<snip>
>
> Yes, I have found some JaveScripts, but even though I copy and paste them
> exactly I still get script errors in IE6.
>
> Perhaps someone can post a working example here with 2 quotes?
>
>


help yourself!


http://www.google.com/search?hl=en&l...ay&btnG=Search
javascript random quote of the day - Google Search
--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

Chris Ianson 03-11-2006 10:09 AM

Re: How do I put random quotes on my web site?
 
"Jonathan N. Little" <lws4art@centralva.net> wrote in message
news:44122921$0$25074$cb0e7fc6@news.centralva.net. ..
> Chris Ianson wrote:
> <snip>
>>
>> Yes, I have found some JaveScripts, but even though I copy and paste them
>> exactly I still get script errors in IE6.
>>
>> Perhaps someone can post a working example here with 2 quotes?

>
> help yourself!
>
>
> http://www.google.com/search?hl=en&l...ay&btnG=Search
> javascript random quote of the day - Google Search


All very well but these are mainly links to other people's quotes (I want my
own). Then there are scripts which are either dead links, or PHP (I need
JavaScript), or just plain don't work.

Is anybody here able to paste a small bit of HTML to a reply that will
enable me to add my own random text to be displayed on each screen refresh?

Thanks if you can.

> --
> Take care,
>
> Jonathan
> -------------------
> LITTLE WORKS STUDIO
> http://www.LittleWorksStudio.com




Toby Inkster 03-11-2006 10:39 AM

Re: How do I put random quotes on my web site?
 
Chris Ianson wrote:

> Hi, I'm looking for a simple newbie way to put quotes into HTML code, and
> have them randomise each time the page is refreshed. What's the easy
> solution?


If your server supports PHP...

<?php
$cmd = '/usr/games/fortune';
printf("<blockquote><p>%s</p></blockquote>",
nl2br(htmlspecialchars(system($cmd))));
?>

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact


Chris Ianson 03-11-2006 11:02 AM

Re: How do I put random quotes on my web site?
 
"Toby Inkster" <usenet200603@tobyinkster.co.uk> wrote in message
news:00mae3-ipc.ln1@ophelia.g5n.co.uk...
> Chris Ianson wrote:
>
>> Hi, I'm looking for a simple newbie way to put quotes into HTML code, and
>> have them randomise each time the page is refreshed. What's the easy
>> solution?

>
> If your server supports PHP...
>
> <?php
> $cmd = '/usr/games/fortune';
> printf("<blockquote><p>%s</p></blockquote>",
> nl2br(htmlspecialchars(system($cmd))));
> ?>


Thanks. What if it doesn't support PHP (it doesn't)?

>
> --
> Toby A Inkster BSc (Hons) ARCS
> Contact Me ~ http://tobyinkster.co.uk/contact
>




Chris Ianson 03-11-2006 11:02 AM

Re: How do I put random quotes on my web site?
 
PS: I would also like it to not only display a random phrase on first page
load, but to also display a random one every 15 seconds.




All times are GMT. The time now is 05:46 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.