SimplePortal
Customization => Blocks and Modifications => Block Requests => Topic started 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
-
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.
-
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.
-
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
-
Thanks
So I just need a php script then add to the php block?
Do you have one :nervous-happy:
Thanks
Gibby
-
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
-
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.
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.
-
Where you born GOOD or did you learn it...
wooow - it seems to work
Thanks
I will play and test today
Thanks
Gibby
-
Just remember to \ when you have a '
Everything looks good ;D
-
That's excellent, how would I go about centering the text?
Thanks.
-
@geekfairy,
The easiest way would be to add "text-align: center;" to the 'Custom Body Style' option for the block.
-
Thankyou! :) That was embarrassingly easy, I thought I'd have to add something to the code itself.
Thanks again :)
-
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.)
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>';
-
Escape your single quotes.
Example: 'A dog is a person\'s best friend';
-
Thank you ccbtimewiz - now I understand what Gibby meant earlier. :-[ Works fine now. ;D
-
Sorry to wake this topic up but is there a way this can be updated?
-
There is nothing to update.
-
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?
-
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?
-
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.
-
The link points to your board index
-
The link is just pointing to $scripturl, which is your forum's index.php
You can just lose the link.
-
How would I centre the text?
-
Sorted.
A bit of Jiggery Pokery and got it.
-
@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?
-
Nothingeness please start a seperate topic.
-
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:
<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>
-
Nothingeness please start a seperate topic.
It's related. ;)
You can use font-style: italic; for italic.
Awesome.
Try this block code in a Custom HTML block:
<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?
-
sItemTemplate: '<strong>%1$s<' + '/strong>',
sItemTemplate: '%1$s',
-
Stupid me, it's simply removing the <strong> tags. Thanks again. :)
-
You're welcome. ;)