Wicher's phpBB2 Mods Forum Index Wicher's phpBB2 Mods
On this board you will find all phpBB2 mods that i have created over the years. Most mods are on this board installed. Before asking for support, be sure to have your board updated to the latest phpBB2 version.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Simple db_update generatorSimple db_update generator   Advanced db_update generatorAdvanced db_update generator 
 This board is protected by Phpbbantispam 

Random Image where ever you want

 
Board Alert Board Message
There are in this topic 4 posts to view if you are logged in.

You can log in or register via the login / registerlink here or in the header.
Back to top  Login here and be redirected to this TopicLogin here and be redirected to this Topic RegisterRegister
Reply to topic    Wicher's phpBB2 Mods Forum Index -> Wicher's phpBB Mods Was this Topic Helpful?  
Points for this topic: 0
Topic gradiation: 
View previous topic :: View next topic  
Author Random Image where ever you want
Wicher
Site Admin


Joined: 16 Dec 2005
Posts: 1144
User's local time:
2024 Mar 19 - 8:31 AM
Country IP         : Netherlands
Country of choice: Netherlands


Was This Post Helpful?

 
Users postingpoints:
58
Posts points:
0
Post gradiation:
PostPosted: Tue Dec 20, 2005 11:03 pm    Post subject: Reply with quote

Add a random picture anywhere on your forum

Download the zip to obtain all needed files.

Code:
  1. ##############################################################
  2. ## MOD Title: Random Image where ever you want
  3. ## MOD Author: Wicher
  4. ## MOD Description: Add a random picture anywhere on your forum
  5. ## MOD Version: 1.0.3
  6. ## PHPBB version: 2.0.17
  7. ## NOT EASYMOD COMPLIANT
  8. ## Installation Level: Easy
  9. ## Installation Time: 5~20 minutes
  10. ## Files to Edit:    if installed in the header:
  11. ##                  templates/subSilver/overall_header.tpl
  12. ##                  includes/pageheader.php
  13. ##               Also if installed at any other place:
  14. ##                  templates/subSilver/agreement.tpl
  15. ##                  templates/subSilver/confirm_body.tpl
  16. ##                  templates/subSilver/faq_body.tpl
  17. ##                  templates/subSilver/groupcp_info_body.tpl
  18. ##                  templates/subSilver/groupcp_user_body.tpl
  19. ##                  templates/subSilver/index_body.tpl (only if not allready put the installcode in here)
  20. ##                  templates/subSilver/login_body.tpl
  21. ##                  templates/subSilver/memberlist_body.tpl
  22. ##                  templates/subSilver/message_body.tpl
  23. ##                  templates/subSilver/modcp_body.tpl
  24. ##                  templates/subSilver/modcp_move.tpl
  25. ##                  templates/subSilver/modcp_split.tpl
  26. ##                  templates/subSilver/modcp_viewip.tpl
  27. ##                  templates/subSilver/posting_body.tpl
  28. ##                  templates/subSilver/privmsgs_body.tpl
  29. ##                  templates/subSilver/privmsgs_read_body.tpl
  30. ##                  templates/subSilver/profile_add_body.tpl
  31. ##                  templates/subSilver/profile_avatar_gallery.tpl
  32. ##                  templates/subSilver/profile_send_email.tpl
  33. ##                  templates/subSilver/profile_send_pass.tpl
  34. ##                  templates/subSilver/profile_view_body.tpl
  35. ##                  templates/subSilver/search_body.tpl
  36. ##                  templates/subSilver/search_results_posts.tpl
  37. ##                  templates/subSilver/search_results_topics.tpl
  38. ##                  templates/subSilver/uacp_body.tpl
  39. ##                  templates/subSilver/viewforum_body.tpl (only if not allready put the installcode in here)
  40. ##                  templates/subSilver/viewonline_body.tpl
  41. ##                  templates/subSilver/viewtopic_body.tpl (only if not allready put the installcode in here)
  42. ## You wil also have to edit all .tpl files, those that use the overall_header, in you template folder that came with other mods.
  43. ## Included Files: images/random/1.jpg
  44. ##############################################################
  45. ## Author Notes:
  46. ## Add a random picture on every page you want.
  47. ## This mod was made in conjunction with subSilver.
  48. ##
  49. ## 1.0.3 - took a bug out, it did not display all the images in the random folder.
  50. ##
  51. ## 1.0.2 - Added some info to the page_header.php code.
  52. ##
  53. ## 1.0.1 - Added more files to edit to avoid erors.
  54. ##
  55. ## 1.0.0 - Version with buggo's
  56. ##
  57. ## Create a folder named images/random
  58. ## Then add the pictures in here, numbering them from 1.jpg to whatever you like
  59. ## 1.jpg is allready included.
  60. ## Only logged in users can see the random images.
  61. ##
  62. ## DEMO: http://www.wichersmods.nl/dc
  63. ##############################################################
  64. ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
  65. ##############################################################
  66. #
  67. #-----[ UPLOAD ]------------------------------------------
  68. #
  69. Copy images/random/1.jpg to images/random/1.jpg
  70. #
  71. #-----[ OPEN ]------------------------------------------
  72. #
  73. includes/pageheader.php
  74. #
  75. #-----[ FIND ]------------------------------------------
  76. #
  77. //
  78. // Parse and show the overall header.
  79. //
  80. #
  81. #-----[ BEFORE, ADD ]------------------------------------------
  82. #you will have to edit this before you past it in page_header.php
  83. //Start file count Random Image
  84. //EDIT BELOW LINE.
  85. //YOURACCOUNT WILL BE YOUR ACCOUNT AT YOUR HOST, YOURBOARD WILL BE YOUR PHPBB FOLDERNAME.
  86. //IF YOU ARE NOT SURE WATH TO TYPE HERE, JUST LEAVE IT AS IT IS NOW AND UPLOAD THE FILE.
  87. //IF YOU EXECUTE THE FILE, YOU WILL GET AN ERROR THAT WILL TELL YOU EXACT YOUR SERVERPATH.
  88. //THEN COPY AND PAST FROM IT WHAT YOU NEED HERE.
  89. $pad = '/home/YOURACCOUNT/public_html/YOURPHPBBFOLDER/images/random/';
  90. //DONT EDIT BELOW.
  91. if (!$open = opendir($pad))
  92. {
  93.     echo 'Cannot open folder '.$pad.' ! ';
  94. }
  95. else {
  96.     $aantal = -1;
  97.     while (($file = readdir($open)) !== false)
  98.     {
  99.         if (($file != '.') and ($file != '..'))
  100.         {
  101.             $aantal++;
  102.         }
  103.     }
  104.     closedir($open);
  105.    
  106. }
  107. $aantal = ($aantal-0);
  108. //$aantal is -1 there is a index.htm in the folder random,
  109. //For each other file then a numberd jpg you have to count of 1 of the totaal, e.g: $aantal = ($aantal-1);.
  110. //echo $aantal.' files';
  111. //remove the // from the start of the above line to test the file counting.
  112. //end file count Random Image
  113. #
  114. #-----[ FIND ]------------------------------------------
  115. #
  116. $template->assign_vars(array(
  117. #
  118. #-----[ AFTER, ADD ]------------------------------------------
  119. #
  120.    'IMGCOUNT' => $aantal,
  121. #
  122. #-----[ OPEN ]------------------------------------------
  123. #
  124. templates/subSilver/overall_header.tpl
  125. #
  126. #-----[ FIND ]------------------------------------------
  127. #
  128. </head>
  129. #
  130. #-----[ AFTER, ADD ]------------------------------------------
  131. #
  132. <!-- BEGIN switch_user_logged_in -->
  133. <SCRIPT>
  134. <!-- Hide script from older browsers
  135.       imgCt={IMGCOUNT}
  136.       function choosePic() {
  137.          if (document.images) {
  138.             thisImg = Math.floor((Math.random() * imgCt)) + 1
  139.             document.randomImg.src = "images/random/" + thisImg + ".jpg"
  140.          }
  141.       }
  142. // stop hiding script -->
  143. </SCRIPT>
  144. <!-- END switch_user_logged_in -->
  145. #
  146. #-----[ FIND ]------------------------------------------
  147. #
  148. <body>
  149. #
  150. #-----[ REPLACE WITH ]------------------------------------------
  151. #
  152.    <!-- BEGIN switch_user_logged_in -->
  153. <body onLoad="choosePic()">
  154.    <!-- END switch_user_logged_in -->
  155.    <!-- BEGIN switch_user_logged_out -->
  156. <body>
  157.    <!-- END switch_user_logged_out -->
  158. #
  159. #-----[ SAVE/CLOSE ALL FILES ]----------------------------------------
  160. #
  161. ##############################################################################
  162. #-----[ WHERE DO YOU WANT THE IMAGE? ]------------------------------------------
  163. #
  164. #-----[OPTION 1]------------------------------------------
  165. #If you want the image to show on your overall_header so it shows on every page you open.
  166. #If you do this you cannot do option 2.
  167. #
  168. #-----[ OPEN ]------------------------------------------
  169. #
  170. templates/subSilver/overall_header.tpl
  171. #
  172. #-----[ FIND ]------------------------------------------
  173. #
  174.             </table></td>
  175.          </tr>
  176.       </table>
  177.       <br />
  178. #
  179. #-----[ AFTER, ADD ]------------------------------------------
  180. #
  181. <!-- BEGIN switch_user_logged_in -->
  182. <table width="100%" cellspacing="0" cellpadding="2" border="0" align="center">
  183.   <tr>
  184.    <td><span class="gensmall">Random smilie: <IMG SRC="images/random/1.jpg" NAME="randomImg"></span></td>
  185.   </tr>
  186. </table>
  187. <!-- END switch_user_logged_in -->
  188. #
  189. #-----[ SAVE/CLOSE ALL FILES ]----------------------------------------
  190. #
  191. ##############################################################################
  192. #-----[OPTION 2]------------------------------------------
  193. #Option 2: If you want the image to show only on your forum index.
  194. #If you do this, you cannot do option 1.
  195. #
  196. #-----[ OPEN ]------------------------------------------
  197. #
  198. templates/subSilver/index_body.tpl
  199. #
  200. #-----[ FIND ]------------------------------------------
  201. #
  202. <table width="100%" cellspacing="0" cellpadding="2" border="0" align="center">
  203.   <tr>
  204.    <td align="left" valign="bottom"><span class="gensmall">
  205. #
  206. #-----[ BEFORE, ADD ]------------------------------------------
  207. #
  208. <!-- BEGIN switch_user_logged_in -->
  209. <table width="100%" cellspacing="0" cellpadding="2" border="0" align="center">
  210.   <tr>
  211.    <td><span class="gensmall">Random smilie: <IMG SRC="images/random/1.jpg" NAME="randomImg"></span></td>
  212.   </tr>
  213. </table>
  214. <!-- END switch_user_logged_in -->
  215. #
  216. #You can do the same in view_topic.tpl and view_forum.tpl,
  217. #in fact you can put the code on every .tpl file in your phpbb forum.
  218. #
  219. #You will have to edit also the following .tpl files to avoid an error that randomImg.src is not defined.
  220. #templates/subSilver/agreement.tpl
  221. #templates/subSilver/confirm_body.tpl
  222. #templates/subSilver/faq_body.tpl
  223. #templates/subSilver/groupcp_info_body.tpl
  224. #templates/subSilver/groupcp_user_body.tpl
  225. #templates/subSilver/index_body.tpl (only if not allready put the installcode in here)
  226. #templates/subSilver/login_body.tpl
  227. #templates/subSilver/memberlist_body.tpl
  228. #templates/subSilver/message_body.tpl
  229. #templates/subSilver/modcp_body.tpl
  230. #templates/subSilver/modcp_move.tpl
  231. #templates/subSilver/modcp_split.tpl
  232. #templates/subSilver/modcp_viewip.tpl
  233. #templates/subSilver/posting_body.tpl
  234. #templates/subSilver/privmsgs_body.tpl
  235. #templates/subSilver/privmsgs_read_body.tpl
  236. #templates/subSilver/profile_add_body.tpl
  237. #templates/subSilver/profile_avatar_gallery.tpl
  238. #templates/subSilver/profile_send_email.tpl
  239. #templates/subSilver/profile_send_pass.tpl
  240. #templates/subSilver/profile_view_body.tpl
  241. #templates/subSilver/search_body.tpl
  242. #templates/subSilver/search_results_posts.tpl
  243. #templates/subSilver/search_results_topics.tpl
  244. #templates/subSilver/uacp_body.tpl
  245. #templates/subSilver/viewforum_body.tpl (only if not allready put the installcode in here)
  246. #templates/subSilver/viewonline_body.tpl
  247. #templates/subSilver/viewtopic_body.tpl (only if not allready put the installcode in here)
  248. #
  249. #At the bottom of all these files add these lines:
  250. <!--Start avoiding error with Random Image where ever you want-->
  251. <!-- BEGIN switch_user_logged_in -->
  252. <table width="100%" cellspacing="0" cellpadding="2" border="0" align="center">
  253.   <tr>
  254.    <td><span class="gensmall">Random smilie: <IMG SRC="images/random/1.jpg" NAME="randomImg" width="1" heigth="1"></span></td>
  255.   </tr>
  256. </table>
  257. <!-- END switch_user_logged_in -->
  258. <!--End avoiding error with Random Image where ever you want-->
  259. #
  260. #Offcourse you can take the choice to remove the ' width="1" heigth="1"'
  261. #from this code so that the random image will be displayed.
  262. #
  263. #-----[ SAVE/CLOSE ALL FILES ]----------------------------------------
  264. #
  265. #
  266. #-----[ UPLOAD ALL FILES TO YOUR SERVER ]----------------------------------------
  267. #
  268. # EoM

_________________

Wicher's phpBB2 Mods | Wicher's phpBB3 Mods | Statistics Mod 4.x.x
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Post new topic    Reply to topic    Wicher's phpBB2 Mods Forum Index -> Wicher's phpBB Mods
Author Random Image where ever you want Replies
Display posts from previous:   
Post new topic   Reply to topic    Wicher's phpBB2 Mods Forum Index -> Wicher's phpBB Mods All times are GMT

Was this Topic Helpful?  
Points for this topic: 0
Topic gradiation: 
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

This board is protected by Phpbbantispam
Powered by phpBB © 2001, 2005 phpBB Group

Googlepage: GooglePullerPage
IP Country Flag 2.9.4 © 2005, 2007 - 3Di (aka 3D)