random quote

RandallC

Well-known member
I want to add random quote to the header area on my forum but every code I found for some reason needs a button on there that changes the quote. I know there is a random one out there just to display text in a normal fashion.

I dont know all of them I have tried are not what I am looking for.

Think of Hello Dolly from wordpress is what I am looking for. Just displays random text.
 
This can be done without an add-on. Utilize the Advertising setup. The following code will load a random quote each page load.

Setup -> Advertising -> Add advertisement ->
Title: Quotes
Position: Container header
HTML:
Code:
            <div class="p-header-quote u-hideWide">
                <xf:set var="$quote.1">Random quote #1</xf:set>
                <xf:set var="$quote.2">Random quote #2</xf:set>
                <xf:set var="$quote.3">Random quote #3</xf:set>
                <xf:set var="$quote.4">Random quote #4</xf:set>
                <xf:set var="$quote.5">Random quote #5</xf:set>
                <xf:set var="$quote.6">Random quote #6</xf:set>
                <xf:set var="$quote.7">Random quote #7</xf:set>
                {$quote.{{ ($xf.time % 7) + 1 }}|raw}
            </div>

Save.


Pretty easy to edit. Each quote requires its own line (just increase the number)

Code:
<xf:set var="$quote.#">Random quote #7</xf:set>

You also need to adjust the: $xf.time % 7 value to the number of quotes you have. Example if you only have 3 quotes:

Code:
            <div class="p-header-quote u-hideWide">
                <xf:set var="$quote.1">Random quote #1</xf:set>
                <xf:set var="$quote.2">Random quote #2</xf:set>
                <xf:set var="$quote.3">Random quote #3</xf:set>
                {$quote.{{ ($xf.time % 3) + 1 }}|raw}
            </div>

The "u-hideWide" class will also automatically hide the quotes at the "wide width" so they won't be shown on smaller screens.
 
This is great, I've been looking for something to display random quotes like this. Would there be any suggestions on how people can submit quotes to the added to the list? All my quotes are from members posts over time, so something where it actually links to members profiles would be good as well but probably too much for this
 
Sorry it's taken to peplas I have been fidgung server issues.
Rebuild your gran is very expensive.
Would you consider dwith you doing the work!

The big question is we need to see pictures so we can evaluate.
 
Back
Top Bottom