Sign Up! Login: Password: New User? Forgot? Support
Top Mods!
Wowhead Search
by sonofsamedi
Digital Clock
by Wolfar15
Admin Forums
Welcome to the GuildPortal Help Community! These forums are for admin-to-admin help.
Available Forums
Forums : Pimp My Site! > Random Message Generator
Rhiannanna (Guild Admin) 10/5/2008 10:04 AM EST : Random Message Generator
Rhiannanna
Posts: 1501
Zomgawsh Poster

Is there a way of coding a freeform box so that on refresh it randomly loads one of several messages? there are several little 'titbits' of info about the site that are too little or vague to demand a forum post about it. like 'message of the day'

Also is there a way of coding a content box to only be visable to members and above whilst still allowing the main page to be seen. or splitting the messages so some only appear for officer rank


for an idea what i'm on about: please see the forum tab on my site (link in sig) the random content box at the top.


errrrrrrrrrrrrrrrm there was another question and i have forgotten

ah yes not so much a question as a request.

Should you be the wonderful genius able to answer all these questions, please tell me EXACTLY where to put it, i dont understand CSS, tendes to screw up everything when i try and sort it. i am completely hopeless when it comes to coding.


Thanking you for reading
Congratulations if it made sense, because i'm damned if it does to me
and *hugs* in advance for responses eitehr way

./hotpoint


TopBottom

Mottie (MVP) 10/5/2008 8:01 PM EST : RE: Random Message Generator
GuildPortal MVP
Mottie
Posts: 3884
Zomgawsh Poster

Hi Rhiannanna!

I posted some code below on how to add a random quotes box... I hope that's what you wanted!

I have no idea how to determine the security access of someone visiting your site, but I do know the Welcome box has the ability to display different information depending on your access level. I'd take the general information out of the welcome box and put it into a free form text/HTML box, then use the welcome box elsewhere for what you need.


Random Quotes Box

This script just adds a box that displays random text, images or even embeded objects. Just follow the examples and instructions below

The Code

<style type="text/css">
#randomQuote { background: #000000 url(); border: #333333 1px solid; width:200px; text-align:left;}
.hide {display:none;}
</style>
<div id="quotebx" align="center">
<div id="randomQuote"></div>

<!--
******************************
 Add your random quotes below.
 
 <div id="quote#" class="hide">
  QUOTE HERE
 </div>
****************************** -->

<div id="quote1" class="hide">
 "Once you can accept the universe as matter expanding into nothing that is something, wearing stripes with plaid comes easy."<br>
 ~Albert Einstein

</div>

<div id="quote2" class="hide">
 "The main reason Santa is so jolly is because he knows where all the bad girls live."<br>
  ~George Carlin

</div>

<div id="quote3" class="hide">
 "I busted a mirror and got seven years bad luck, but my lawyer thinks he can get me five."<br>
 ~Steven Wright

</div>

<div id="quote4" class="hide">
 Homer: Are you saying you're never going to eat any animal again? What about bacon?<br>
 Lisa: No.<br>
 Homer: Ham?<br>
 Lisa: No.<br>
 Homer: Pork chops?<br>
 Lisa: Dad, those all come from the same animal.<br>
 Homer: Heh heh heh. Ooh, yeah, right, Lisa. A wonderful, magical animal.<br>

</div>

<div id="quote5" class="hide">
 <img src="http://i201.photobucket.com/albums/aa236/Mottie1/forums/lecturer.gif" align="right">
 A linguistics professor was lecturing to his English class one day.<br>
 <br>
 "In English," he said, "A double negative forms a positive. In some languages, though, such as Russian, a double negative is still a negative.<br>
 <br>
 However, there is no language wherein a double positive can form a negative."<br>
 <br>
 A voice from the back of the room piped up, "Yeah, right."<br>

</div>

<div id="quote6" class="hide">
 <img src="http://i201.photobucket.com/albums/aa236/Mottie1/forums/05.jpg">
</div>

<script type="text/javascript">
// ********************************
// Don't change anything below this line
// ********************************
var quotes = ($("#quotebx").find("div").length) - 1;
var rnd = "#quote" + Math.floor((Math.random()*(quotes))+1);
$("#randomQuote").html($(rnd).html());
</script>
</div>

Customizing

  • The "#randomQuote" in the CSS defines the style of the quote box.

    • Background color "#000000" & image "url(URL TO IMAGE)" can be modified.

    • Border color "#333333", thickness and style.

    • "width:200px;" can be changed to fit your column width. It's not really necessary, but I added it for testing.

  • Add more quotes by adding the following template:

     <div id="quote#" class="hide">
     QUOTE HERE
     </div>

    • Replace the "#" in "quote#" with the next number in the series.

    • Add your text, images or embedded objects in the "QUOTE HERE" area.

  • Make sure that when you add the script, you are in HTML mode () FIRST!!!
TopBottom

Admins Online
There are   members online.
So-and-so has logged on!
%title%
%message%