Page 1 of 1

Font Family Select Box

Posted: 11 Mar 2010, 06:20
by BBCode Bot
Font Family Select Box

Author: opalelement
Description: The Font Family BBCode inserts a dropdown selectbox with several fonts to choose from
Image

Installation: Open/styles/yourstyle/template/posting_buttons.html
Find:

Code: Select all

<select name="addbbcode20" onchange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]');this.form.addbbcode20.selectedIndex = 2;" title="{L_BBCODE_F_HELP}">
		<option value="50">{L_FONT_TINY}</option>
		<option value="85">{L_FONT_SMALL}</option>
		<option value="100" selected="selected">{L_FONT_NORMAL}</option>
		<option value="150">{L_FONT_LARGE}</option>
		<option value="200">{L_FONT_HUGE}</option>
	</select>
Add after, on a new line:

Code: Select all

<select name="addbbcodefont" onchange="bbfontstyle('[font=' + this.form.addbbcodefont.options[this.form.addbbcodefont.selectedIndex].value + ']', '[/font]');this.form.addbbcodefont.selectedIndex = 6;" title="Font style: [font=Tahoma]text[/font]">
      <option style="font-family: Tahoma;" value="Tahoma">Tahoma</option>
      <option style="font-family: Verdana;" value="Verdana">Verdana</option>
      <option style="font-family: Arial Black;" value="Arial Black">Arial Black</option>
      <option style="font-family: Comic Sans MS;" value="Comic Sans MS">Comic Sans MS</option>
      <option style="font-family: Lucida Console;" value="Lucida Console">Lucida Console</option>
      <option style="font-family: Palatino Linotype;" value="Palatino Linotype">Palatino Linotype</option>
      <option value="" selected="selected">Font Family</option>
      <option style="font-family: MS Sans Serif4;" value="MS Sans Serif4">MS Sans Serif4</option>
      <option style="font-family: System;" value="System">System</option>
      <option style="font-family: Georgia1;" value="Georgia1">Georgia1</option>
      <option style="font-family: Impact;" value="Impact">Impact</option>
      <option style="font-family: Courier;" value="Courier">Courier</option>
      <option style="font-family: Symbol;" value="Symbol">Symbol</option>
   </select>

We also need to create a BBCode
BBCode:

Code: Select all

[font={SIMPLETEXT}]{TEXT}[/font]
HTML:

Code: Select all

<span style="font-family:{SIMPLETEXT};">{TEXT}</span>
Helpline:

Code: Select all

No helpline and remember to set "Display on posting" to no
Example:

Code: Select all

[font=Tahoma]Hello world[/font]
[font=Verdana]Hello world[/font]
[font=Arial Black]Hello world[/font]
[font=Comic Sans MS]Hello world[/font]
[font=Lucida Console]Hello world[/font]
[font=Palatino Linotype]Hello world[/font]
[font=MS Sans Serif4]Hello world[/font]
[font=System]Hello world[/font]
[font=Georgia1]Hello world[/font]
[font=Impact]Hello world[/font]
[font=Courier]Hello world[/font]
[font=Wingdings]Hello world[/font]
Demo:
[font=Tahoma]Hello world[/font]
[font=Verdana]Hello world[/font]
[font=Arial Black]Hello world[/font]
[font=Comic Sans MS]Hello world[/font]
[font=Lucida Console]Hello world[/font]
[font=Palatino Linotype]Hello world[/font]
[font=MS Sans Serif4]Hello world[/font]
[font=System]Hello world[/font]
[font=Georgia1]Hello world[/font]
[font=Impact]Hello world[/font]
[font=Courier]Hello world[/font]
[font=Wingdings]Hello world[/font]

Re: Font Family Select Box

Posted: 15 Jul 2010, 12:35
by eman80
Thanks for this useful BBcode :thumb:

Re: Font Family Select Box

Posted: 28 Jul 2010, 00:46
by Arkshine
Thanks for the bbcode. :)

I see well the dropdown select box, butthe font names are not rendered ? Any ideas why ?

Re: Font Family Select Box

Posted: 28 Jul 2010, 08:31
by Stoker
*No, but check your edits and post a link to your site

Re: Font Family Select Box

Posted: 28 Jul 2010, 12:10
by Arkshine
It's a test board on my computer (using xampp), with prosilver. My edits are correct and also it's just a copy-paste... I've changed nothing else. All is working fine, just the style in the dropdown selectbox seems to be ignored. I've searched randomly to find a solution, I've found a mod BBCodeBox where the same thing happens and the style is well specificied for each <option>. ( not installed, but seen on the demo forum )

To be sure you understand, you should see something like :
font.png