Sunday, January 1, 2012

How to Add Random Quotes to Oxwall

This Oxwall tutorial explains how to add random quotes to an Oxwall social networking website.

I recently wanted to add some random quotes to a newly created Oxwall website. After a quick review of available plugins I saw that to date there was no plugin that would create site wide random quotes. Rather than create a plugin which would have a learning curve attached to it, I decided to simply put the quotes into a script which I then added to the custom html widget.

Below are instructions on how to add a random quotes to an Oxwall website.

  1. Copy the following script:

    <i><center><script language="JavaScript">
    quotes = new Array(7);
    quotes[0] = "True originality consists not in a new manner but in a new vision. Edith Wharton (1862 - 1937)";
    quotes[1] = "To be mature means to face, and not evade, every fresh crisis that comes. Fritz Kunkel";
    quotes[2] = "That's not a haircut. That's a cry for help.";
    quotes[3] = "Eliminate something superfluous from your life. Break a habit. Do something that makes you feel insecure. Piero Ferrucci";
    quotes[4] = "Some days it's just not worth gnawing through the leather straps.";
    quotes[5] = "We were born to unite with our fellow men, and to join in community with the human race. Cicero";
    quotes[6] = "Never regret something that once made you smile. Amber Deckers";
    //calculate a random index
    index = Math.floor(Math.random() * quotes.length);
    //display the quotation
    document.write("\n");
    document.write(quotes[index]);
    //done
    </script>

    </center></i>

  2. Sign in to the admin area of your Oxwall website

  3. Click the Pages and Menus icon at the top of the page and then select User Dashboard from the drop down menu

  4. Click on the custom text/HTML icon on the right sidebar and move the widget to where you want it located by holding down the mouse and dragging the widget to the place you want it. I think the best place is probably above Newsfeed

  5. Click on the edit button at the right of the custom text/HTML widget

  6. Paste the code (copied in Step 1) into the Content (text/HTML) area

    Oxwall Add Random Quotes
  7. Give your widget a name is you wish for instance Random Quotes

  8. Place a tick in the box

  9. Select a suitable icon from the drop down box entitled Add eg star

  10. Check Wrap in a Box

  11. Check Freeze. This will prevent any user tampering with the widget code but it will also stop them being able to move the box around the dashboard. Please note that if a user clicks on the Customize this page button the option to edit the widget will not be available to them.

  12. Click on Save. The widget will be highlighted in red to show that it has been frozen

    Oxwall Add Random Quotes - Freeze Widget

  13. Go to Dashboard and if you have followed these instructions correctly you will now be able to see a random quote above the Newsfeed.


How To Add More Random Quotes to the Script
It is not difficult to add additional quotes or quotations to the script. Simply take the following steps:

  1. Decide on the number of quotes you require

  2. Change the following line to the number of quotes + 1. So for example if you want 10 quotes enter 11. Therefore change the line:

    quotes = new Array(7);

    to:

    quotes = new Array(11);


Hopefully you will find this Oxwall random quotes tutorial useful. If you enjoyed it please consider following me as I will be adding more Oxwall tutorials in the near future.