Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: codenaught on October 09, 2004, 12:37:49 PM

Title: Fonts drop down selection & URL in post screen
Post by: codenaught on October 09, 2004, 12:37:49 PM
Am I the only one who thinks that the way the size, font, and url method should to be changed? I think instead of by hitting the size button and have it enter the post screen as [size=10pt][/size] have a drop down menu where you to pick the available sizes on the forum. Same goes with font. When you click the font button it enters [font=Verdana][/font] but wouldn't you want users to know all of the font types available and so he wouldn't have to type the font type themself? So I suggest a drop down thing for that, perhaps how the color thing works. Wouldn't it be annoying if the color thing worked the same way, by hitting a color button it would pop up as [color=Black][/color] and you would have to manually change it. I think the same things goes with the others.

Also I think the URL method should be changed. While you could manually type in [URL=http://www.simplemachines.com]test[/URL] it would be easier if when clicking the URL button for it to ask, 'enter the text to display for the link (optional)' and then it would ask for the URL of the link. 
Title: Re: Drop Down Selection in post screen
Post by: andrea on October 09, 2004, 01:27:30 PM
You can achieve all this by themeing: modifying "Post.template.php" and eventually the .js file.
Title: Re: Drop Down Selection in post screen
Post by: [Unknown] on October 09, 2004, 06:46:27 PM
Some people do like this, others don't...

-[Unknown]
Title: Re: Drop Down Selection in post screen
Post by: codenaught on October 09, 2004, 07:18:09 PM
Well if that is the case, maybe in a future version of SMF you can have an option for admins to set as the default what method they want to have it. And then users could perhaps edit the default method to what they prefer. Also a mod of this would be okay if it won't be placed in as a feature.
Title: Re: Drop Down Selection in post screen
Post by: A.M.A on October 09, 2004, 07:37:56 PM
open Post.template.php and look for:
// Print a drop down list for all the colors we allow!
add before it:
// Print a drop down list for font size!
echo ' <select onchange="surroundText(\'[size=\'+this.options[this.selectedIndex].value+\']\', \'[/size]\', document.', $context['post_form'], '.', $context['post_box_name'], '); this.selectedIndex = 0;" style="margin-bottom: 1ex;">
<option value="" selected="selected">Font Size</option>
<option value="10pt">10pt</option>
<option value="14pt">14pt</option>
<option value="18pt">18pt</option>
</select>';
echo '<br />';

and you have your own font size dropdown list .. the same method can be used for fonts name.
Title: Re: Drop Down Selection in post screen
Post by: codenaught on October 09, 2004, 07:55:52 PM
Thank you very much! :D Now do you know how I could do something for the url thing so when you click on the url button it first asks for a name to the link and then it asks for the url of the link instead of just entering [url][/url]
Title: Re: Drop Down Selection in post screen
Post by: A.M.A on October 10, 2004, 08:53:28 AM
1- Font Size & Name drop down list
open Post.template.php and look for:
<option value="LimeGreen">', $txt[275], '</option>
</select>';
echo '<br />';

Delete the last line, and Add belew it:

  // Begin Print a drop down list for font face . . . . . . .
    echo ' <select onchange="surroundText(\'[font=\'+this.options[this.selectedIndex].value+\']\', \'[/font]\', document.', $context['post_form'], '.', $context['post_box_name'], '); this.selectedIndex = 0;" style="margin-bottom: 1ex;">
            <option value="" selected="selected">Font Face</option>
            <option value="Arial">Arial</option>
            <option value="Times New Roman">Times New Roman</option>
            <option value="Tahoma">Tahoma</option>
            <option value="Verdana">Verdana</option>
            </select>';
  // End Print a drop down list for font face . . . . . . . .

  // Begin Print a drop down list for font size . . . . . . .
    echo ' <select onchange="surroundText(\'[size=\'+this.options[this.selectedIndex].value+\']\', \'[/size]\', document.', $context['post_form'], '.', $context['post_box_name'], '); this.selectedIndex = 0;" style="margin-bottom: 1ex;">
            <option value="" selected="selected">Font Size</option>
            <option value="10pt">10pt</option>
            <option value="14pt">14pt</option>
            <option value="18pt">18pt</option>
            </select>';
    echo '<br />';
  // End Print a drop down list for font size . . . . . . . .


Note:
* you can modify the red text: <option value="10pt">10pt</option> to your own needs.
* to remove the default tag buttons, look for and delete:
array(),
'size' => array('code' => 'size', 'before' => '[size=10pt]', 'after' => '[/size]', 'description' => $txt[532]),
'face' => array('code' => 'font', 'before' => '[font=Verdana]', 'after' => '[/font]', 'description' => $txt[533]),



2- URL input boxes
look for:
// Print a drop down list for all the colors we allow!
add above:
    // Java script to handle URL input boxes ...
    echo '<script language="JavaScript" type="text/javascript">
          <!--
          function urlINPT(){
          // Enter URL .........................................
          var urlLINK = prompt("Please enter URL address:","http://");
          if (urlLINK == null ){ //cancel pressed . . .
          }
          else if (urlLINK == "" || urlLINK == " "){ //ok pressed but with Notext . . .
                  alert("Sorry no text entered!");
          }
          else
          { //ok pressed and there is something :)
          // Enter Description ...................................
          var urlNAME = prompt("Please enter URL name:","");
          if (urlNAME == null ){ //cancel pressed . . .
          }
          else if (urlNAME == "" || urlNAME == " "){  //ok pressed but with notext so use URL only!
                    surroundText(\'[url]\'+urlLINK+\'\', \'[/url]\', document.', $context['post_form'], '.', $context['post_box_name'], ');
          }
          else //ok pressed with text so use URL and Name!
                    surroundText(\'[url=\'+urlLINK+\']\'+urlNAME+\'\', \'[/url]\', document.', $context['post_form'], '.', $context['post_box_name'], ');
          }
          }
          // -->
          </script>';

look for:
// Print the buttom row of buttons!
foreach ($context['bbc_tags'][1] as $image => $tag)
{

add after:
      // only replace the URL tag! . . . . . . . . . . .
      if ($tag['code'] == 'url')
          echo '<a href="javascript:void(0);" onclick="urlINPT(); return false;"><img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
      else
Title: Re: Fonts drop down selection & URL in post screen
Post by: codenaught on October 10, 2004, 10:31:25 AM
Thank you very much! This is a big help!
Title: Re: Fonts drop down selection & URL in post screen
Post by: codenaught on November 21, 2004, 10:11:31 AM
Okay, but could someone tell me how to do a small change to the url one.

Here is what I want to do. When you highlight code and hit the url button, it asks for the address and then it asks you for the name of the link. How about when you highlight text it will just ask you for the url and it will use the highlighted text as the name of the link.

Any help would be nice.
Title: Re: Fonts drop down selection & URL in post screen
Post by: damo1065 on December 04, 2004, 01:05:50 PM
Works like a dream thanks.

Does anyone know what colours you can add to the drop down colour menu, I know HotPink works - it gives you a nice deep pink colour, what other ones can you add?
Title: Re: Fonts drop down selection & URL in post screen
Post by: helenbpd on December 05, 2004, 05:43:18 PM
I'd imagine you can use any of the "named" colors - they may not work for every single browser (only 16 "names" are web-safe), but what the hey:

http://webdesign.about.com/od/colorcharts/l/bl_namedcolors.htm

Ditto for fonts:

http://www.i4image.com/resources_wsfont.shtml

Title: Re: Fonts drop down selection & URL in post screen
Post by: Peter Duggan on January 15, 2005, 06:35:15 AM
Quote from: damo1065 on December 04, 2004, 01:05:50 PM
Does anyone know what colours you can add to the drop down colour menu, I know HotPink works - it gives you a nice deep pink colour, what other ones can you add?

Perhaps I'm a bit late with this response but, since you can specify both option value and option, the answer (with one small reservation explained below) is anything you like because you can specify hex codes for the values and descriptive text for the options. So, for an English language forum, all of these are basically equivalent:

<option value="Red">', $txt[263], '</option>
<option value="Red">Red</option>
<option value="Red">Any name you like</option>
<option value="#ff0000">', $txt[263], '</option>
<option value="#ff0000">Red</option>
<option value="#ff0000">Any name you like</option>


Which means that, so long as you're happy to see 'any name you like' translated into #****** in the text area, your choice of colours for the drop-down amounts to > 16 million!
Title: Re: Fonts drop down selection & URL in post screen
Post by: Peter Duggan on January 15, 2005, 06:39:15 AM
Quote from: akabugeyes on October 09, 2004, 12:37:49 PM
Same goes with font. When you click the font button it enters [font=Verdana][/font] but wouldn't you want users to know all of the font types available and so he wouldn't have to type the font type themself? So I suggest a drop down thing for that, perhaps how the color thing works. 

But remember that the 'font types available' are the fonts installed on the user's computer, so one user's choice (and/or yours as admin) may not display for another user at all.
Title: Re: Fonts drop down selection & URL in post screen
Post by: rojamaia on August 27, 2005, 11:50:57 AM
thanks to everyone for sharing this trick!  it would really make things simpler for my users who are mostly beginners in using boards.

but hey, how do i code it, so that the actual font face and size would appear (as a preview) on the drop-down menu?
Title: Re: Fonts drop down selection & URL in post screen
Post by: Snickers on September 08, 2005, 11:01:33 AM
Can anyone make this compitable with version 1.1 beta 3?
Title: Re: Fonts drop down selection & URL in post screen
Post by: JohnnyVW on September 25, 2005, 01:22:48 AM
Quote from: akabugeyes on November 21, 2004, 10:11:31 AM
Okay, but could someone tell me how to do a small change to the url one.

Here is what I want to do. When you highlight code and hit the url button, it asks for the address and then it asks you for the name of the link. How about when you highlight text it will just ask you for the url and it will use the highlighted text as the name of the link.

Any help would be nice.

I would love to do this too!  I will be doing nightly posts with links; this will make things go so much quicker!

Thanks!
Title: Re: Fonts drop down selection & URL in post screen
Post by: nokonium on December 28, 2005, 09:51:09 AM
I've been playing with this today and it is great, working OK except for one small thing with RC2 (yes it is legit, co-admin is a CM) The javascript for the URL is asking for the URL twice, it doesn't ask for the description on the second box.

And a supplimentary question, is there a way to put a border around the drop down box, like there is with input, text areas or radio buttons? The drop down list has a border but not the 'inactive' box.

In case this is a browser issue I'm using Opera 8.51.

Title: Re: Drop Down Selection in post screen
Post by: SleePy on December 28, 2005, 04:19:29 PM
After i added the code A.M.A showed us i get these to errors in my error log

8: Undefined index: description
File: /home/***/public_html/forums/Themes/helios/languages/Post.english.php (eval?)
Line: 874

8: Undefined index: code
File: /home/***/public_html/forums/Themes/helios/languages/Post.english.php (eval?)
Line: 871


edit. there is no line 874 or 871 in that file...  :(

edit 2: i was able to get rid of the description one by changing the thing a little
changed
Quoteif ($tag['code'] == 'url')
          echo '<a href="javascript:void(0);" onclick="urlINPT(); return false;"><img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
To
Quoteif ($tag['code'] == 'url')
      {
      global $tag;
          echo '<a href="javascript:void(0);" onclick="urlINPT(); return false;"><img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
      }

but i can't seem to get the other one to stop.
Title: Re: Fonts drop down selection & URL in post screen
Post by: nokonium on December 28, 2005, 05:13:08 PM
I get it, according to the error log on line 866. As the changes were made in Post.template I had a look there and line 866 is     if ($tag['code'] == 'url')

// only replace the URL tag! . . . . . . . . . . .
      if ($tag['code'] == 'url')
          echo '<a href="javascript:void(0);" onclick="urlINPT(); return false;"><img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';


That may need changing to work without errors.
Title: Re: Fonts drop down selection & URL in post screen
Post by: SleePy on December 29, 2005, 11:24:07 PM
i was able to fix it by moving the if statement around

// Print the buttom row of buttons!
foreach ($context['bbc_tags'][1] as $image => $tag)
{
  if (isset($tag['before']))
{
// Is this tag disabled?
if (!empty($context['disabled_tags'][$tag['code']]))
continue;

// only replace the URL tag! . . . . . . . . . . .
      if ($tag['code'] == 'url')
   {
global $tag;
echo '<a href="javascript:void(0);" onclick="urlINPT(); return false;"><img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
else{
// If there's no after, we're just replacing the entire selection in the post box.
if (!isset($tag['after']))
echo '<a href="javascript:void(0);" onclick="replaceText(\'', $tag['before'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';
// On the other hand, if there is one we are surrounding the selection ;).
else
echo '<a href="javascript:void(0);" onclick="surroundText(\'', $tag['before'], '\', \'', $tag['after'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';

// Okay... we have the link.  Now for the image and the closing </a>!
echo '<img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
}
// I guess it's a divider...
else
echo '<img src="', $settings['images_url'], '/bbc/divider.gif" alt="|" style="margin: 0 3px 0 3px;" />';
}

echo '
</td>
</tr>';
}
Title: Re: Fonts drop down selection & URL in post screen
Post by: nokonium on December 30, 2005, 02:43:44 PM
Thanks SleePy
Title: Re: Fonts drop down selection & URL in post screen
Post by: Gobo on February 17, 2006, 05:08:19 PM
Thanks :D

works great with 1.1rc2 :D
Title: Re: Fonts drop down selection & URL in post screen
Post by: comatose on March 08, 2006, 10:59:22 PM
Quote from: SleePy on December 29, 2005, 11:24:07 PM
i was able to fix it by moving the if statement around

// Print the buttom row of buttons!
foreach ($context['bbc_tags'][1] as $image => $tag)
{
  if (isset($tag['before']))
{
// Is this tag disabled?
if (!empty($context['disabled_tags'][$tag['code']]))
continue;

// only replace the URL tag! . . . . . . . . . . .
      if ($tag['code'] == 'url')
   {
global $tag;
echo '<a href="javascript:void(0);" onclick="urlINPT(); return false;"><img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
else{
// If there's no after, we're just replacing the entire selection in the post box.
if (!isset($tag['after']))
echo '<a href="javascript:void(0);" onclick="replaceText(\'', $tag['before'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';
// On the other hand, if there is one we are surrounding the selection ;).
else
echo '<a href="javascript:void(0);" onclick="surroundText(\'', $tag['before'], '\', \'', $tag['after'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';

// Okay... we have the link.  Now for the image and the closing </a>!
echo '<img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
}
// I guess it's a divider...
else
echo '<img src="', $settings['images_url'], '/bbc/divider.gif" alt="|" style="margin: 0 3px 0 3px;" />';
}

echo '
</td>
</tr>';
}


works good for me, but only problem i seen is that when you put your mouse over the URL icon the Description of that icon does not pop up anymore?
how can i fix that?
Title: Re: Fonts drop down selection & URL in post screen
Post by: comatose on March 12, 2006, 09:12:55 PM
Quote from: comatose on March 08, 2006, 10:59:22 PM
works good for me, but only problem i seen is that when you put your mouse over the URL icon the Description of that icon does not pop up anymore?
how can i fix that?

Anyone?
Title: Re: Fonts drop down selection & URL in post screen
Post by: yeahimsteve on March 16, 2006, 05:45:49 AM
Can somebody please say clearly what needs to be edited for 1.1Rc2??

I do not have anything close to // Print a drop down list for all the colors we allow!" in my Post.Template.php.  I'm using the Classic template.  From all the modifications in this thread, it's getting confusing, as half the stuff doesn't exist in 1.1Rc2.  Help please!  Thanks in advance...
Title: Re: Fonts drop down selection & URL in post screen
Post by: Gobo on March 20, 2006, 01:23:09 PM
try a search for

<option value="10pt">10pt</option>

im sure ull find it easy...

remember if u cant loacte the exact text given in the post try to search for other lines... :D
Title: Re: Fonts drop down selection & URL in post screen
Post by: TechnoDragon on June 09, 2006, 03:22:19 AM
OK, i have edited this code to work perfectly with RC2 and here it is all together in one nice, neat little post:

NOTE: all of this editing is done in the post.template.php file

To make the names of the colors appear in that color:
Find:
<option value="" selected="selected">', $txt['change_color'], '</option>
<option value="Black">', $txt[262], '</option>
<option value="Red">', $txt[263], '</option>
<option value="Yellow">', $txt[264], '</option>
<option value="Pink">', $txt[265], '</option>
<option value="Green">', $txt[266], '</option>
<option value="Orange">', $txt[267], '</option>
<option value="Purple">', $txt[268], '</option>
<option value="Blue">', $txt[269], '</option>
<option value="Beige">', $txt[270], '</option>
<option value="Brown">', $txt[271], '</option>
<option value="Teal">', $txt[272], '</option>
<option value="Navy">', $txt[273], '</option>
<option value="Maroon">', $txt[274], '</option>
<option value="LimeGreen">', $txt[275], '</option>


Replace:
<option value="" selected="selected">', $txt['change_color'], '</option>
<option value="Black" style="color:black">', $txt[262], '</option>
<option value="Silver" style="color:silver">', $txt[263], '</option>
<option value="Gray" style="color:gray">', $txt[264], '</option>
<option value="Maroon" style="color:maroon">', $txt[266], '</option>
<option value="Red" style="color:red">', $txt[267], '</option>
<option value="Purple" style="color:purple">', $txt[268], '</option>
<option value="Fuchsia" style="color:fuchsia">', $txt[269], '</option>
<option value="Green" style="color:green">', $txt[270], '</option>
<option value="Lime" style="color:lime">', $txt[271], '</option>
<option value="Olive" style="color:olive">', $txt[272], '</option>
<option value="Yellow" style="color:yellow">', $txt[273], '</option>
<option value="Navy" style="color:navy">', $txt[274], '</option>
<option value="Blue" style="color:blue">', $txt[275], '</option>
<option value="Teal" style="color:teal">', $txt[265], '</option>


for the pop-up tags (IMG and URL):
In your post.template.php file (usually in the default theme directory) find this code:
// Print a drop down list for all the colors we allow!

add this before:
    // Java script to handle IMG input boxes ...
    echo '<script language="JavaScript" type="text/javascript">
          <!--
          function imgINPT(){
          // Enter IMG .........................................
          var imgLINK = prompt("Please enter IMG address:","http://");
          if (imgLINK == null ){ //cancel pressed . . .
          }
          else if (imgLINK == "" || imgLINK == " "){ //ok pressed but with Notext . . .
                  alert("Sorry no text entered!");
          }
          else
          { //ok pressed with text so use IMG and Name!
                    surroundText(\'[img]\'+imgLINK+\'\', \'[/img]\', document.', $context['post_form'], '.', $context['post_box_name'], ');
          }
          }
          // -->
          </script>';
 
    // Java script to handle URL input boxes ...
    echo '<script language="JavaScript" type="text/javascript">
          <!--
          function urlINPT(){
          // Enter URL .........................................
          var urlLINK = prompt("Please enter URL address:","http://");
          if (urlLINK == null ){ //cancel pressed . . .
          }
          else if (urlLINK == "" || urlLINK == " "){ //ok pressed but with Notext . . .
                  alert("Sorry no text entered!");
          }
          else
          { //ok pressed and there is something :)
          // Enter Description ...................................
          var urlNAME = prompt("Please enter URL name:","");
          if (urlNAME == null ){ //cancel pressed . . .
          }
          else if (urlNAME == "" || urlNAME == " "){  //ok pressed but with notext so use URL only!
                    surroundText(\'[url]\'+urlLINK+\'\', \'[/url]\', document.', $context['post_form'], '.', $context['post_box_name'], ');
          }
          else //ok pressed with text so use URL and Name!
                    surroundText(\'[url=\'+urlLINK+\']\'+urlNAME+\'\', \'[/url]\', document.', $context['post_form'], '.', $context['post_box_name'], ');
          }
          }
          // -->
          </script>';


then find this code:
// Print the buttom row of buttons!
foreach ($context['bbc_tags'][1] as $image => $tag)
{
if (isset($tag['before']))
{
// Is this tag disabled?
if (!empty($context['disabled_tags'][$tag['code']]))
continue;

// If there's no after, we're just replacing the entire selection in the post box.
if (!isset($tag['after']))
echo '<a href="javascript:void(0);" onclick="replaceText(\'', $tag['before'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';
// On the other hand, if there is one we are surrounding the selection ;).
else
echo '<a href="javascript:void(0);" onclick="surroundText(\'', $tag['before'], '\', \'', $tag['after'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';

// Okay... we have the link. Now for the image and the closing </a>!
echo '<img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
// I guess it's a divider...
else
echo '<img src="', $settings['images_url'], '/bbc/divider.gif" alt="|" style="margin: 0 3px 0 3px;" />';
}

echo '
</td>
</tr>';
}


and replace it with this:
// Print the buttom row of buttons!
foreach ($context['bbc_tags'][1] as $image => $tag)
{
  if (isset($tag['before']))
{
// Is this tag disabled?
if (!empty($context['disabled_tags'][$tag['code']]))
continue;

// only replace the IMG tag! . . . . . . . . . . .
      if ($tag['code'] == 'img')
   {
global $tag;
echo '<a href="javascript:void(0);" onclick="imgINPT(); return false;"><img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="Insert Image" title="Insert Image" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
// only replace the URL tag! . . . . . . . . . . .
      elseif ($tag['code'] == 'url')
   {
global $tag;
echo '<a href="javascript:void(0);" onclick="urlINPT(); return false;"><img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
else{
// If there's no after, we're just replacing the entire selection in the post box.
if (!isset($tag['after']))
echo '<a href="javascript:void(0);" onclick="replaceText(\'', $tag['before'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';
// On the other hand, if there is one we are surrounding the selection ;).
else
echo '<a href="javascript:void(0);" onclick="surroundText(\'', $tag['before'], '\', \'', $tag['after'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';

// Okay... we have the link.  Now for the image and the closing </a>!
echo '<img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
}
// I guess it's a divider...
else
echo '<img src="', $settings['images_url'], '/bbc/divider.gif" alt="|" style="margin: 0 3px 0 3px;" />';
}

echo '
</td>
</tr>';
}


When this is done, any new posts that are made, when the IMG or URL BBC tag is selected will pop-up a box.  For the IMG tag it is simply to put the url of the image, for the URL tag it will first ask for the link, then the text you want to display (if any) for the link.

Now for the font styles and sizes:
once again in the post.template.php file (again, in your default theme directory) find this code:
<option value="LimeGreen">', $txt[275], '</option>
</select>';
echo '<br />';


and this code after it:
  // Begin Print a drop down list for font face . . . . . . .
    echo ' <select onchange="surroundText(\'[font=\'+this.options[this.selectedIndex].value+\']\', \'[/font]\', document.', $context['post_form'], '.', $context['post_box_name'], '); this.selectedIndex = 0;" style="margin-bottom: 1ex;">
            <option value="" selected="selected">Font Face</option>
            <option value="Arial" style="font-family:arial">Arial</option>
            <option value="Arial Black" style="font-family:arial black">Arial Black</option>
            <option value="Comic Sans MS" style="font-family:comic sans ms">Comic Sans MS</option>
            <option value="Courier New" style="font-family:courier new">Courier New</option>
            <option value="Georgia" style="font-family:georgia">Georgia</option>
            <option value="Times New Roman" style="font-family:times new roman">Times New Roman</option>
            <option value="Tahoma" style="font-family:tahoma">Tahoma</option>
            <option value="Verdana" style="font-family:verdana">Verdana</option>
    <option value="Trebuchet MS" style="font-family:trebuchet ms">Trebuchet MS</option>
    <option value="Impact" style="font-family:impact">Impact</option>
            </select>';
  // End Print a drop down list for font face . . . . . . . .

  // Begin Print a drop down list for font size . . . . . . .
    echo ' <select onchange="surroundText(\'[size=\'+this.options[this.selectedIndex].value+\']\', \'[/size]\', document.', $context['post_form'], '.', $context['post_box_name'], '); this.selectedIndex = 0;" style="margin-bottom: 1ex;">
            <option value="" selected="selected">Font Size</option>
            <option value="10pt" style="font-size:8px">8pt</option>
            <option value="12pt" style="font-size:10px">10pt</option>
            <option value="14pt" style="font-size:12px">12pt</option>
            <option value="16pt" style="font-size:14px">14pt</option>
            <option value="20pt" style="font-size:18px">18pt</option>
            </select>';
    echo '<br />';
  // End Print a drop down list for font size . . . . . . . .


then do a search for this:
array(),
'size' => array('code' => 'size', 'before' => '[size=10pt]', 'after' => '[/size]', 'description' => $txt[532]),
'face' => array('code' => 'font', 'before' => '[font=Verdana]', 'after' => '[/font]', 'description' => $txt[533]),


and remove it.

Now instead of posters trying to guess what fonts are available or the size they want, they can just select it.

EDIT: Changed the code to actually show the font style as well as the name, color shows name as well as color, and font size is name as well as size.

EDIT2: Fixed the image BBC button not have the hover to tell what it is.
Title: Re: Fonts drop down selection & URL in post screen
Post by: Gobo on June 10, 2006, 05:56:26 AM
hey thanks techno :D

do u know of any way so that the "sizes" and "colors" for the font are visible in the drop down list?

Something like this----imagine its the drop down list:

Size 10
Size 15
Size 20
Size 25
Size 30

same with colors only as colors like this:

Black
Blue
Red
Green

do u know how?
Thanks
Title: Re: Fonts drop down selection & URL in post screen
Post by: TechnoDragon on June 10, 2006, 03:32:47 PM
Check the original post...i just finished editing the code to do exactly as you requested as well as added 6 other fonts that are web friendly to the list.
Title: Re: Fonts drop down selection & URL in post screen
Post by: Gobo on June 10, 2006, 05:11:25 PM
Thanks works really wondefully :D
Title: Re: Fonts drop down selection & URL in post screen
Post by: nokonium on June 11, 2006, 06:42:00 PM
If you have a contrast problem with the font colour in the dropdown you can add a background colour

<option value="Black" style="color:black; background-color: #ffffff;">', $txt[262], '</option>

Unfortunately all the above do not work in all browsers

Fire Fox - All work (font colour, font face and font size)
IE6 - Colour only (font face and font size don't work)
Opera 8 - None work
Title: Re: Fonts drop down selection & URL in post screen
Post by: Vinspire on June 13, 2006, 01:45:01 PM
Can i see a demo or screenshot of this first before i apply it to my forum ? :(
Title: Re: Fonts drop down selection & URL in post screen
Post by: nokonium on June 13, 2006, 03:08:53 PM
SMF Theme - Dark Blue (1.1RC2)
XP theme - Slate
Browser - FireFox

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.nokonium.plus.com%2Fbits%2Fff-dropdown.gif&hash=bff4bf15e17783802b5b0728114aaf5a59c977e0)
Title: Re: Fonts drop down selection & URL in post screen
Post by: TechnoDragon on June 13, 2006, 10:34:54 PM
SMF Theme - Dragon Wisdom (1.1 RC2)
Browser - Firefox
Font Drop-Down
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Ftechnodragon.net%2Fimages%2Ffontlist.gif&hash=867822c4a9d5fa51f15eb57fbfa8047ad528c691)

Font Size Drop-Down
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Ftechnodragon.net%2Fimages%2Ffontsize.gif&hash=1376101ac70d83918dd2fe3b4f857e1fb5d97316)
Title: Re: Fonts drop down selection & URL in post screen
Post by: Vinspire on June 14, 2006, 02:01:55 AM
Thanks noko & techno :)
Title: Re: Fonts drop down selection & URL in post screen
Post by: comatose on June 17, 2006, 03:07:53 AM
everything works fine, Thanks,
but only problem i see is that when you put your mouse over the IMG icon the Description of that icon does not pop up anymore?
Can this be fixed?
Title: Re: Fonts drop down selection & URL in post screen
Post by: TechnoDragon on June 19, 2006, 10:30:56 AM
Fixed that...may not be the best fix, but it works fine...edited my code post.
Title: Re: Fonts drop down selection & URL in post screen
Post by: comatose on June 19, 2006, 01:49:06 PM
Thanks a bunch...

Ok i see what you did, you took out the Array and just hard coded it.....now why didn't i think of that....Cause i'm still a bigginer trying to learn this stuff :-[

Thanks again, Nice work.
Title: Re: Fonts drop down selection & URL in post screen
Post by: TechnoDragon on June 19, 2006, 10:26:53 PM
LOL...thanks, anytime!
Title: Re: Fonts drop down selection & URL in post screen
Post by: tthmaz on July 25, 2006, 02:27:53 PM
Just what I had been looking for! Great post!
Title: Re: Fonts drop down selection & URL in post screen
Post by: TechnoDragon on July 25, 2006, 06:07:08 PM
Thank you...just edited the post though to show 15 of the 16 web standard font colors. (I left out white)
Title: Re: Fonts drop down selection & URL in post screen
Post by: tthmaz on July 26, 2006, 12:46:00 AM
Saw a small bug in the coding...

In the font size options:
<option value="10pt" style="font-size:8px">8pt</option>

which i think should be:
<option value="10pt" style="font-size:8px">10pt</option>

or:
<option value="10pt" style="font-size:8px">8px</option>
Title: Re: Fonts drop down selection & URL in post screen
Post by: TechnoDragon on July 26, 2006, 12:48:47 AM
No, the reason behind that is px is different than pt...pt wouldn't work for the style segment, so i had to use px.  Once i did that the pt size came out like it should in the post
Title: Re: Fonts drop down selection & URL in post screen
Post by: underdog on September 07, 2006, 12:04:22 PM
ok it's along time ago that tis is post but i downloaded this mod and installed in RC3.
But i can't find it! Where do i found the configuration of this mod? :(
Title: Re: Fonts drop down selection & URL in post screen
Post by: TechnoDragon on September 08, 2006, 11:41:48 AM
there was no mod for this...it was simply a code edit to various files in smf
Title: Re: Fonts drop down selection & URL in post screen
Post by: snifftheglove on September 10, 2006, 03:37:18 PM
The following code works in RC3, however is their a way so that the link will open in the same window and not (as it currently does) in a new window. Makes things difficult if you are posting a link to another post and another window opens up, thus having 2 windows of the same site open.

Thanks

Quote from: TechnoDragon on June 09, 2006, 03:22:19 AM

for the pop-up tags (IMG and URL):
In your post.template.php file (usually in the default theme directory) find this code:
// Print a drop down list for all the colors we allow!

add this before:
    // Java script to handle IMG input boxes ...
    echo '<script language="JavaScript" type="text/javascript">
          <!--
          function imgINPT(){
          // Enter IMG .........................................
          var imgLINK = prompt("Please enter IMG address:","http://");
          if (imgLINK == null ){ //cancel pressed . . .
          }
          else if (imgLINK == "" || imgLINK == " "){ //ok pressed but with Notext . . .
                  alert("Sorry no text entered!");
          }
          else
          { //ok pressed with text so use IMG and Name!
                    surroundText(\'[img]\'+imgLINK+\'\', \'[/img]\', document.', $context['post_form'], '.', $context['post_box_name'], ');
          }
          }
          // -->
          </script>';
 
    // Java script to handle URL input boxes ...
    echo '<script language="JavaScript" type="text/javascript">
          <!--
          function urlINPT(){
          // Enter URL .........................................
          var urlLINK = prompt("Please enter URL address:","http://");
          if (urlLINK == null ){ //cancel pressed . . .
          }
          else if (urlLINK == "" || urlLINK == " "){ //ok pressed but with Notext . . .
                  alert("Sorry no text entered!");
          }
          else
          { //ok pressed and there is something :)
          // Enter Description ...................................
          var urlNAME = prompt("Please enter URL name:","");
          if (urlNAME == null ){ //cancel pressed . . .
          }
          else if (urlNAME == "" || urlNAME == " "){  //ok pressed but with notext so use URL only!
                    surroundText(\'[url]\'+urlLINK+\'\', \'[/url]\', document.', $context['post_form'], '.', $context['post_box_name'], ');
          }
          else //ok pressed with text so use URL and Name!
                    surroundText(\'[url=\'+urlLINK+\']\'+urlNAME+\'\', \'[/url]\', document.', $context['post_form'], '.', $context['post_box_name'], ');
          }
          }
          // -->
          </script>';


then find this code:
// Print the buttom row of buttons!
foreach ($context['bbc_tags'][1] as $image => $tag)
{
if (isset($tag['before']))
{
// Is this tag disabled?
if (!empty($context['disabled_tags'][$tag['code']]))
continue;

// If there's no after, we're just replacing the entire selection in the post box.
if (!isset($tag['after']))
echo '<a href="javascript:void(0);" onclick="replaceText(\'', $tag['before'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';
// On the other hand, if there is one we are surrounding the selection ;).
else
echo '<a href="javascript:void(0);" onclick="surroundText(\'', $tag['before'], '\', \'', $tag['after'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';

// Okay... we have the link. Now for the image and the closing </a>!
echo '<img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
// I guess it's a divider...
else
echo '<img src="', $settings['images_url'], '/bbc/divider.gif" alt="|" style="margin: 0 3px 0 3px;" />';
}

echo '
</td>
</tr>';
}


and replace it with this:
// Print the buttom row of buttons!
foreach ($context['bbc_tags'][1] as $image => $tag)
{
  if (isset($tag['before']))
{
// Is this tag disabled?
if (!empty($context['disabled_tags'][$tag['code']]))
continue;

// only replace the IMG tag! . . . . . . . . . . .
      if ($tag['code'] == 'img')
   {
global $tag;
echo '<a href="javascript:void(0);" onclick="imgINPT(); return false;"><img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="Insert Image" title="Insert Image" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
// only replace the URL tag! . . . . . . . . . . .
      elseif ($tag['code'] == 'url')
   {
global $tag;
echo '<a href="javascript:void(0);" onclick="urlINPT(); return false;"><img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
else{
// If there's no after, we're just replacing the entire selection in the post box.
if (!isset($tag['after']))
echo '<a href="javascript:void(0);" onclick="replaceText(\'', $tag['before'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';
// On the other hand, if there is one we are surrounding the selection ;).
else
echo '<a href="javascript:void(0);" onclick="surroundText(\'', $tag['before'], '\', \'', $tag['after'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';

// Okay... we have the link.  Now for the image and the closing </a>!
echo '<img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
}
// I guess it's a divider...
else
echo '<img src="', $settings['images_url'], '/bbc/divider.gif" alt="|" style="margin: 0 3px 0 3px;" />';
}

echo '
</td>
</tr>';
}


When this is done, any new posts that are made, when the IMG or URL BBC tag is selected will pop-up a box.  For the IMG tag it is simply to put the url of the image, for the URL tag it will first ask for the link, then the text you want to display (if any) for the link.

Title: Re: Fonts drop down selection & URL in post screen
Post by: TC Carl on September 10, 2006, 07:12:50 PM
I have performed the code changes for the font face, font size and font color for 1.1 RC2 and I also notice that only the font color "effect" works under IE6 - i.e. the colors show "colored" in the drop-down list, but the font face and font size all appear uniform (default).

Can someone explain, briefly, why this doesn't work in IE6, and if there's any point in pursuing it? I think 95% of the value in this mod lies in the drop-down lists, and the WYSIWYG "effect" is icing on the cake.

Cheers,

TC Carl
Title: Re: Fonts drop down selection & URL in post screen
Post by: snifftheglove on September 13, 2006, 03:48:53 AM
Hi All, having been answered in another thread about open links in same page, could some Javascript Wizard modify the code from this thread to add an additional bbc button and use the tag   (//http://), therefore the post screen will have 2 insert url buttons (one for one in new window //and%20another%20to%20open%20in%20same%20window%20[iurl])%20with%20the%20popup%20javascript%20window.This%20would%20be%20great.Thanks,%20if%20i%20need%20to%20post%20elsewhere%20for%20this%20request%20could%20someone%20point%20me%20to%20this%20right%20location%20as%20I%20have%20just%20tagged%20the%20request%20to%20the%20end%20of%20this%20relevant%20thread.[quote%20author=snifftheglove%20link=topic=17867.msg724399#msg724399%20date=1157917038]The%20following%20code%20works%20in%20RC3,%20however%20is%20their%20a%20way%20so%20that%20the%20link%20will%20open%20in%20the%20same%20window%20and%20not%20(as%20it%20currently%20does)%20in%20a%20new%20window.%20Makes%20things%20difficult%20if%20you%20are%20posting%20a%20link%20to%20another%20post%20and%20another%20window%20opens%20up,%20thus%20having%202%20windows%20of%20the%20same%20site%20open.Thanks[quote%20author=TechnoDragon%20link=topic=17867.msg604774#msg604774%20date=1149837739][b]for%20the%20pop-up%20tags%20(IMG%20and%20URL):[/b]In%20your%20post.template.php%20file%20(usually%20in%20the%20default%20theme%20directory)%20find%20this%20code:[code]//%20Print%20a%20drop%20down%20list%20for%20all%20the%20colors%20we%20allow![/code]add%20this%20before:[code] %20 %20//%20Java%20script%20to%20handle%20IMG%20input%20boxes%20... %20 %20echo%20'<script%20language="JavaScript"%20type="text/javascript"> %20 %20 %20 %20 %20<!-- %20 %20 %20 %20 %20function%20imgINPT(){ %20 %20 %20 %20 %20//%20Enter%20IMG%20......................................... %20 %20 %20 %20 %20var%20imgLINK%20=%20prompt("Please%20enter%20IMG%20address:","http://"); %20 %20 %20 %20 %20if%20(imgLINK%20==%20null%20){%20//cancel%20pressed%20.%20.%20. %20 %20 %20 %20 %20} %20 %20 %20 %20 %20else%20if%20(imgLINK%20==%20""%20||%20imgLINK%20==%20"%20"){%20//ok%20pressed%20but%20with%20Notext%20.%20.%20. %20 %20 %20 %20 %20 %20 %20 %20 %20alert("Sorry%20no%20text%20entered!"); %20 %20 %20 %20 %20} %20 %20 %20 %20 %20else %20 %20 %20 %20 %20{%20//ok%20pressed%20with%20text%20so%20use%20IMG%20and%20Name! %20 %20 %20 %20 %20 %20 %20 %20 %20 %20surroundText(\'[img]\'+imgLINK+\'\',%20\'[/img]\',%20document.',%20$context['post_form'],%20'.',%20$context['post_box_name'],%20'); %20 %20 %20 %20 %20} %20 %20 %20 %20 %20} %20 %20 %20 %20 %20//%20--> %20 %20 %20 %20 %20</script>'; %20 %20 %20//%20Java%20script%20to%20handle%20URL%20input%20boxes%20... %20 %20echo%20'<script%20language="JavaScript"%20type="text/javascript"> %20 %20 %20 %20 %20<!-- %20 %20 %20 %20 %20function%20urlINPT(){ %20 %20 %20 %20 %20//%20Enter%20URL%20......................................... %20 %20 %20 %20 %20var%20urlLINK%20=%20prompt("Please%20enter%20URL%20address:","http://"); %20 %20 %20 %20 %20if%20(urlLINK%20==%20null%20){%20//cancel%20pressed%20.%20.%20. %20 %20 %20 %20 %20} %20 %20 %20 %20 %20else%20if%20(urlLINK%20==%20""%20||%20urlLINK%20==%20"%20"){%20//ok%20pressed%20but%20with%20Notext%20.%20.%20. %20 %20 %20 %20 %20 %20 %20 %20 %20alert("Sorry%20no%20text%20entered!"); %20 %20 %20 %20 %20} %20 %20 %20 %20 %20else %20 %20 %20 %20 %20{%20//ok%20pressed%20and%20there%20is%20something%20:) %20 %20 %20 %20 %20//%20Enter%20Description%20................................... %20 %20 %20 %20 %20var%20urlNAME%20=%20prompt("Please%20enter%20URL%20name:",""); %20 %20 %20 %20 %20if%20(urlNAME%20==%20null%20){%20//cancel%20pressed%20.%20.%20. %20 %20 %20 %20 %20} %20 %20 %20 %20 %20else%20if%20(urlNAME%20==%20""%20||%20urlNAME%20==%20"%20"){ %20//ok%20pressed%20but%20with%20notext%20so%20use%20URL%20only! %20 %20 %20 %20 %20 %20 %20 %20 %20 %20surroundText(\'[url]\'+urlLINK+\'\',%20\'\', document.', $context['post_form'], '.', $context['post_box_name'], ');
             }
             else //ok pressed with text so use URL and Name!
                    surroundText(\'\'+urlNAME+\'\', \' (//%5C'+urlLINK+%5C')\', document.', $context['post_form'], '.', $context['post_box_name'], ');
             }
          }
          // -->
          </script>';   [/code]

then find this code:
// Print the buttom row of buttons!
foreach ($context['bbc_tags'][1] as $image => $tag)
{
if (isset($tag['before']))
{
// Is this tag disabled?
if (!empty($context['disabled_tags'][$tag['code']]))
continue;

// If there's no after, we're just replacing the entire selection in the post box.
if (!isset($tag['after']))
echo '<a href="javascript:void(0);" onclick="replaceText(\'', $tag['before'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';
// On the other hand, if there is one we are surrounding the selection ;).
else
echo '<a href="javascript:void(0);" onclick="surroundText(\'', $tag['before'], '\', \'', $tag['after'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';

// Okay... we have the link. Now for the image and the closing </a>!
echo '<img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
// I guess it's a divider...
else
echo '<img src="', $settings['images_url'], '/bbc/divider.gif" alt="|" style="margin: 0 3px 0 3px;" />';
}

echo '
</td>
</tr>';
}


and replace it with this:
// Print the buttom row of buttons!
foreach ($context['bbc_tags'][1] as $image => $tag)
{
  if (isset($tag['before']))
{
// Is this tag disabled?
if (!empty($context['disabled_tags'][$tag['code']]))
continue;

// only replace the IMG tag! . . . . . . . . . . .
      if ($tag['code'] == 'img')
   {
global $tag;
echo '<a href="javascript:void(0);" onclick="imgINPT(); return false;"><img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="Insert Image" title="Insert Image" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
// only replace the URL tag! . . . . . . . . . . .
      elseif ($tag['code'] == 'url')
   {
global $tag;
echo '<a href="javascript:void(0);" onclick="urlINPT(); return false;"><img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
else{
// If there's no after, we're just replacing the entire selection in the post box.
if (!isset($tag['after']))
echo '<a href="javascript:void(0);" onclick="replaceText(\'', $tag['before'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';
// On the other hand, if there is one we are surrounding the selection ;).
else
echo '<a href="javascript:void(0);" onclick="surroundText(\'', $tag['before'], '\', \'', $tag['after'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';

// Okay... we have the link.  Now for the image and the closing </a>!
echo '<img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
}
// I guess it's a divider...
else
echo '<img src="', $settings['images_url'], '/bbc/divider.gif" alt="|" style="margin: 0 3px 0 3px;" />';
}

echo '
</td>
</tr>';
}


When this is done, any new posts that are made, when the IMG or URL BBC tag is selected will pop-up a box.  For the IMG tag it is simply to put the url of the image, for the URL tag it will first ask for the link, then the text you want to display (if any) for the link.

[/quote]
[/quote]
Title: Re: Fonts drop down selection & URL in post screen
Post by: Vinspire on September 17, 2006, 11:40:40 AM
Is it just me or this font colour is not working ?

is not working
Title: Re: Fonts drop down selection & URL in post screen
Post by: unrelenting on September 25, 2006, 10:29:45 PM
Quote from: Vinspire on September 17, 2006, 11:40:40 AM
Is it just me or this font colour is not working ?

is not working

I can't get it to work either. It's been driving me nuts trying to fix it to no avail.

SMF 1.1 RC2
Title: Re: Fonts drop down selection & URL in post screen
Post by: apristel on September 28, 2006, 09:01:56 AM
If I email or upload my Post.template.php file to someone, could you please make it so I have the drop down boxes and the input box for the hyperlink.. I'm not sure if this will make it pop up a box asking for the URL for the hyperlink..that is what  I want. That and the text size and whatever else. I guess anything  is better than without.

Thanks much

Here's my Post.template.php hosted on rapidshare.
http://rapidshare.de/files/34746006/Post.template.php.htmlplate.php.html
This is the  one from the themes/default  folder of my forum. Is this the correct one?
Title: Re: Fonts drop down selection & URL in post screen
Post by: TechnoDragon on September 28, 2006, 11:09:50 AM
as long as the post.template.php in your default is used by all of your other themes...then it will be the right one.

Here is the modified one...make sure to back up your old one just in case!

This makes the IMG, URL, FTP, and EMAIL tags pop-up when they are clicked...also adds the drop-down list for color, font, and size.

EDIT: oops, can't attach anything to these posts...I'll leave the zip file for you to download on my server for a few days to give you a chance to download it!
Post.Template.php (http://technodragon.net/files/Post.template.zip)
Title: Re: Fonts drop down selection & URL in post screen
Post by: tones_ie on October 04, 2006, 03:39:06 PM
Hi TechnoDragon...thanks for taking the time to edit and upload the post file.....However, would u know y i get the following error after replacing the default one with ures...

running SMF RC3...juno RC3

Template Parse Error!
There was a problem loading the Themes/default/Post.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly.

You may want to try to refresh this page or use the default theme.
syntax error, unexpected T_ELSE


thanks in advance
Title: Re: Fonts drop down selection & URL in post screen
Post by: TechnoDragon on October 05, 2006, 10:43:19 AM
usually that is a sign the the file was corrupted during upload...try uploading again and if it still does not work, then I will try and see what may have been coded wrong.
Title: Re: Fonts drop down selection & URL in post screen
Post by: tones_ie on October 05, 2006, 07:12:15 PM
Hay bud....thanks fo rthe reply....tried again and still the samme error....tried upload the file as is...and also editing the orig via ftp...both gave me the above error.... :(
Title: Re: Fonts drop down selection & URL in post screen
Post by: TechnoDragon on October 06, 2006, 12:07:25 AM
Ok, think i figured it out...try downloading again as I corrected what I believe is the issue and let me know
Title: Re: Fonts drop down selection & URL in post screen
Post by: tones_ie on October 06, 2006, 12:16:42 AM
Hay there :)

tried again...same error... :(    appreciate ya trying....
Title: Re: Fonts drop down selection & URL in post screen
Post by: TechnoDragon on October 06, 2006, 12:55:14 AM
Ok, now try...LOL...we'll get this figured out sooner or later!
Title: Re: Fonts drop down selection & URL in post screen
Post by: tones_ie on October 06, 2006, 04:50:56 AM
U da man !!  :)


Thank u sooo much for taking the time to fix this for RC3 :)  WORKS :)

promise...last request...

i attached an image of what i see....

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Ftriciaonline.com%2Ficon.jpg&hash=d6010767054a0b8dc58f88ae27a74bd497a0425b)

2 questions,

How do i get the "boxes" the same sixe...(change color / font size)
how do i get those boxes  (drop down menus) to be under all the other buttons...


thanks again  :)
Title: Re: Fonts drop down selection & URL in post screen
Post by: TechnoDragon on October 06, 2006, 09:20:34 AM
it is a unction of what is in there (the text) if you make the fonts and sizes generic (not disply the font face or size) then they would be the same height but not length.

As far as moving them, you would have to rearrange the code for the boxes to move them
Title: Re: Fonts drop down selection & URL in post screen
Post by: Gobo on October 06, 2006, 11:24:02 AM
all the colors u specified dont work

plus some of them are given wrong in FF like Red shows Block and Green shows Orange etc etc
Title: Re: Fonts drop down selection & URL in post screen
Post by: TechnoDragon on October 06, 2006, 10:21:46 PM
LOL...I forgot that I had changed some of the text in the language files...that is the reason the colors dont match up!
In post.english.php find:
$txt['change_color'] = 'Change Color';
$txt[262] = 'Black';
$txt[263] = 'Red';
$txt[264] = 'Yellow';
$txt[265] = 'Pink';
$txt[266] = 'Green';
$txt[267] = 'Orange';
$txt[268] = 'Purple';
$txt[269] = 'Blue';
$txt[270] = 'Beige';
$txt[271] = 'Brown';
$txt[272] = 'Teal';
$txt[273] = 'Navy';
$txt[274] = 'Maroon';
$txt[275] = 'Lime Green';

and replace with this:
$txt['change_color'] = 'Change Color';
$txt[262] = 'Black';
$txt[12345] = 'Aqua';
$txt[263] = 'Silver';
$txt[264] = 'Gray';
$txt[265] = 'Teal';
$txt[266] = 'Maroon';
$txt[267] = 'Red';
$txt[268] = 'Purple';
$txt[269] = 'Fuchsia';
$txt[270] = 'Green';
$txt[271] = 'Lime';
$txt[272] = 'Olive';
$txt[273] = 'Yellow';
$txt[274] = 'Navy';
$txt[275] = 'Blue';
Title: Re: Fonts drop down selection & URL in post screen
Post by: Gobo on October 06, 2006, 10:49:35 PM
Quote
LOL...I forgot that I had changed some of the text in the language files...that is the reason the colors dont match up!

sounds more like hanky panky to me loool

just kiddin - thanks
Title: Re: Fonts drop down selection & URL in post screen
Post by: TechnoDragon on October 06, 2006, 11:01:31 PM
ROFL

You're very welcome...I forget sometimes that I edit files to fit my needs and then don't write it down...part of the reason I have been unable to upgrade to RC3 yet
Title: Re: Fonts drop down selection & URL in post screen
Post by: tones_ie on October 07, 2006, 12:00:49 AM
Thanks fo rthe fix....
Title: Re: Fonts drop down selection & URL in post screen
Post by: TechnoDragon on October 07, 2006, 12:15:26 AM
always a pleasure!
Title: Re: Fonts drop down selection & URL in post screen
Post by: comatose on April 21, 2007, 09:33:08 AM
Quote from: TechnoDragon on September 28, 2006, 11:09:50 AM
as long as the post.template.php in your default is used by all of your other themes...then it will be the right one.

Here is the modified one...make sure to back up your old one just in case!

This makes the IMG, URL, FTP, and EMAIL tags pop-up when they are clicked...also adds the drop-down list for color, font, and size.

EDIT: oops, can't attach anything to these posts...I'll leave the zip file for you to download on my server for a few days to give you a chance to download it!
Post.Template.php (http://technodragon.net/files/Post.template.zip)

Is your Post.template.php file still good to use for version 1.1.2  ?
Title: Re: Fonts drop down selection & URL in post screen
Post by: ekfaysal on July 09, 2007, 02:31:03 PM
HI
my theme doesnt use post.index.php
im using smf 1..13
can u please tell me how to and where to do it?
thanks
Title: Re: Fonts drop down selection & URL in post screen
Post by: tones_ie on July 09, 2007, 02:42:07 PM
Quote from: ekfaysal on July 09, 2007, 02:31:03 PM
HI
my theme doesnt use post.index.php
im using smf 1..13
can u please tell me how to and where to do it?
thanks

Hi...   watever file URE custom theme dose not have it goes and uses the one that is in the themes\default folder.....  so in essance it sues "some" files from URE custom folder and others (ones it dosent have) from the default folder....  make sense ?
Title: Re: Fonts drop down selection & URL in post screen
Post by: ekfaysal on July 09, 2007, 04:29:58 PM
yea
thanks
Title: Re: Fonts drop down selection & URL in post screen
Post by: krystal on July 12, 2007, 05:06:53 AM
Hi!

I've just recently upgraded my forum to 1.1.3 (default theme) and have a similar request. :)

I want to keep the current url button on the post form but also want to add a new one with the javascript pop-up function right beside it.

I worked out how to add an image for the extra button (which I've called [url2]) by adding this line of code to the array under the regular url button and uploading a new image:

'url2' => array('code' => 'url2', 'before' => '[url]', 'after' => '[/url]',  'description' => $txt[2571]),

But I can't work out exactly where to place the relevant code which is needed to turn this into a javascript button. :(

I also think it needs to be slightly different to the code given by TechnoDragon because I'm not replacing the original url button in this instance, just adding an extra one.

I'm quite happy to leave all the other BB buttons as they are, so it's only the url code that I would like to alter.

Any help would be greatly appreciated as I've been messing about with this for days and getting nowhere. :-[
Title: Re: Fonts drop down selection & URL in post screen
Post by: eminent on July 12, 2007, 09:20:51 PM
how about if i want a font size drop down on the left hand corder of the site, for people to change the font size of the forum..  IE is making the fonts look huge! while the font by default looks great in Firefox, this can allow IE to have a normal view they desire..  anyone know how to do this?
Title: Re: Fonts drop down selection & URL in post screen
Post by: Harro on July 28, 2007, 12:25:16 PM
IE shouldn't make fonts look huge when they are looking fine in Firefox....
What theme are you using?

On a side note, I believe that there are a few themes that have a feature to increase the font size of the entire site.
Title: Re: Fonts drop down selection & URL in post screen
Post by: aglioeolio on August 11, 2007, 08:15:27 PM
Nice tips

IMG and URL tags are more BBC-newbie-user friendly now :D
Title: Re: Fonts drop down selection & URL in post screen
Post by: Chopper on October 17, 2007, 08:51:36 AM
Quote from: A.M.A on October 10, 2004, 08:53:28 AM
1- Font Size & Name drop down list
open Post.template.php and look for:
<option value="LimeGreen">', $txt[275], '</option>
</select>';
echo '<br />';

Delete the last line, and Add belew it:

  // Begin Print a drop down list for font face . . . . . . .
    echo ' <select onchange="surroundText(\'[font=\'+this.options[this.selectedIndex].value+\']\', \'[/font]\', document.', $context['post_form'], '.', $context['post_box_name'], '); this.selectedIndex = 0;" style="margin-bottom: 1ex;">
            <option value="" selected="selected">Font Face</option>
            <option value="Arial">Arial</option>
            <option value="Times New Roman">Times New Roman</option>
            <option value="Tahoma">Tahoma</option>
            <option value="Verdana">Verdana</option>
            </select>';
  // End Print a drop down list for font face . . . . . . . .

  // Begin Print a drop down list for font size . . . . . . .
    echo ' <select onchange="surroundText(\'[size=\'+this.options[this.selectedIndex].value+\']\', \'[/size]\', document.', $context['post_form'], '.', $context['post_box_name'], '); this.selectedIndex = 0;" style="margin-bottom: 1ex;">
            <option value="" selected="selected">Font Size</option>
            <option value="10pt">10pt</option>
            <option value="14pt">14pt</option>
            <option value="18pt">18pt</option>
            </select>';
    echo '<br />';
  // End Print a drop down list for font size . . . . . . . .


Note:
* you can modify the red text: <option value="10pt">10pt</option> to your own needs.
* to remove the default tag buttons, look for and delete:
array(),
'size' => array('code' => 'size', 'before' => '[size=10pt]', 'after' => '[/size]', 'description' => $txt[532]),
'face' => array('code' => 'font', 'before' => '[font=Verdana]', 'after' => '[/font]', 'description' => $txt[533]),



2- URL input boxes
look for:
// Print a drop down list for all the colors we allow!
add above:
    // Java script to handle URL input boxes ...
    echo '<script language="JavaScript" type="text/javascript">
          <!--
          function urlINPT(){
          // Enter URL .........................................
          var urlLINK = prompt("Please enter URL address:","http://");
          if (urlLINK == null ){ //cancel pressed . . .
          }
          else if (urlLINK == "" || urlLINK == " "){ //ok pressed but with Notext . . .
                  alert("Sorry no text entered!");
          }
          else
          { //ok pressed and there is something :)
          // Enter Description ...................................
          var urlNAME = prompt("Please enter URL name:","");
          if (urlNAME == null ){ //cancel pressed . . .
          }
          else if (urlNAME == "" || urlNAME == " "){  //ok pressed but with notext so use URL only!
                    surroundText(\'[url]\'+urlLINK+\'\', \'[/url]\', document.', $context['post_form'], '.', $context['post_box_name'], ');
          }
          else //ok pressed with text so use URL and Name!
                    surroundText(\'[url=\'+urlLINK+\']\'+urlNAME+\'\', \'[/url]\', document.', $context['post_form'], '.', $context['post_box_name'], ');
          }
          }
          // -->
          </script>';

look for:
// Print the buttom row of buttons!
foreach ($context['bbc_tags'][1] as $image => $tag)
{

add after:
      // only replace the URL tag! . . . . . . . . . . .
      if ($tag['code'] == 'url')
          echo '<a href="javascript:void(0);" onclick="urlINPT(); return false;"><img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
      else


Hi,

I have been through the Post.php and i cant find the line your referring to? Does anyone know what line it is?
Title: Re: Fonts drop down selection & URL in post screen
Post by: metallica48423 on November 14, 2007, 03:00:22 AM
Is this issue solved or do you still require assistance?

I think this was put in 2.0 by default, IIRC -- it is here and on my board without modification :)
Title: Re: Fonts drop down selection & URL in post screen
Post by: Hoochie Coochie Man on March 04, 2008, 04:09:14 AM
Thank you A.M.A, it works great!
Title: Re: Fonts drop down selection & URL in post screen
Post by: 58tbird on March 29, 2008, 07:03:02 PM
Quote from: TechnoDragon on June 09, 2006, 03:22:19 AM
OK, i have edited this code to work perfectly with RC2 and here it is all together in one nice, neat little post:

NOTE: all of this editing is done in the post.template.php file

To make the names of the colors appear in that color:
Find:
<option value="" selected="selected">', $txt['change_color'], '</option>
<option value="Black">', $txt[262], '</option>
<option value="Red">', $txt[263], '</option>
<option value="Yellow">', $txt[264], '</option>
<option value="Pink">', $txt[265], '</option>
<option value="Green">', $txt[266], '</option>
<option value="Orange">', $txt[267], '</option>
<option value="Purple">', $txt[268], '</option>
<option value="Blue">', $txt[269], '</option>
<option value="Beige">', $txt[270], '</option>
<option value="Brown">', $txt[271], '</option>
<option value="Teal">', $txt[272], '</option>
<option value="Navy">', $txt[273], '</option>
<option value="Maroon">', $txt[274], '</option>
<option value="LimeGreen">', $txt[275], '</option>


Replace:
<option value="" selected="selected">', $txt['change_color'], '</option>
<option value="Black" style="color:black">', $txt[262], '</option>
<option value="Silver" style="color:silver">', $txt[263], '</option>
<option value="Gray" style="color:gray">', $txt[264], '</option>
<option value="Maroon" style="color:maroon">', $txt[266], '</option>
<option value="Red" style="color:red">', $txt[267], '</option>
<option value="Purple" style="color:purple">', $txt[268], '</option>
<option value="Fuchsia" style="color:fuchsia">', $txt[269], '</option>
<option value="Green" style="color:green">', $txt[270], '</option>
<option value="Lime" style="color:lime">', $txt[271], '</option>
<option value="Olive" style="color:olive">', $txt[272], '</option>
<option value="Yellow" style="color:yellow">', $txt[273], '</option>
<option value="Navy" style="color:navy">', $txt[274], '</option>
<option value="Blue" style="color:blue">', $txt[275], '</option>
<option value="Teal" style="color:teal">', $txt[265], '</option>


for the pop-up tags (IMG and URL):
In your post.template.php file (usually in the default theme directory) find this code:
// Print a drop down list for all the colors we allow!

add this before:
    // Java script to handle IMG input boxes ...
    echo '<script language="JavaScript" type="text/javascript">
          <!--
          function imgINPT(){
          // Enter IMG .........................................
          var imgLINK = prompt("Please enter IMG address:","http://");
          if (imgLINK == null ){ //cancel pressed . . .
          }
          else if (imgLINK == "" || imgLINK == " "){ //ok pressed but with Notext . . .
                  alert("Sorry no text entered!");
          }
          else
          { //ok pressed with text so use IMG and Name!
                    surroundText(\'[img]\'+imgLINK+\'\', \'[/img]\', document.', $context['post_form'], '.', $context['post_box_name'], ');
          }
          }
          // -->
          </script>';
 
    // Java script to handle URL input boxes ...
    echo '<script language="JavaScript" type="text/javascript">
          <!--
          function urlINPT(){
          // Enter URL .........................................
          var urlLINK = prompt("Please enter URL address:","http://");
          if (urlLINK == null ){ //cancel pressed . . .
          }
          else if (urlLINK == "" || urlLINK == " "){ //ok pressed but with Notext . . .
                  alert("Sorry no text entered!");
          }
          else
          { //ok pressed and there is something :)
          // Enter Description ...................................
          var urlNAME = prompt("Please enter URL name:","");
          if (urlNAME == null ){ //cancel pressed . . .
          }
          else if (urlNAME == "" || urlNAME == " "){  //ok pressed but with notext so use URL only!
                    surroundText(\'[url]\'+urlLINK+\'\', \'[/url]\', document.', $context['post_form'], '.', $context['post_box_name'], ');
          }
          else //ok pressed with text so use URL and Name!
                    surroundText(\'[url=\'+urlLINK+\']\'+urlNAME+\'\', \'[/url]\', document.', $context['post_form'], '.', $context['post_box_name'], ');
          }
          }
          // -->
          </script>';


then find this code:
// Print the buttom row of buttons!
foreach ($context['bbc_tags'][1] as $image => $tag)
{
if (isset($tag['before']))
{
// Is this tag disabled?
if (!empty($context['disabled_tags'][$tag['code']]))
continue;

// If there's no after, we're just replacing the entire selection in the post box.
if (!isset($tag['after']))
echo '<a href="javascript:void(0);" onclick="replaceText(\'', $tag['before'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';
// On the other hand, if there is one we are surrounding the selection ;).
else
echo '<a href="javascript:void(0);" onclick="surroundText(\'', $tag['before'], '\', \'', $tag['after'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';

// Okay... we have the link. Now for the image and the closing </a>!
echo '<img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
// I guess it's a divider...
else
echo '<img src="', $settings['images_url'], '/bbc/divider.gif" alt="|" style="margin: 0 3px 0 3px;" />';
}

echo '
</td>
</tr>';
}


and replace it with this:
// Print the buttom row of buttons!
foreach ($context['bbc_tags'][1] as $image => $tag)
{
  if (isset($tag['before']))
{
// Is this tag disabled?
if (!empty($context['disabled_tags'][$tag['code']]))
continue;

// only replace the IMG tag! . . . . . . . . . . .
      if ($tag['code'] == 'img')
   {
global $tag;
echo '<a href="javascript:void(0);" onclick="imgINPT(); return false;"><img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="Insert Image" title="Insert Image" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
// only replace the URL tag! . . . . . . . . . . .
      elseif ($tag['code'] == 'url')
   {
global $tag;
echo '<a href="javascript:void(0);" onclick="urlINPT(); return false;"><img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
else{
// If there's no after, we're just replacing the entire selection in the post box.
if (!isset($tag['after']))
echo '<a href="javascript:void(0);" onclick="replaceText(\'', $tag['before'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';
// On the other hand, if there is one we are surrounding the selection ;).
else
echo '<a href="javascript:void(0);" onclick="surroundText(\'', $tag['before'], '\', \'', $tag['after'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';

// Okay... we have the link.  Now for the image and the closing </a>!
echo '<img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
}
// I guess it's a divider...
else
echo '<img src="', $settings['images_url'], '/bbc/divider.gif" alt="|" style="margin: 0 3px 0 3px;" />';
}

echo '
</td>
</tr>';
}


When this is done, any new posts that are made, when the IMG or URL BBC tag is selected will pop-up a box.  For the IMG tag it is simply to put the url of the image, for the URL tag it will first ask for the link, then the text you want to display (if any) for the link.

Now for the font styles and sizes:
once again in the post.template.php file (again, in your default theme directory) find this code:
<option value="LimeGreen">', $txt[275], '</option>
</select>';
echo '<br />';


and this code after it:
  // Begin Print a drop down list for font face . . . . . . .
    echo ' <select onchange="surroundText(\'[font=\'+this.options[this.selectedIndex].value+\']\', \'[/font]\', document.', $context['post_form'], '.', $context['post_box_name'], '); this.selectedIndex = 0;" style="margin-bottom: 1ex;">
            <option value="" selected="selected">Font Face</option>
            <option value="Arial" style="font-family:arial">Arial</option>
            <option value="Arial Black" style="font-family:arial black">Arial Black</option>
            <option value="Comic Sans MS" style="font-family:comic sans ms">Comic Sans MS</option>
            <option value="Courier New" style="font-family:courier new">Courier New</option>
            <option value="Georgia" style="font-family:georgia">Georgia</option>
            <option value="Times New Roman" style="font-family:times new roman">Times New Roman</option>
            <option value="Tahoma" style="font-family:tahoma">Tahoma</option>
            <option value="Verdana" style="font-family:verdana">Verdana</option>
    <option value="Trebuchet MS" style="font-family:trebuchet ms">Trebuchet MS</option>
    <option value="Impact" style="font-family:impact">Impact</option>
            </select>';
  // End Print a drop down list for font face . . . . . . . .

  // Begin Print a drop down list for font size . . . . . . .
    echo ' <select onchange="surroundText(\'[size=\'+this.options[this.selectedIndex].value+\']\', \'[/size]\', document.', $context['post_form'], '.', $context['post_box_name'], '); this.selectedIndex = 0;" style="margin-bottom: 1ex;">
            <option value="" selected="selected">Font Size</option>
            <option value="10pt" style="font-size:8px">8pt</option>
            <option value="12pt" style="font-size:10px">10pt</option>
            <option value="14pt" style="font-size:12px">12pt</option>
            <option value="16pt" style="font-size:14px">14pt</option>
            <option value="20pt" style="font-size:18px">18pt</option>
            </select>';
    echo '<br />';
  // End Print a drop down list for font size . . . . . . . .


then do a search for this:
array(),
'size' => array('code' => 'size', 'before' => '[size=10pt]', 'after' => '[/size]', 'description' => $txt[532]),
'face' => array('code' => 'font', 'before' => '[font=Verdana]', 'after' => '[/font]', 'description' => $txt[533]),


and remove it.

Now instead of posters trying to guess what fonts are available or the size they want, they can just select it.

EDIT: Changed the code to actually show the font style as well as the name, color shows name as well as color, and font size is name as well as size.

EDIT2: Fixed the image BBC button not have the hover to tell what it is.

This looks great!  I don't know what RC2 is (I assume it's a theme).  Will this code work for 1.1.4 default core theme?

Also, is there a way to add code for bulleted (or ordered) lists?
Title: Re: Fonts drop down selection & URL in post screen
Post by: SleePy on April 13, 2008, 12:11:11 AM
RC2 was a release candidate for SMF 1.1 (you most likely will see RC2 used again for SMF 2.0)

There was not to many changes between RC2 and 1.1.4 on the theme side of things. You should be fine to use the same code.
Title: Re: Fonts drop down selection & URL in post screen
Post by: auditorbob on April 17, 2008, 04:51:43 PM
Thanks SleePy :)
Title: Re: Fonts drop down selection & URL in post screen
Post by: Sarge on July 05, 2008, 06:06:54 AM
Let us know how it works for you. :)
Title: Re: Fonts drop down selection & URL in post screen
Post by: I AM Legend on August 16, 2008, 05:21:37 AM
Hi All,
I saw some people saying that only some of the safe colors work, I use this web site, it has all the safe colors and variations on the safe colors and all work fine that I have used, hope it helps:

http://www.echoecho.com/htmlhexcolors07.htm

Thanks All
Title: Fonts size Font & Tab_Indent drop down selection & URL in post screen code
Post by: Indonesian on December 12, 2008, 11:52:59 PM

Just in case anyone is interested!
Fonts size Font & Tab_Indent drop down selection & URL in post screen code SMF 1.1.7

I still look for a mode so my BBC code is Highlighted in a different color or bold but could not find anything!



(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi467.photobucket.com%2Falbums%2Frr40%2F413200%2F11%2Ftabfont.jpg&hash=59e7479c845c9923d2b6a2ed9b50098ced4d8567) (http://indonesian.10001mb.com/smfforum/index.php/topic,170.msg228.html#msg228)
http://indonesian.10001mb.com/smfforum/index.php/topic,170.msg228.html#msg228 (http://indonesian.10001mb.com/smfforum/index.php/topic,170.msg228.html#msg228)

Find in = Post.template.php
Quote
Quote<option value="LimeGreen">', $txt[275], '</option>
</select>';
echo '<br />';

Add After
Quote// Print a drop down list for font size!
echo ' <select onchange="surroundText(\'[size=\'+this.options[this.selectedIndex].value+\']\', \'[/size]\', document.', $context['post_form'], '.', $context['post_box_name'], '); this.selectedIndex = 0;" style="margin-bottom: 1ex;">
<option value="" selected="selected">Font Size</option>
<option value="7pt">7pt</option>
<option value="8pt">8pt</option>
<option value="9pt">9pt</option>
<option value="11pt">11pt</option>
<option value="12pt">12pt</option>
<option value="13pt">13pt</option>
<option value="14pt">14pt</option>
<option value="15pt">15pt</option>
<option value="16pt">16pt</option>
<option value="18pt">18pt</option>
<option value="19pt">19pt</option>
<option value="20pt">20pt</option>
<option value="21pt">21pt</option>
</select>';

// Print a drop down list for Tab_Indent!
echo ' <select onchange="surroundText(\'\'+this.options[this.selectedIndex].value+\'\', \'\', document.', $context['post_form'], '.', $context['post_box_name'], '); this.selectedIndex = 0;" style="margin-bottom: 1ex;">
<option value="" selected="selected">Indent</option>
<option value=" ">1Tab</option>
<option value=" ">2Tab</option>
<option value=" ">3Tab</option>
<option value=" ">4Tab</option>
<option value=" ">5Tab</option>
<option value=" ">6Tab</option>
<option value=" ">7Tab</option>
<option value=" ">8Tab</option>
<option value=" ">9Tab</option>
<option value=" ">10Tab</option>
</select>';

// Begin Print a drop down list for font face . . . . . . .
echo ' <select onchange="surroundText(\'[font=\'+this.options[this.selectedIndex].value+\']\', \'[/font]\', document.', $context['post_form'], '.', $context['post_box_name'], '); this.selectedIndex = 0;" style="margin-bottom: 1ex;">
<option value="" selected="selected">Font Face</option>
<option value="Arial" style="font-family:arial">Arial</option>
<option value="Arial Black" style="font-family:arial black">Arial Black</option>
<option value="Comic Sans MS" style="font-family:comic sans ms">Comic Sans MS</option>
<option value="Courier New" style="font-family:courier new">Courier New</option>
<option value="Georgia" style="font-family:georgia">Georgia</option>
<option value="Times New Roman" style="font-family:times new roman">Times New Roman</option>
<option value="Tahoma" style="font-family:tahoma">Tahoma</option>
<option value="Verdana" style="font-family:verdana">Verdana</option>
<option value="Trebuchet MS" style="font-family:trebuchet ms">Trebuchet MS</option>
<option value="Impact" style="font-family:impact">Impact</option>
</select>';

// End Print a drop down list for font face . . . . . . . .


  • For single Tab&nbsp; Using multi space usally gets saved in HTML CODE&nbsp; .... &nbsp; &nbsp;&nbsp; &nbsp; ...no problem with multi Tab!
    Find

Quote
'list' => array('code' => 'list', 'before' => '[list]\n[list][li]', 'after' => '[/li][/list]\n[list][li][/li][/list]\n[/list]', 'description' => $txt[261]),



  • Add After
Quote array(),
'tab' => array('code' => 'tab', 'before' => ' ', 'after' => '', 'description' => $txt['Tab_Indent']),


Find in = /default/languages/Modifications.english.php
Quote ?>


  • Add before
Quote $txt['Tab_Indent'] = 'Tab_Indent';

Quote array(),
'size' => array('code' => 'size', 'before' => '[size=10pt]', 'after' => '[/size]', 'description' => $txt[532]),
'face' => array('code' => 'font', 'before' => '[font=Verdana]', 'after' => '[/font]', 'description' => $txt


Find in = Post.template.php
Quote// Print a drop down list for all the colors we allow!

Add above:

Quote // Java script to handle URL input boxes ...
echo '<script language="JavaScript" type="text/javascript">
<!--
function urlINPT(){
// Enter URL .........................................
var urlLINK = prompt("Please enter URL address:","http://");
if (urlLINK == null ){ //cancel pressed . . .
}
else if (urlLINK == "" || urlLINK == " "){ //ok pressed but with Notext . . .
alert("Sorry no text entered!");
}
else
{ //ok pressed and there is something :)
// Enter Description ...................................
var urlNAME = prompt("Please enter URL name:","");
if (urlNAME == null ){ //cancel pressed . . .
}
else if (urlNAME == "" || urlNAME == " "){&nbsp; //ok pressed but with notext so use URL only!
surroundText(\'[url=http://\'+urlLINK+\'\', \']\'+urlLINK+\'\', \'[/url]\', document.', $context['post_form'], '.', $context['post_box_name'], ');
}
else //ok pressed with text so use URL and Name!
surroundText(\'[url=http://\'+urlLINK+\']\'+urlNAME+\'\', \'[/url]\', document.', $context['post_form'], '.', $context['post_box_name'], ');
}
}
// -->
</script>';

Quote // Is this tag disabled?
if (!empty($context['disabled_tags'][$tag['code']]))
continue;
Quote// only replace the URL tag! . . . . . . . . . . .
if ($tag['code'] == 'url')
echo '<a href="javascript:void(0);" onclick="urlINPT(); return false;"><img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';

Title: Re: Fonts drop down selection & URL in post screen
Post by: recep34 on December 23, 2008, 11:21:40 PM
Url input boxes didnt work.the theme which i use doesnt have post.template.php file so edited the default themes...

İ had two icons but when i click the new one nothing happens..

http://armatr.cybernetic-hosting.co.uk/dosyalar/Post.template.rar
Title: Re: Fonts drop down selection & URL in post screen
Post by: STS on January 15, 2009, 11:39:50 PM
This is great. I just used the URL and IMAGE modifications, but really like the difference.

However, for some reason I'm getting three of the ||| images (/bbc/divider.gif) showing up between the mail image and the next one. I can't seem to be able to fix it.
Title: Re: Fonts drop down selection & URL in post screen
Post by: brandonroy on January 16, 2009, 07:27:16 AM
Quote from: STS on January 15, 2009, 11:39:50 PM
This is great. I just used the URL and IMAGE modifications, but really like the difference.

However, for some reason I'm getting three of the ||| images (/bbc/divider.gif) showing up between the mail image and the next one. I can't seem to be able to fix it.

I'm getting the same thing..

And if anyone knows how to make it so that you can type some text and highlight it, then click on the button to insert the hyperlink, and all it will ask for is the url - That would be super cool.
Title: Re: Fonts drop down selection & URL in post screen
Post by: STS on July 25, 2009, 07:03:10 PM
If anyone knows a fix for the funky ||| that would be great.  :-*
Title: Re: Fonts drop down selection & URL in post screen
Post by: Arantor on September 05, 2009, 06:23:27 PM
STS: Are you still having trouble with this?
Title: Re: Fonts drop down selection & URL in post screen
Post by: nunopitbull on September 08, 2009, 02:46:14 PM
Would like to know, in this mod: http://custom.simplemachines.org/mods/index.php?mod=938

How can i make the text i wanna enter (after i select the URl in popup box) to be highlighted. Like i click any letter in my keyboard and it edits. Dunno if im making myself clear :s
Title: Re: Fonts drop down selection & URL in post screen
Post by: Arantor on September 08, 2009, 02:50:52 PM
nunopitbull: please ask in the mod's specific support thread (http://www.simplemachines.org/community/index.php?topic=292331.0).
Title: Re: Fonts drop down selection & URL in post screen
Post by: steve51184 on March 13, 2010, 06:49:31 PM
any chance of that URL popup for 2.x?
Title: Re: Fonts drop down selection & URL in post screen
Post by: polowest on November 16, 2010, 09:01:58 PM
Hi,
thanks for mod.

But this not work with IE8.

Have you a solution?
Title: Re: Fonts drop down selection & URL in post screen
Post by: Luis- on March 03, 2012, 06:45:19 PM
So sorry for bumping this but I can't find any of the information that I need to look for in the Post.template.php. I really want to edit the drop-down menus. Can someone help me?
Title: Re: Fonts drop down selection & URL in post screen
Post by: Chalky on March 31, 2012, 12:27:40 PM
Quote from: Luis- on March 03, 2012, 06:45:19 PM
So sorry for bumping this but I can't find any of the information that I need to look for in the Post.template.php. I really want to edit the drop-down menus. Can someone help me?

I'd really like to use the URL part of this - please does anyone know how to adapt this trick for 2.0.2?
Title: Re: Fonts drop down selection & URL in post screen
Post by: Masterd on June 30, 2012, 08:06:31 AM
This trick is a default feature in SMF 2.0. For any addotional edits look inside Post.template.php and Subs-Post.php or I just misunderstanded everything? (Didn't sleep very well.)
Title: Re: Fonts drop down selection & URL in post screen
Post by: huangjinmei on August 14, 2012, 11:26:57 PM
Not by pushbutton?I think the best way is through the Automatic speech~ ;D ;)