Dynamic content from a file

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
User avatar
Neo
Forum Members
Forum Members
Posts: 62
Joined: Thu Jan 18, 2007 1:09 am

Dynamic content from a file

Post 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
Pierre M.

Re: Dynamic content from a file

Post 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.
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: Dynamic content from a file

Post 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
User avatar
Neo
Forum Members
Forum Members
Posts: 62
Joined: Thu Jan 18, 2007 1:09 am

Re: Dynamic content from a file

Post 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
peugeot-304

Re: Dynamic content from a file

Post 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
User avatar
Neo
Forum Members
Forum Members
Posts: 62
Joined: Thu Jan 18, 2007 1:09 am

Re: Dynamic content from a file

Post 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
peugeot-304

Re: Dynamic content from a file

Post 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
User avatar
Neo
Forum Members
Forum Members
Posts: 62
Joined: Thu Jan 18, 2007 1:09 am

Re: Dynamic content from a file

Post 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
Pierre M.

Re: Dynamic content from a file

Post by Pierre M. »

Pierre M. wrote: What about a Javascript script ?
Or a Java applet ?
Pierre M.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Dynamic content from a file

Post by Dr.CSS »

Source for scripts such as this...

http://dynamicdrive.com
Post Reply

Return to “Layout and Design (CSS & HTML)”