Blocks

 
 
agelos panagiotakis
Here is a block for displaying random quotes from a text file
 
This is a block for displaying random quotes taken from a text file.
Each row of the textfile is considered to be a new quote!So edit this file so that it includes your own quotes!
make a dir named quote_of_the_day_txt_file
under yours [moodle_dir_location]/
and place inside it "block_quote_of_the_day_txt_file.php" and "quotes.txt"
also copy the included
lang/en/block_quote_of_the_day_txt_file.php in [moodle_dir_location]/lang/en/

smile

 
Average of ratings: -
Picture of Stuardo Herrera
Re: Here is a block for displaying random quotes from a text file
 
Nice block! instead of writing quotes in the text file, I wrote url's to images, and it works perfectly. Now it displays random images.
 
Average of ratings: -
Picture of Ari Tahvanainen
Re: Here is a block for displaying random quotes from a text file
 

Hi,

This is nice block and akkuna.fi uses it as "Päivän koulutusvinkki".

Problem has been that only I with SSH rights can change "changes.txt". Boring.

So I made fix. I made course where quote editor has rights. And copied changes.txt to file folder.

 $folderfile=$CFG->dataroot . '/103/quotes.txt';
 if($folderfile){
  $textfile = $folderfile;
 }else{
  $textfile = $CFG->wwwroot . '/blocks/' . $this->name() .'/quotes.txt';
 }

Ifs are unnecessary, if You know where file is, but if filefolder doesn't exists then You get blank screen.

So, in the included file is $folderfile commented.
// $folderfile=$CFG->dataroot . '/103/quotes.txt';

I make myself workless ...

- ari -

 
Average of ratings: -
Picture of Thomas Topham
Re: Here is a block for displaying random quotes from a text file
 
Sounds excellent, but I am getting a broken / corrupt file in that link... please could someone link to an active download of this block? Please please?

 
Average of ratings: -
Picture of Paul Perspectoff
Re: Here is a block for displaying random quotes from a text file
 
That's an elegant, simple solution! Quick to set up and use.

I'm using Moodle 1.9.7 and my installation is marginally different, however.

I downloaded and extracted the files.

Instead of copying the extracted file:

~/quote_of_the_day_txt_file/lang/en/block_quote_of_the_day_txt_file.php

into the <moodle installation directory>/lang/en/ folder, it should go into the
<moodle installation directory>/lang/en_utf8/ folder for newer versions of Moodle.

Also, the entire extracted folder

~/quote_of_the_day_txt_file/

can merely be copied into the

<moodle installation directory>/blocks/ folder.

The quotes.txt file can be edited directly there. Each quote must be on a single line. (The bold tags supplied in the example quotes.txt file are, of course, optional.)

Of course, it is important to add the block module as usual (as a Moodle administrator) using

Moodle -> Site administration -> Navigation (making sure to click on the Navigation menu item so that upgrades occur).

It should then appear as a block module for placement anywhere. Works great!
 
Average of ratings: -