Customizing SMF > Tips and Tricks

Fonts drop down selection & URL in post screen

<< < (4/20) > >>

JohnnyVW:

--- 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.

--- End quote ---

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

Thanks!

nokonium:
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.

 

SleePy:
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

--- Quote ---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>';
--- End quote ---
To

--- Quote ---      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>';
      }
--- End quote ---

but i can't seem to get the other one to stop.

nokonium:
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')


--- Code: --- // 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>';
--- End code ---

That may need changing to work without errors.

SleePy:
i was able to fix it by moving the if statement around


--- 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;

// 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>';
}
--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version