SimplePortal

Customization => Blocks and Modifications => Block Requests => Topic started by: gibby on March 25, 2009, 12:04:18 AM

Title: Quotes block
Post by: gibby on March 25, 2009, 12:04:18 AM
Hi

I looked and could not find, is there a block for adding and displaying quotes?

Thanks

Gibby
Title: Re: Quotes block
Post by: Nathaniel on March 25, 2009, 12:11:02 AM
What exactly do you mean by 'quotes'?

Do you mean quotes from a posts/topics on your forum? From certain boards?

SimplePortal does have the 'Board News Block' which will display the first x characters from the most recent posts on a certain board.

There are also SimplePortal articles, like on the portal of this website. Which can be enabled using the 'Enable articles' setting. You can then add a category for your articles in the 'Categories' section. Topics can then be made into articles by clikcing the 'Add as Article' link when viewing the topic, or by using the Add Article area in the admin panel.
Title: Re: Quotes block
Post by: Immortal on March 25, 2009, 12:17:26 AM
I suppose he mean displaying in block random quotes from file maybe? 

If that's the case, then the easiest way would be add via php block.
Title: Re: Quotes block
Post by: gibby on March 25, 2009, 12:18:55 AM
Thanks for the reply

I now know how to configure those items - thanks  :D

I would like a block that I add personal quotes and they are then displayed in the block.

Quotes

Never eat yellow snow

Click for another / if can't do this just refresh to see a new one

I hope you understand

Thanks

Gibby
Title: Re: Quotes block
Post by: gibby on March 25, 2009, 12:19:59 AM
Thanks

So I just need a php script then add to the php block?

Do you have one  :nervous-happy:

Thanks

Gibby
Title: Re: Quotes block
Post by: gibby on March 25, 2009, 12:22:42 AM
Currently the news block that is a SMF feature kind of does the job - if I could change News to Quote then that would do, but then I would lose the ability to post some news to the members

A block would be better

Thanks

Gibby
Title: Re: Quotes block
Post by: Nathaniel on March 25, 2009, 12:33:39 AM
You should be able to do it with a Simple PHP block. Here is some very basic code that will do what you want if you put it in a PHP block.

Code: [Select]
global $scripturl;

$quotes = array(
'I am me!',
'I think therefore I am!',
'Howzat!',
'Lolz'
);

echo $quotes[rand(0, count($quotes)-1)], '<br /><br />
<a href="', $scripturl, '">Click Here for another Quote.</a>';

You can change the values in the $quotes array to add/change quotes.
Title: Re: Quotes block
Post by: gibby on March 25, 2009, 12:45:42 AM
Where you born GOOD or did you learn it...

wooow - it seems to work

Thanks

I will play and test today

Thanks

Gibby
Title: Re: Quotes block
Post by: gibby on March 25, 2009, 12:51:34 AM
Just remember to \ when you have a '

Everything looks good  ;D
Title: Re: Quotes block
Post by: geekfairy on August 09, 2009, 09:08:56 PM
That's excellent, how would I go about centering the text?

Thanks.
Title: Re: Quotes block
Post by: Nathaniel on August 10, 2009, 02:01:29 AM
@geekfairy,
The easiest way would be to add "text-align: center;" to the 'Custom Body Style' option for the block.
Title: Re: Quotes block
Post by: geekfairy on August 10, 2009, 02:24:19 AM
Thankyou! :) That was embarrassingly easy, I thought I'd have to add something to the code itself.

Thanks again :)
Title: Re: Quotes block
Post by: GrannyT on November 26, 2009, 10:20:40 AM
Please can someone tell me what I'm doing wrong here - the block is showing but says:
Parse error: syntax error, unexpected T_STRING, expecting ')' in /home/xxxxxxxx/public_html/forum/Sources/PortalBlocks.php(3272) : eval()'d code on line 3

(I know they're corny quotes but they're for our kids site.)
Code: [Select]
global $scripturl;
$quotes = array(
'A dog is a person's best friend',
'I think therefore I am',
'Troubles never seem so bad the next morning',
'Adults are obsolete children.',
'Be Yourself. Who else is better qualified?',
'Children are apt to live up to what you believe of them',
'Imagination is the one weapon in the war against reality',
'Any sufficiently advanced technology is indistinguishable from magic',
'Always do right - this will gratify some and astonish the rest',
'Whatever you can do or dream you can do, begin it',
'Never go to a doctor whose office plants have died',
'Expressing anger is a form of public littering',
'A child needs your love most when he deserves it least',
'Children are like wet cement. Whatever falls on them makes an impression',
'There's no half-singing in the shower, you're either a rock star or an opera diva',
'Dogs have Owners, Cats have Staff',
'Parents are not interested in justice, they're interested in peace and quiet',
'To err is human--and to blame it on a computer is even more so'
);
echo $quotes[rand(0, count($quotes)-1)], '<br /><br />
<a href="', $scripturl, '">Click Here for another Quote.</a>';
Title: Re: Quotes block
Post by: ccbtimewiz on November 26, 2009, 10:46:23 AM
Escape your single quotes.

Example: 'A dog is a person\'s best friend';
Title: Re: Quotes block
Post by: GrannyT on November 26, 2009, 02:02:58 PM
Thank you ccbtimewiz - now I understand what Gibby meant earlier. :-[ Works fine now. ;D
Title: Re: Quotes block
Post by: Old Fossil on April 29, 2010, 09:33:25 AM
Sorry to wake this topic up but is there a way this can be updated?

Title: Re: Quotes block
Post by: ccbtimewiz on April 29, 2010, 10:42:28 AM
There is nothing to update.
Title: Re: Quotes block
Post by: Old Fossil on April 29, 2010, 11:17:07 AM
There is nothing to update.

I tried to add this to a block but had an error.

Also in regards to the link at the bottom where is it supposed to lead to?
Title: Re: Quotes block
Post by: AngelinaBelle on April 29, 2010, 12:11:31 PM
Did you try a direct select/copy/paste from Nathaniel's quote block?
If you changed any of the quotations, did you remember to put a "\" before any ' in the quotation?
What error did you get?
Title: Re: Quotes block
Post by: Old Fossil on April 29, 2010, 12:18:10 PM
Er

Can ya see me  :-[

If I use Nathaniels code it is working.

If I use GrannyTs it doesn't.

All I gotta do now is centre the text and work out where the link should point to.

Title: Re: Quotes block
Post by: ccbtimewiz on April 29, 2010, 01:20:32 PM
The link points to your board index
Title: Re: Quotes block
Post by: AngelinaBelle on April 29, 2010, 01:20:45 PM
The link is just pointing to $scripturl, which is your forum's index.php
 
You can just lose the link.
Title: Re: Quotes block
Post by: Old Fossil on April 29, 2010, 01:36:29 PM
How would I centre the text?
Title: Re: Quotes block
Post by: Old Fossil on April 29, 2010, 02:05:40 PM
Sorted.

A bit of Jiggery Pokery and got it.

Title: Re: Quotes block
Post by: Nothingness on November 20, 2011, 07:29:23 PM
@geekfairy,
The easiest way would be to add "text-align: center;" to the 'Custom Body Style' option for the block.
Does that apply for italic? Trying to do a italic with centered text. Am using <i> tags for the time being.

What's the code to make it fade without refreshing the page?
Title: Re: Quotes block
Post by: Old Fossil on November 21, 2011, 06:29:05 AM
Nothingeness please start a seperate topic.
Title: Re: Quotes block
Post by: [SiNaN] on November 21, 2011, 01:08:53 PM
Does that apply for italic? Trying to do a italic with centered text. Am using <i> tags for the time being.

You can use font-style: italic; for italic.

What's the code to make it fade without refreshing the page?

Try this block code in a Custom HTML block:

Code: [Select]
<ul class="reset" id="quotes_fade_scroller">
<li>Quote 1</li>
<li>Quote 2</li>
<li>Quote 3</li>
<li>Quote 4</li>
</ul>
<script type="text/javascript" src="Themes/default/scripts/fader.js"></script>
<script type="text/javascript"><!-- // --><![CDATA[
var oQuotesFader = new smf_NewsFader({
sSelf: 'oQuotesFader',
sFaderControlId: 'quotes_fade_scroller',
sItemTemplate: '<strong>%1$s<' + '/strong>',
iFadeDelay: 5000
});
// ]]></script>
Title: Re: Quotes block
Post by: Nothingness on November 21, 2011, 01:46:48 PM
Nothingeness please start a seperate topic.
It's related. ;)

You can use font-style: italic; for italic.
Awesome.

Quote
Try this block code in a Custom HTML block:

Code: [Select]
<ul class="reset" id="quotes_fade_scroller">
<li>Quote 1</li>
<li>Quote 2</li>
<li>Quote 3</li>
<li>Quote 4</li>
</ul>
<script type="text/javascript" src="Themes/default/scripts/fader.js"></script>
<script type="text/javascript"><!-- // --><![CDATA[
var oQuotesFader = new smf_NewsFader({
sSelf: 'oQuotesFader',
sFaderControlId: 'quotes_fade_scroller',
sItemTemplate: '<strong>%1$s<' + '/strong>',
iFadeDelay: 5000
});
// ]]></script>
Perfect, much better than php code, any way to make it less bold?
Title: Re: Quotes block
Post by: [SiNaN] on November 21, 2011, 01:55:00 PM
Code: (Find) [Select]
sItemTemplate: '<strong>%1$s<' + '/strong>',
Code: (Replace) [Select]
sItemTemplate: '%1$s',
Title: Re: Quotes block
Post by: Nothingness on November 21, 2011, 02:00:20 PM
Stupid me, it's simply removing the <strong> tags. Thanks again. :)
Title: Re: Quotes block
Post by: [SiNaN] on November 21, 2011, 02:14:53 PM
You're welcome. ;)
SimplePortal 2.3.8 © 2008-2024, SimplePortal