Welcome to Geeklog, Anonymous Friday, November 29 2024 @ 04:45 pm EST
Geeklog Forums
Random HTML Block
Status: offline
cypry
Forum User
Newbie
Registered: 06/06/05
Posts: 13
Location:UK
I wanted a block that could display a random webcam image from a list of 20+ cams, so I wrote this custom function to achieve it. You can obviously use this for pretty much any html you like, not just cams, so it could be useful for displaying banners or any images you like.
*/
function phpblock_randhtml ()
{
$aHTML[0] = 'Put some html here';
$aHTML[1] = 'Put some different html here';
$aHTML[2] = 'Put even more html here';
$aHTML[3] = 'Put yet more html here - add as many of these lines as you like, each with a different consecutive [number]';
$iUpper = sizeof($aHTML) - 1;
$iLower = 0;
$iIndex = rand($iLower, $iUpper);
return $aHTML[$iIndex];
}
It's pretty simple, but might be useful. Just add the code above to the end of your lib-custom.php, edit the code to add your desired html and create a new block calling the function phpblock_randhtml. You'll now have a block that displays a random selection from your various html lines - simple
This block is used for the "Surfcam" block at cypry.com
cypry.com - dubs, drops and descents......
Text Formatted Code
*Custom Block for displaying random html*/
function phpblock_randhtml ()
{
$aHTML[0] = 'Put some html here';
$aHTML[1] = 'Put some different html here';
$aHTML[2] = 'Put even more html here';
$aHTML[3] = 'Put yet more html here - add as many of these lines as you like, each with a different consecutive [number]';
$iUpper = sizeof($aHTML) - 1;
$iLower = 0;
$iIndex = rand($iLower, $iUpper);
return $aHTML[$iIndex];
}
It's pretty simple, but might be useful. Just add the code above to the end of your lib-custom.php, edit the code to add your desired html and create a new block calling the function phpblock_randhtml. You'll now have a block that displays a random selection from your various html lines - simple
This block is used for the "Surfcam" block at cypry.com
cypry.com - dubs, drops and descents......
11
12
Quote
All times are EST. The time is now 04:45 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content