• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Add a random quote block to the sidebar

Unmaintained Add a random quote block to the sidebar 1.0

No permission to download
Compatible XF 1.x versions
1.0, 1.1, 1.2, 1.3, 1.4, 1.5
This resource is not affiliated with XenForo Ltd.

This was requested in this thread and originally comes from a portal block done by Xarcell.
All I have done is explain for those without the portal how to add it to the sidebar.


Step 1: Unzip and upload the attached file to your /data directory so it shows as /data/RandomQuote


Step 2: Paste this in PAGE_CONTAINER just before </head>
Code:
<script type="text/javascript" charset="utf-8">
jQuery(document).ready(function($) {
    $.get('./data/RandomQuote/quotes.txt', function(data) {
        var quotes = data.split("\@");
        var idx = Math.floor(quotes.length * Math.random());
        $('.quotes').html(quotes[idx]);
    });
});
</script>

Step 3: Add this to EXTRA.css
Code:
.bqstart {
    float: left;
    font-size: 300%;
    margin-right: 5px;
    height: 15px;
}

.bqend {
    float: right;
    font-size: 300%;
    margin-top: -20px;
    height: 15px;
}
  .bq {
    font-family: "WCManoNegraBtaRegular", Arial, sans-serif;
    font-size: 180%;
    margin-right: 15px;
}
@font-face {
    font-family: 'WCManoNegraBtaRegular';
    src: url('./data/RandomQuote/WCManoNegraBta-webfont.eot');
    src: local('☺'), url('./data/RandomQuote/WCManoNegraBta-webfont.woff') format('woff'), url('./data/RandomQuote/WCManoNegraBta-webfont.ttf') format('truetype'), url('./data/RandomQuote/WCManoNegraBta-webfont.svg#webfonte6F4DwaZ') format('svg');
}

Step 4: Create a new template called random_quote and add this to it
Code:
<div class="secondaryContent">
<div class="bqstart">&#8220;</div>
<div class="quotes bq" style="padding-top: 10px; padding-right: 5px;"></div>
<div class="bqend">&#8221;</div>
</div>
If you want a title on the block then use this code instead
Code:
<div class="section">
<div class="secondaryContent">
<h3>Random Quote</h3>
<div class="bqstart">&#8220;</div>
<div class="quotes bq" style="padding-top: 10px; padding-right: 5px;"></div>
<div class="bqend">&#8221;</div>
</div>
</div>

Step 5: Edit forum_list and add this <xen:include template="random_quote" /> just before </xen:sidebar> or wherever you want it.


Adding new quotes
If you want to add new quotes, edit the /data/RandomQuote/quotes.txt file.
Add each new quote on a separate line as follows:

It's a recession when your neighbor loses his job; it's a depression when you lose yours. - Harry S Truman@
Any man who afflicts the human race with ideas must be prepared to see them misunderstood. - H. L. Mencken@
You must lose a fly to catch a trout. - George Herbert


Every entry except the last one must be terminated with an @


The result is as follows, with and without the block title.
quote.PNG
quote2.PNG
Author
Brogan
Downloads
59
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Brogan