Page 1 of 1
Dynamic content from a file
Posted: Mon Mar 26, 2007 6:04 pm
by Neo
Hi all,
I have a requirement to read the contents from a file and display it one line at a time (like a ticker or a marquee but without the text movement). I have created a text file with all the contents that needs to be displayed line by line.
But I am unable to figure out how to integrate this file to my website and display the contents of the file one line at a time (at the top of my page below the header)?
Any pointers to this would be highly helpful
Thanks,
Neo
Re: Dynamic content from a file
Posted: Tue Mar 27, 2007 10:55 am
by Pierre M.
What about a Javascript script ?
Or a Java applet ?
I beg there are lots of such sample code freely available on the Internet. Put it in a Global Content Block (or a User Defined Tag, I never know).
Pierre M.
Re: Dynamic content from a file
Posted: Tue Mar 27, 2007 11:22 am
by RonnyK
Have you checked the tag "Random Quote", it is designed to work with data retrieved from a file. I don't know about parameters that can be used / are required.
http://dev.cmsmadesimple.org/projects/randomquote
Ronny
Re: Dynamic content from a file
Posted: Fri Mar 30, 2007 7:42 pm
by Neo
Hi Ronny,
Thanks for the info. Actually I tried to install the module "RandomQuote". But the problem seems to be that the project files are zip files and not a XML. I extracted the contents of the project "RandomQuote" into my modules folder. But when I accessed the Extensions --> Modules in CMS Admin page, the project randomquote is not displayed.
So I am not sure how to install this module. Any idea about it?
Thanks,
Neo
Re: Dynamic content from a file
Posted: Fri Mar 30, 2007 9:14 pm
by peugeot-304
Hi Neo,
it's not a module but a function. So both files should be in the "plugin folder". Then you can find it under "active content labels"
Rgds
Dieter
Re: Dynamic content from a file
Posted: Fri Mar 30, 2007 9:26 pm
by Neo
Hi peugot,
Thanks

. I am able to access the function from the CMS admin panel. But wanted to know where should I place the file? (like which directory should I place the file so that the php function can read the file?) . Because currently the function gives the following error
Warning: fopen(quotes.txt) [function.fopen]: failed to open stream: No such file or directory in /export/home2/www/cms/gwri/plugins/function.random_quote.php on line 23
Warning: filesize() [function.filesize]: stat failed for quotes.txt in /export/home2/www/cms/gwri/plugins/function.random_quote.php on line 24
Warning: fread(): supplied argument is not a valid stream resource in /export/home2/www/cms/gwri/plugins/function.random_quote.php on line 24
Warning: fclose(): supplied argument is not a valid stream resource in /export/home2/www/cms/gwri/plugins/function.random_quote.php on line 26
Thanks,
Neo
Re: Dynamic content from a file
Posted: Fri Mar 30, 2007 9:36 pm
by peugeot-304
Neo wrote:
Warning: fopen(quotes.txt) [function.fopen]: failed to open stream: No such file or directory in /export/home2/www/cms/gwri/plugins/function.random_quote.php on line 23
Warning: filesize() [function.filesize]: stat failed for quotes.txt in /export/home2/www/cms/gwri/plugins/function.random_quote.php on line 24
Warning: fread(): supplied argument is not a valid stream resource in /export/home2/www/cms/gwri/plugins/function.random_quote.php on line 24
Warning: fclose(): supplied argument is not a valid stream resource in /export/home2/www/cms/gwri/plugins/function.random_quote.php on line 26
Thanks,
Neo
It can't find the quote.txt
In the Explanaion it says:
Prints the a random quote from a file called quotes.txt placed in your
root directory. The quotes file must be setup with one quote per line.
Dieter
Re: Dynamic content from a file
Posted: Tue Apr 03, 2007 3:23 pm
by Neo
Hi all,
Thanks for the help. The random quote function is working now.
But the problem is it changes the quote every time the page is reloaded. Is anyone aware of any other module that dynamically changes the text even though the user is in the same page. Say for example, the user is in the same page and the quote in that page changes every 30 seconds or so. It would be great if some one can help in me through this. (currently fighting with this to achieve the dynamic content

).
Thanks,
Neo
Re: Dynamic content from a file
Posted: Wed Apr 04, 2007 9:03 pm
by Pierre M.
Pierre M. wrote:
What about a Javascript script ?
Or a Java applet ?
Pierre M.
Re: Dynamic content from a file
Posted: Thu Apr 05, 2007 12:31 am
by Dr.CSS
Source for scripts such as this...
http://dynamicdrive.com