Example Use: I use this as a random quote feature by adding comments posted by users of the board.
Based on Highway of Life's Random Signature Text - viewtopic.php?p=37780#p37780
The quotes only appear for logged in users and a customizable message is available for users that are logged out.
------------
1. Create a PHP file called 'quotes.php' -- Place this file in your root forum directory with 'index.php'
Place the following code in the file:
- Code: Select all
<?php
$quotes = 'Random Text 01
Random Text 02
Random Text 03
Random Text 04
Random Text 05
Random Text 06';
$split_array = explode("\n", $quotes);
$rand_keys = array_rand($split_array, 1);
header("content-type: application/x-javascript");
echo "<!--\n
document.write('{$split_array[$rand_keys]}');\n
//-->";
?>
2. Place the following code in your 'overall_header.html' -- [additional changes required for use with other styles because Glacier's functions are located in the menu and not where this tutorial is placing the quote line]
Find:
- Code: Select all
<ul class="linklist navlinks">
<li class="icon-home"><a href="{U_INDEX}" accesskey="h">{L_INDEX}</a> <!-- BEGIN navlinks --> <strong>‹</strong> <a href="{navlinks.U_VIEW_FORUM}">{navlinks.FORUM_NAME}</a><!-- END navlinks --></li>
<li class="rightside"><a href="#" onclick="fontsizeup(); return false;" class="fontsize" title="{L_CHANGE_FONT_SIZE}">{L_CHANGE_FONT_SIZE}</a></li>
<!-- IF U_EMAIL_TOPIC --><li class="rightside"><a href="{U_EMAIL_TOPIC}" title="{L_EMAIL_TOPIC}" class="sendemail">{L_EMAIL_TOPIC}</a></li><!-- ENDIF -->
<!-- IF U_EMAIL_PM --><li class="rightside"><a href="{U_EMAIL_PM}" title="{L_EMAIL_PM}" class="sendemail">{L_EMAIL_PM}</a></li><!-- ENDIF -->
<!-- IF U_PRINT_TOPIC --><li class="rightside"><a href="{U_PRINT_TOPIC}" title="{L_PRINT_TOPIC}" accesskey="p" class="print">{L_PRINT_TOPIC}</a></li><!-- ENDIF -->
<!-- IF U_PRINT_PM --><li class="rightside"><a href="{U_PRINT_PM}" title="{L_PRINT_PM}" accesskey="p" class="print">{L_PRINT_PM}</a></li><!-- ENDIF -->
</ul>
Place on new line after:
- Code: Select all
<ul class="linklist leftside">
<!-- IF not S_IS_BOT and S_USER_LOGGED_IN --><li class="quotehead">Famous Quotes -- </li>
<li><script type="text/javascript" src="quotes.php"></script></li><!-- ELSE --><li class="quotehead">Important Information from the Administrators --</li><li class="loggedout">Thank you for visiting our forum. Please login to enjoy the full features of our site.</li><!-- ENDIF -->
</ul>
3. Open 'colours.css'
At end, add
- Code: Select all
li.quotehead {
color: #105289;
font-weight: bold;
}
li.loggedout {
color: #FF0000;
}
4. Open 'common.css'
Find:
- Code: Select all
ul.navlinks {
padding-bottom: 1px;
margin-bottom: 1px;
/* border-bottom: 1px solid #FFFFFF; */
font-weight: bold;
}
Un-comment 'border-bottom' leaving the following:
- Code: Select all
ul.navlinks {
padding-bottom: 1px;
margin-bottom: 1px;
border-bottom: 1px solid #FFFFFF;
font-weight: bold;
}
6. Refresh your template and theme in the ACP
--------
You can change the quotes by replacing the 'Random Text 01', etc in 'quotes.php' --- Each quote goes on a separate line. Please note certain punctuation can cause a break in the code. As an example, and apostrophe needs to have a backslash before it to prevent code breaks.
Incorrect Text:
- Code: Select all
$quotes = 'It's a crazy place here.
Random Text 02
Random Text 03
Random Text 04
Random Text 05
Random Text 06';
- Code: Select all
$quotes = 'It\'s a crazy place here.
Random Text 02
Random Text 03
Random Text 04
Random Text 05
Random Text 06';
For more details please refer to HoL's Random Text in Signature Topic
A demo is available here: http://www.shadowflames.us

















