Jump to content
xisto Community
EternalDragon

How Exactly Do You Make Switches...

Recommended Posts

I never been able to figure it out :P

Just sittin here wonderin...how do you make the switches like phpBB?

Example:

<!-- BEGIN switch_user_logged_in --><!-- BEGIN switch_user_logged_out -->

LoL..just never figured it out...cause I wanna try and add a switch to one of my mods...this be embarassin lol

Share this post


Link to post
Share on other sites

What you are showing looks to me like tpl code from a phpBB2 allthat you have shown

<!-- BEGIN switch_user_logged_in --><!-- BEGIN switch_user_logged_out -->
Is nothing more than HTML comments they are basically used within HTML to comment what a certain section of code is doing for example from the posting_body.tpl

<!-- BEGIN switch_html_checkbox --> This is a comment to explain the following code		  <tr><!-- this is HTML code-->			<td> <!--so is this-->			  <input type="checkbox" name="disable_html" {S_HTML_CHECKED} /> <!--and this-->			</td> <!--this too you can say anything in a comment HTML does'nt care-->			<td><span class="gen">{L_DISABLE_HTML}</span></td> <!--as you can see these-->		  </tr><!--are all code within comments to let you know what is happening--><!-- END switch_html_checkbox -->This is a comment to let you know that this section is over
To make a comment in HTML you use <!-- and end the comment with --> anything within these delimiters will not be seen as HTML because it is just a comment. Edited by Houdini (see edit history)

Share this post


Link to post
Share on other sites

Oh I see...thanks..but, lets say I want to make it where a mod cuts on or off....like for example my glowing header mod..and I want to be able to make a section in the admin panel to where it cuts the glowing text off or on.
Would I just make somethin like (in the file where the glowing text is: overall_header.tpl):

<!-- BEGIN switch_glow_on --><td align="center" width="100%" valign="middle"><span class="maintitle"><font color="{FONT_COLOR}" style="filter: glow(color={NAME_GLOW}); height: 5px; text-decoration: bold;">{SITENAME}</font></span><br /><span class="gen"><font color="{FONT_COLOR}" style="filter: glow(color={NAME_GLOW}); height: 5px; text-decoration: bold;">{SITE_DESCRIPTION}</font><br />  </span> <!-- END switch_glow_on -->

Then for it off:

<!-- BEGIN switch_glow_off --><td align="center" width="100%" valign="middle"><span class="maintitle">{SITENAME}</span><br /><span class="gen">{SITE_DESCRIPTION}<br />  </span> <!-- END switch_glow_off -->

Correct?
But, would I just make the section in the admin panel just a radio button with the name "switch_glow_on" or off?

Share this post


Link to post
Share on other sites

You would also have to define the {NAME_GLOW} in the includes/bbcode.php there is much more to it than what you are doing with a template. Best to look at this post from the phpBB site itself here

Share this post


Link to post
Share on other sites

This isn't bbcode though...

QUICK EDIT: I also defined the {NAME_GLOW} in another file. I'll post my mod:

##############################################################  ## MOD Title: Glowing Header MOD  ## MOD Author: EternalDragon < stephen_programmer@hotmail.com >  ##  ## MOD Description: Allows you to customise glow in header text ## from ACP.  ## MOD Version: 0.0.1  ##  ## Installation Level: Easy  ## Installation Time: 5-10 minutes.  ## Files To Edit:  ##			 includes/page_header.php  ##			 admin/admin_board.php  ##			 language/lang_english/lang_admin.php  ##			 templates/subSilver/admin/board_config_body.tpl  ##			 templates/subSilver/overall_header.tpl  ##			 ## Included Files: db_update.php  ##  ##############################################################  ## Author Notes:  ##  ## This MOD is now currently BETA. Adding ACP Layout soon.	##  ## This MOD is not yet Compliable with EasyMod.##   ##  ##############################################################  ## MOD History:  ##  ##   08-01-2005 - MOD Development started 0.0.1  ##  ##   08-02-2005 - Glowing Code Fitted in overall_header.tpl####   04-07-2006 - Figured a code that may fix browser problems.	   ##  ##############################################################  ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD  ################################################################# IMPORTANT MOD FIX:#### For those wanting to know about the browser compatibility, it is only compatible with## Internet Explorer Version 5.5 and later.## There is a code you may add that may fix the header to be viewed normally with other## browsers...I am not yet sure, you may test if you wish.#### CODE:#### Find:####	<tr>   ##	  <td class="row1">{L_NAME_GLOW}<br /><span class="gensmall">{L_NAME_GLOW_EXPLAIN}</span></td>   ##	  <td class="row2"><input class="post" type="text" size="25" maxlength="100" name="name_glow" value="{NAME_GLOW}" /></td>   ##   </tr>   ##   <tr>   ##	  <td class="row1">{L_FONT_COLOR}<br /><span class="gensmall">{L_FONT_COLOR_EXPLAIN}</span></td>   ##	  <td class="row2"><input class="post" type="text" size="25" maxlength="100" name="font_color" value="{FONT_COLOR}" /></td>   ##   </tr>#### After Add:####   <noscript>	 ##	 <tr>   ##	   <td class="row1">{L_SITE_NAME}<br /><span class="gensmall">{L_SITE_NAME_EXPLAIN}</span></td>   ##	   <td class="row2"><input class="post" type="text" size="25" maxlength="100" name="sitename" value="{SITENAME}" /></td>   ##	 </tr>   ##   </noscript>#### WARNING: You must add this AFTER you install the MOD so you can find the needed line of## code.###############################################################	#----------------------------  #  # Run the included db_update.php in the phpBB2 root directory.  #  #  #-----[ OPEN ]------------------------------------------  #  includes/page_header.php  #  #-----[ FIND ]------------------------------------------  #  	'SITENAME' => $board_config['sitename'],   #  #-----[ AFTER, ADD ]------------------------------------------  #  	// Glowing Header MOD -- EternalDragon  	'NAME_GLOW' => $board_config['name_glow'],	'FONT_COLOR' => $board_config['font_color'],	// Glowing Header MOD -- EternalDragon  #  #-----[ OPEN ]------------------------------------------  #  admin/admin_board.php  #  #-----[ FIND ]------------------------------------------  #	  "L_SITE_NAME" => $lang['Site_name'],  #  #-----[ AFTER, ADD ]------------------------------------------  #  	// Glowing Header MOD -- EternalDragon  	"L_NAME_GLOW" => $lang['name_glow'],  	"L_NAME_GLOW_EXPLAIN" => $lang['name_glow_explain'],	"L_FONT_COLOR" => $lang['font_color'],	"L_FONT_COLOR_EXPLAIN" => $lang['font_color_explain'],	// Glowing Header MOD -- EternalDragon  #  #-----[ FIND ]------------------------------------------  #	  "SITENAME" => $new['sitename'],  #  #-----[ REPLACE WITH ]------------------------------------------  #	  	"SITENAME" => $new['sitename'],	  	"NAME_GLOW" => $new['name_glow'], 	"FONT_COLOR" => $new['font_color'], #  #-----[ OPEN ]------------------------------------------  #  language/lang_english/lang_admin.php  #  #-----[ FIND ]------------------------------------------  #  ?>  #  #-----[ BEFORE, ADD ]------------------------------------------  #  	// Glowing Header MOD -- EternalDragon  	$lang['Name_glow'] = 'Name Glow Color';  	$lang['Name_glow_explain'] = 'Enter the color of the glow. And your text will glow that color and the font color will be white.';  	$lang['font_color'] = 'Title Font Color';	$lang['font_color_explain'] = 'Enter the color of the text inside the glow. The same color of the backround and the font color makes a better glow effect. (I.E. Background is black, so the font color would be best as black, or #000000)';	// Glowing Header MOD -- EternalDragon  #  #-----[ OPEN ]------------------------------------------  #  templates/subSilver/admin/board_config_body.tpl  #  #-----[ FIND ]------------------------------------------  #     <tr>  	  <td class="row1">{L_SITE_NAME}<br /><span class="gensmall">{L_SITE_NAME_EXPLAIN}</span></td>  	  <td class="row2"><input class="post" type="text" size="25" maxlength="100" name="sitename" value="{SITENAME}" /></td>     </tr>  #  #-----[ AFTER, ADD ]------------------------------------------  #     <tr>  	  <td class="row1">{L_NAME_GLOW}<br /><span class="gensmall">{L_NAME_GLOW_EXPLAIN}</span></td>  	  <td class="row2"><input class="post" type="text" size="25" maxlength="100" name="name_glow" value="{NAME_GLOW}" /></td>     </tr>     <tr>  	  <td class="row1">{L_FONT_COLOR}<br /><span class="gensmall">{L_FONT_COLOR_EXPLAIN}</span></td>  	  <td class="row2"><input class="post" type="text" size="25" maxlength="100" name="font_color" value="{FONT_COLOR}" /></td>     </tr> #  #-----[ OPEN ]------------------------------------------  #  templates/subSilver/overall_header.tpl  #  #-----[ FIND ]------------------------------------------  #  <td align="center" width="100%" valign="middle"><span class="maintitle">{SITENAME}</span><br /><span class="gen">{SITE_DESCRIPTION}<br />  </span>  #  #-----[ REPLACE WITH ]------------------------------------------  #  <td align="center" width="100%" valign="middle"><span class="maintitle"><font color="{FONT_COLOR}" style="filter: glow(color={NAME_GLOW}); height: 5px; text-decoration: bold;">{SITENAME}</font></span><br /><span class="gen"><font color="{FONT_COLOR}" style="filter: glow(color={NAME_GLOW}); height: 5px; text-decoration: bold;">{SITE_DESCRIPTION}</font><br />  </span>   #  #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------  #  # EoM

Edited by EternalDragon (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.