Welcome to the { mindfrost82.com } forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Software > Adobe Software > Dreamweaver

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-05-2008, 07:56 PM
mjs
 
Posts: n/a
Seeking a "Text/Quote Randomizer" Script (nothing fancy)

I'm looking for a "text randomizer" script.

There's a div in my layout that should be pulling up different content
(randomly) each time the page reloads. Ideally, I'll like to stay away from
databases and just use a text file. The way I'm envisioning it, there would
be a different text on each line. All the script would have to do is
randomly choose which line to pull text from and display it in the layout at
the appropriate location. The layout is liquid, and will adapt to any amount
of text pulled.

The text should be treated like a normal include. In other words, HTML and
CSS tags would work.

I'm open to a PHP-based solution, even if I'm no PHP programmer.

Thanks!


Reply With Quote
  #2 (permalink)  
Old 08-05-2008, 08:10 PM
Chris Leeds, MVP - FrontPage
 
Posts: n/a
Re: Seeking a "Text/Quote Randomizer" Script (nothing fancy)

Can you use legacy .ASP? If so there's an object called "ContentRotator"
that would do exactly what you want.
I used it once a while ago, so if you can use ASP I'll dig it up and pass it
on as an example for you.

--
Chris Leeds
Contact: http://chrisleeds.com/contact
Have you seen ContentSeed (www.contentseed.com)?
NOTE:
This message was posted from an unmonitored email account.
This is an unfortunate necessity due to high volumes of spam sent to email
addresses in public newsgroups.
Sorry for any inconvenience.
"mjs" <no@thanks.com> wrote in message
news:g7a7qa$94m$1@forums.macromedia.com...
> I'm looking for a "text randomizer" script.
>
> There's a div in my layout that should be pulling up different content
> (randomly) each time the page reloads. Ideally, I'll like to stay away
> from databases and just use a text file. The way I'm envisioning it, there
> would be a different text on each line. All the script would have to do is
> randomly choose which line to pull text from and display it in the layout
> at the appropriate location. The layout is liquid, and will adapt to any
> amount of text pulled.
>
> The text should be treated like a normal include. In other words, HTML and
> CSS tags would work.
>
> I'm open to a PHP-based solution, even if I'm no PHP programmer.
>
> Thanks!
>



Reply With Quote
  #3 (permalink)  
Old 08-05-2008, 08:39 PM
kim
 
Posts: n/a
Re: Seeking a "Text/Quote Randomizer" Script (nothing fancy)

you could also use the rand() function in php if that's your server language

mjs skrev:
> I'm looking for a "text randomizer" script.
>
> There's a div in my layout that should be pulling up different content
> (randomly) each time the page reloads. Ideally, I'll like to stay away from
> databases and just use a text file. The way I'm envisioning it, there would
> be a different text on each line. All the script would have to do is
> randomly choose which line to pull text from and display it in the layout at
> the appropriate location. The layout is liquid, and will adapt to any amount
> of text pulled.
>
> The text should be treated like a normal include. In other words, HTML and
> CSS tags would work.
>
> I'm open to a PHP-based solution, even if I'm no PHP programmer.
>
> Thanks!
>
>
>


--
Kim
---------------------------
http://www.geekministry.com

Reply With Quote
  #4 (permalink)  
Old 08-05-2008, 08:48 PM
Nancy O
 
Posts: n/a
Re: Seeking a "Text/Quote Randomizer" Script (nothing fancy)

This one uses JavaScript and an array of text/quotes inside your page. No
databases required.
http://www.codelifter.com/main/javas...domquote.shtml


--Nancy O.
Alt-Web Design & Publishing
www.alt-web.com



"mjs" <no@thanks.com> wrote in message
news:g7a7qa$94m$1@forums.macromedia.com...
> I'm looking for a "text randomizer" script.
>
> There's a div in my layout that should be pulling up different content
> (randomly) each time the page reloads. Ideally, I'll like to stay away

from
> databases and just use a text file. The way I'm envisioning it, there

would
> be a different text on each line. All the script would have to do is
> randomly choose which line to pull text from and display it in the layout

at
> the appropriate location. The layout is liquid, and will adapt to any

amount
> of text pulled.
>
> The text should be treated like a normal include. In other words, HTML and
> CSS tags would work.
>
> I'm open to a PHP-based solution, even if I'm no PHP programmer.
>
> Thanks!
>
>



Reply With Quote
  #5 (permalink)  
Old 08-05-2008, 08:58 PM
mjs
 
Posts: n/a
Re: Seeking a "Text/Quote Randomizer" Script (nothing fancy)

"Chris Leeds, MVP - FrontPage" <NewsGroups@ChrisLeeds.com> wrote in message
news:g7a8jt$a3l$1@forums.macromedia.com...
> Can you use legacy .ASP? If so there's an object called "ContentRotator"
> that would do exactly what you want.
> I used it once a while ago, so if you can use ASP I'll dig it up and pass
> it on as an example for you.


Not sure, but I'm a bit scared of the expression "Legacy" :-)

I use DreamHost. I'm assuming you're familiar enough with it to know whether
they carry legacy ASP or not (or I can ask them, but it'll take a day or two
for an answer).

As you can see, I'm totally unfamiliar with ASP.


Reply With Quote
  #6 (permalink)  
Old 08-05-2008, 09:00 PM
mjs
 
Posts: n/a
Re: Seeking a "Text/Quote Randomizer" Script (nothing fancy)

Is it one or the other? Because I know it uses PHP (I use PHP includes here
and there). If that means no ASP, then I've got no ASP. :-)

Could you give me a working example of how the function you suggest works?

"kim" <kim@removegeekministry.com> wrote in message
news:g7aa9k$bqd$1@forums.macromedia.com...
> you could also use the rand() function in php if that's your server
> language



Reply With Quote
  #7 (permalink)  
Old 08-05-2008, 09:58 PM
Joe Makowiec
 
Posts: n/a
Re: Seeking a "Text/Quote Randomizer" Script (nothing fancy)

On 05 Aug 2008 in macromedia.dreamweaver, mjs wrote:

> I'm looking for a "text randomizer" script.
>
> There's a div in my layout that should be pulling up different
> content (randomly) each time the page reloads. Ideally, I'll like to
> stay away from databases and just use a text file. The way I'm
> envisioning it, there would be a different text on each line. All
> the script would have to do is randomly choose which line to pull
> text from and display it in the layout at the appropriate location.
> The layout is liquid, and will adapt to any amount of text pulled.
>
> The text should be treated like a normal include. In other words,
> HTML and CSS tags would work.
>
> I'm open to a PHP-based solution, even if I'm no PHP programmer.


Here's a quick-and-dirty I did a while back:

<?php
$quotesArray = file('quotes.txt');
$numQuotes = count($quotesArray); // Get the number of quotes N
$quote1 = rand(0,$numQuotes-1); // Want a random number between 0 and N-1
?>
<blockquote><?php echo $quotesArray[$quote1]; ?></blockquote>

This assumes a flat textfile named quotes.txt, in the same directory as
the page, with one quote per line. If the quotes have linebreaks in
them, the script thinks that they're separate quotes.

--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/contact.php
Reply With Quote
  #8 (permalink)  
Old 08-06-2008, 01:08 PM
mjs
 
Posts: n/a
Re: Seeking a "Text/Quote Randomizer" Script (nothing fancy)

"Joe Makowiec" <makowiec@invalid.invalid> wrote in message
news:Xns9AF1ACB62A946makowiecatnycapdotrE@216.104. 212.96...
>
> Here's a quick-and-dirty I did a while back:
>
> <?php
> $quotesArray = file('quotes.txt');
> $numQuotes = count($quotesArray); // Get the number of quotes N
> $quote1 = rand(0,$numQuotes-1); // Want a random number between 0 and N-1
> ?>
> <blockquote><?php echo $quotesArray[$quote1]; ?></blockquote>
>
> This assumes a flat textfile named quotes.txt, in the same directory as
> the page, with one quote per line. If the quotes have linebreaks in
> them, the script thinks that they're separate quotes.


Awesome. Could it parse HTML code? I mean, would it know what to do with a
line like :

<span class="quote">Hello<br><a href="#">test</a></span>

...?


Reply With Quote
  #9 (permalink)  
Old 08-06-2008, 05:19 PM
Joe Makowiec
 
Posts: n/a
Re: Seeking a "Text/Quote Randomizer" Script (nothing fancy)

On 06 Aug 2008 in macromedia.dreamweaver, mjs wrote:

> "Joe Makowiec" <makowiec@invalid.invalid> wrote in message
> news:Xns9AF1ACB62A946makowiecatnycapdotrE@216.104. 212.96...
>>
>> Here's a quick-and-dirty I did a while back:
>>
>> <?php
>> $quotesArray = file('quotes.txt');
>> $numQuotes = count($quotesArray); // Get the number of quotes N
>> $quote1 = rand(0,$numQuotes-1); // Want a random number between 0
>> and N-1 ?> <blockquote><?php echo $quotesArray[$quote1];
>> ?></blockquote>
>>
>> This assumes a flat textfile named quotes.txt, in the same
>> directory as the page, with one quote per line. If the quotes have
>> linebreaks in them, the script thinks that they're separate quotes.

>
> Awesome. Could it parse HTML code? I mean, would it know what to do
> with a line like :
>
> <span class="quote">Hello<br><a href="#">test</a></span>
>
> ..?


It doesn't care; it doesn't parse anything. I haven't tried it out
with UTF-8 charsets, but other than that, if you can put something into
a plain text file, the script as given will deal with it.

The only caveat I'd make is that making the code you include in the
text file work in context is left to you, the developer. If your
container is, say, a paragraph <p></p> rather than blockquote as above,
then you probably don't want to include headline tags <h2></h2> in the
quote you're importing.

--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/contact.php
Reply With Quote
  #10 (permalink)  
Old 08-06-2008, 07:21 PM
mjs
 
Posts: n/a
Re: Seeking a "Text/Quote Randomizer" Script (nothing fancy)

"Joe Makowiec" <makowiec@invalid.invalid> wrote in message
news:Xns9AF27D6C38596makowiecatnycapdotrE@216.104. 212.96...
>
> This assumes a flat textfile named quotes.txt, in the same
> directory as the page, with one quote per line. If the quotes have
> linebreaks in them, the script thinks that they're separate quotes.
>
> The only caveat I'd make is that making the code you include in the
> text file work in context is left to you, the developer. If your
> container is, say, a paragraph <p></p> rather than blockquote as above,
> then you probably don't want to include headline tags <h2></h2> in the
> quote you're importing.


Then I'm assuming it doesn't consider <br> a line break, since it's not
parsing anything. Nothing short of an actual unicode linebreak mark the end
of a quote, right?

(Or I could just test it... which I will do right now.) :-)



Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Software > Adobe Software > Dreamweaver


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



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


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0


Sponsors:
Computeach | Rapidshare and Megaupload | Loans | Image Hosting | Debt Help



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114