Wicher Site Admin
Joined: 16 Dec 2005 Posts: 1144 User's local time: 2024 Sep 11 - 10:43 AM Country IP : Country of choice:
Was This Post Helpful?
Users postingpoints:
Posts points:
Post gradiation:
|
Posted: Tue Dec 20, 2005 11:03 pm Post subject: |
Wicher
*Delete this user
Items with prefix * are permanent. | Close |
|
|
Add a random picture anywhere on your forum
Download the zip to obtain all needed files.
Code: |
-
- ##############################################################
- ## MOD Title: Random Image where ever you want
- ## MOD Author: Wicher
- ## MOD Description: Add a random picture anywhere on your forum
- ## MOD Version: 1.0.3
- ## PHPBB version: 2.0.17
- ## NOT EASYMOD COMPLIANT
- ## Installation Level: Easy
- ## Installation Time: 5~20 minutes
- ## Files to Edit: if installed in the header:
- ## templates/subSilver/overall_header.tpl
- ## includes/pageheader.php
- ## Also if installed at any other place:
- ## templates/subSilver/agreement.tpl
- ## templates/subSilver/confirm_body.tpl
- ## templates/subSilver/faq_body.tpl
- ## templates/subSilver/groupcp_info_body.tpl
- ## templates/subSilver/groupcp_user_body.tpl
- ## templates/subSilver/index_body.tpl (only if not allready put the installcode in here)
- ## templates/subSilver/login_body.tpl
- ## templates/subSilver/memberlist_body.tpl
- ## templates/subSilver/message_body.tpl
- ## templates/subSilver/modcp_body.tpl
- ## templates/subSilver/modcp_move.tpl
- ## templates/subSilver/modcp_split.tpl
- ## templates/subSilver/modcp_viewip.tpl
- ## templates/subSilver/posting_body.tpl
- ## templates/subSilver/privmsgs_body.tpl
- ## templates/subSilver/privmsgs_read_body.tpl
- ## templates/subSilver/profile_add_body.tpl
- ## templates/subSilver/profile_avatar_gallery.tpl
- ## templates/subSilver/profile_send_email.tpl
- ## templates/subSilver/profile_send_pass.tpl
- ## templates/subSilver/profile_view_body.tpl
- ## templates/subSilver/search_body.tpl
- ## templates/subSilver/search_results_posts.tpl
- ## templates/subSilver/search_results_topics.tpl
- ## templates/subSilver/uacp_body.tpl
- ## templates/subSilver/viewforum_body.tpl (only if not allready put the installcode in here)
- ## templates/subSilver/viewonline_body.tpl
- ## templates/subSilver/viewtopic_body.tpl (only if not allready put the installcode in here)
- ## You wil also have to edit all .tpl files, those that use the overall_header, in you template folder that came with other mods.
- ## Included Files: images/random/1.jpg
- ##############################################################
- ## Author Notes:
- ## Add a random picture on every page you want.
- ## This mod was made in conjunction with subSilver.
- ##
- ## 1.0.3 - took a bug out, it did not display all the images in the random folder.
- ##
- ## 1.0.2 - Added some info to the page_header.php code.
- ##
- ## 1.0.1 - Added more files to edit to avoid erors.
- ##
- ## 1.0.0 - Version with buggo's
- ##
- ## Create a folder named images/random
- ## Then add the pictures in here, numbering them from 1.jpg to whatever you like
- ## 1.jpg is allready included.
- ## Only logged in users can see the random images.
- ##
- ## DEMO: http://www.wichersmods.nl/dc
- ##############################################################
- ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
- ##############################################################
-
- #
- #-----[ UPLOAD ]------------------------------------------
- #
- Copy images/random/1.jpg to images/random/1.jpg
- #
- #-----[ OPEN ]------------------------------------------
- #
- includes/pageheader.php
- #
- #-----[ FIND ]------------------------------------------
- #
- //
- // Parse and show the overall header.
- //
- #
- #-----[ BEFORE, ADD ]------------------------------------------
- #you will have to edit this before you past it in page_header.php
- //Start file count Random Image
- //EDIT BELOW LINE.
- //YOURACCOUNT WILL BE YOUR ACCOUNT AT YOUR HOST, YOURBOARD WILL BE YOUR PHPBB FOLDERNAME.
- //IF YOU ARE NOT SURE WATH TO TYPE HERE, JUST LEAVE IT AS IT IS NOW AND UPLOAD THE FILE.
- //IF YOU EXECUTE THE FILE, YOU WILL GET AN ERROR THAT WILL TELL YOU EXACT YOUR SERVERPATH.
- //THEN COPY AND PAST FROM IT WHAT YOU NEED HERE.
-
- $pad = '/home/YOURACCOUNT/public_html/YOURPHPBBFOLDER/images/random/';
-
- //DONT EDIT BELOW.
- if (!$open = opendir($pad))
- {
- echo 'Cannot open folder '.$pad.' ! ';
- }
- else {
- $aantal = -1;
- while (($file = readdir($open)) !== false)
- {
- if (($file != '.') and ($file != '..'))
- {
- $aantal++;
- }
- }
- closedir($open);
-
- }
- $aantal = ($aantal-0);
- //$aantal is -1 there is a index.htm in the folder random,
- //For each other file then a numberd jpg you have to count of 1 of the totaal, e.g: $aantal = ($aantal-1);.
- //echo $aantal.' files';
- //remove the // from the start of the above line to test the file counting.
- //end file count Random Image
-
- #
- #-----[ FIND ]------------------------------------------
- #
- $template->assign_vars(array(
- #
- #-----[ AFTER, ADD ]------------------------------------------
- #
- 'IMGCOUNT' => $aantal,
- #
- #-----[ OPEN ]------------------------------------------
- #
- templates/subSilver/overall_header.tpl
- #
- #-----[ FIND ]------------------------------------------
- #
- </head>
- #
- #-----[ AFTER, ADD ]------------------------------------------
- #
- <!-- BEGIN switch_user_logged_in -->
- <SCRIPT>
- <!-- Hide script from older browsers
-
- imgCt={IMGCOUNT}
-
- function choosePic() {
- if (document.images) {
- thisImg = Math.floor((Math.random() * imgCt)) + 1
- document.randomImg.src = "images/random/" + thisImg + ".jpg"
- }
- }
-
- // stop hiding script -->
- </SCRIPT>
- <!-- END switch_user_logged_in -->
- #
- #-----[ FIND ]------------------------------------------
- #
- <body>
- #
- #-----[ REPLACE WITH ]------------------------------------------
- #
- <!-- BEGIN switch_user_logged_in -->
- <body onLoad="choosePic()">
- <!-- END switch_user_logged_in -->
- <!-- BEGIN switch_user_logged_out -->
- <body>
- <!-- END switch_user_logged_out -->
- #
- #-----[ SAVE/CLOSE ALL FILES ]----------------------------------------
- #
-
-
- ##############################################################################
- #-----[ WHERE DO YOU WANT THE IMAGE? ]------------------------------------------
- #
- #-----[OPTION 1]------------------------------------------
- #If you want the image to show on your overall_header so it shows on every page you open.
- #If you do this you cannot do option 2.
- #
- #-----[ OPEN ]------------------------------------------
- #
- templates/subSilver/overall_header.tpl
- #
- #-----[ FIND ]------------------------------------------
- #
-
- </table></td>
- </tr>
- </table>
-
- <br />
- #
- #-----[ AFTER, ADD ]------------------------------------------
- #
- <!-- BEGIN switch_user_logged_in -->
- <table width="100%" cellspacing="0" cellpadding="2" border="0" align="center">
- <tr>
- <td><span class="gensmall">Random smilie: <IMG SRC="images/random/1.jpg" NAME="randomImg"></span></td>
- </tr>
- </table>
- <!-- END switch_user_logged_in -->
- #
- #-----[ SAVE/CLOSE ALL FILES ]----------------------------------------
- #
-
-
- ##############################################################################
- #-----[OPTION 2]------------------------------------------
- #Option 2: If you want the image to show only on your forum index.
- #If you do this, you cannot do option 1.
- #
- #-----[ OPEN ]------------------------------------------
- #
- templates/subSilver/index_body.tpl
- #
- #-----[ FIND ]------------------------------------------
- #
- <table width="100%" cellspacing="0" cellpadding="2" border="0" align="center">
- <tr>
- <td align="left" valign="bottom"><span class="gensmall">
- #
- #-----[ BEFORE, ADD ]------------------------------------------
- #
- <!-- BEGIN switch_user_logged_in -->
- <table width="100%" cellspacing="0" cellpadding="2" border="0" align="center">
- <tr>
- <td><span class="gensmall">Random smilie: <IMG SRC="images/random/1.jpg" NAME="randomImg"></span></td>
- </tr>
- </table>
- <!-- END switch_user_logged_in -->
-
- #
- #You can do the same in view_topic.tpl and view_forum.tpl,
- #in fact you can put the code on every .tpl file in your phpbb forum.
- #
- #You will have to edit also the following .tpl files to avoid an error that randomImg.src is not defined.
- #templates/subSilver/agreement.tpl
- #templates/subSilver/confirm_body.tpl
- #templates/subSilver/faq_body.tpl
- #templates/subSilver/groupcp_info_body.tpl
- #templates/subSilver/groupcp_user_body.tpl
- #templates/subSilver/index_body.tpl (only if not allready put the installcode in here)
- #templates/subSilver/login_body.tpl
- #templates/subSilver/memberlist_body.tpl
- #templates/subSilver/message_body.tpl
- #templates/subSilver/modcp_body.tpl
- #templates/subSilver/modcp_move.tpl
- #templates/subSilver/modcp_split.tpl
- #templates/subSilver/modcp_viewip.tpl
- #templates/subSilver/posting_body.tpl
- #templates/subSilver/privmsgs_body.tpl
- #templates/subSilver/privmsgs_read_body.tpl
- #templates/subSilver/profile_add_body.tpl
- #templates/subSilver/profile_avatar_gallery.tpl
- #templates/subSilver/profile_send_email.tpl
- #templates/subSilver/profile_send_pass.tpl
- #templates/subSilver/profile_view_body.tpl
- #templates/subSilver/search_body.tpl
- #templates/subSilver/search_results_posts.tpl
- #templates/subSilver/search_results_topics.tpl
- #templates/subSilver/uacp_body.tpl
- #templates/subSilver/viewforum_body.tpl (only if not allready put the installcode in here)
- #templates/subSilver/viewonline_body.tpl
- #templates/subSilver/viewtopic_body.tpl (only if not allready put the installcode in here)
- #
- #At the bottom of all these files add these lines:
- <!--Start avoiding error with Random Image where ever you want-->
- <!-- BEGIN switch_user_logged_in -->
- <table width="100%" cellspacing="0" cellpadding="2" border="0" align="center">
- <tr>
- <td><span class="gensmall">Random smilie: <IMG SRC="images/random/1.jpg" NAME="randomImg" width="1" heigth="1"></span></td>
- </tr>
- </table>
- <!-- END switch_user_logged_in -->
- <!--End avoiding error with Random Image where ever you want-->
- #
- #Offcourse you can take the choice to remove the ' width="1" heigth="1"'
- #from this code so that the random image will be displayed.
- #
- #-----[ SAVE/CLOSE ALL FILES ]----------------------------------------
- #
- #
- #-----[ UPLOAD ALL FILES TO YOUR SERVER ]----------------------------------------
- #
- # EoM
|
_________________
Wicher's phpBB2 Mods | Wicher's phpBB3 Mods | Statistics Mod 4.x.x |
|