News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

[TIP/TRICK] Insert Descriptive Link BBCode Icon in Post Box for 1.1.11

Started by Rattler, May 03, 2010, 01:56:45 PM

Previous topic - Next topic

Rattler

Version 1.1.11, Default Theme, Screenshot attached

Problem: Users do rarely use the "descriptive link" approach but instead paste all crude urls when linking
Cause:: Normal users are too lazy to look up the BBCode for "descriptive link" via "Help" menu or find the use too complicated
Solution: Installing an "Insert Descriptive Link" Icon/Button in the BBCode Icon area of the Post Box with a simple code snippet
How it works: Clicking the "Insert Descriptive Link" icon the user finds his highlighted text surrounded by the descriptive link tags and just has to replace the words "someSite" with the target url.

Here what I did (based on the "Clickable Image Mod" by Chaos Dragon; http://custom.simplemachines.org/mods/index.php?mod=1253), if you find it worthwile, plese move to the tips and tricks section.

- Created an icon for insertion of descriptive link (see attached, feel free to use)

- At file end of ./Themes/default/languages/Modifications.english.php

Found:
?>

Added before:
$txt['descriptive link'] = 'Insert Descriptive Link';


- In ./Themes/default/Post.template.php

Found (in the BBCode icon array)

'clickableImage' => array('code' => 'url', 'before' => '[url=http://someSite][img]', 'after' => '[/img][/url]', 'description' => $txt['clickable image']),
'url' => array('code' => 'url', 'before' => '[url]', 'after' => '[/url]', 'description' => $txt[257]),
'email' => array('code' => 'email', 'before' => '[email]', 'after' => '[/email]', 'description' => $txt[258]),


and replaced with

'clickableImage' => array('code' => 'url', 'before' => '[url=http://someSite][img]', 'after' => '[/img][/url]', 'description' => $txt['clickable image']),
'url' => array('code' => 'url', 'before' => '[url]', 'after' => '[/url]', 'description' => $txt[257]),

'descriptiveLink' => array('code' => 'url', 'before' => '[url=http://someSite]yourText', 'after' => '[/url]', 'description' => $txt['descriptive link']),

'email' => array('code' => 'email', 'before' => '[email]', 'after' => '[/email]', 'description' => $txt[258]),


- Moved the attched icon to ./Themes/default/images/bbc/

If you run mods that have BBCode also added to the Quick Reply Box or the Signature Box in Profile (as we do), perform the same above mentioned modification as in ./Themes/default/Post.template.php also on the files

./Themes/default/Display.template.php (for Quick Reply Box)
./Themes/default/Profile.template.php (for Signature Box)

Hope you find this helpful, my users like it.

Rattler
You can discuss with people, and sometimes it even makes sense to do so. Forget that when confronted with the cruel facts of life... (inspired by SiGnature™).

gbsothere

I have cleaned up so many links just today, Rattler, where the poster didn't really know what he or she was doing and tried to place the entire link not only within the URL tag, but between them, as well, creating ugly scrollbars.  I'm very happy to have stumbled on this.  Perhaps they'll grasp this, since repeated explanations seem to do no good.

Thanks so much.   :)
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

divecall

Can somebody do this for SMF 2 RC 2 ???

And where i can download the Icon ??? yep, i was blind...

Thank you in advance

gbsothere

@ divecall:

I don't have an RC2 test site, but I have a 2.0 RC1.2.  I'm not sure how much things change from one to the other, but for RC1.2, I was able to get this to work by doing the following (and, although it works, I'm sure the coding is a bit crude and parts of it unnecessary, but it does work):

In Subs.php, find:


array(
'tag' => 'li',


Add before:


array(
'tag' => 'descriptivelink',
'type' => 'unparsed_equals',
'before' => '<a href="http://someSite]yourText">',
'after' => '</a>',
'validate' => create_function('&$tag, &$data, $disabled', '
if (substr($data, 0, 1) == \'#\')
$data = \'#post_\' . substr($data, 1);'),
'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
'disabled_after' => ' ($1)',
),



In Subs-Editor.php, find:


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


Add after:

'descriptiveLink' => array('code' => 'descriptivelink', 'before' => '[url=http://someSite]yourText', 'after' => '[/url]', 'description' => $txt['descriptive link']),



In Modifications.english.php, find:

?>

Add before:

$txt['descriptive link'] = 'Insert Descriptive Link';


Move the image descriptiveLink.gif to your theme's images/bbc folder.



Again, I'm not sure how different RC2 is, but this may point you in the right direction.

:)
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

divecall

Thank you, for the fast help.

But this is not the right code. To edit the "subs.php" was no problem, the trouble starts in the "Subs-Editor.php".

Looks like, that i need to define a "image" and a "code" and so on.

i will wait, maybe later somebody can help. i´m a newbie in HTML and PHP.

thank you - and all the best wishes for you and this nice little baby in your arms (in your avatar).

saludos
peter

gbsothere

Quote from: divecall on May 27, 2010, 05:34:15 PM
Thank you, for the fast help.

But this is not the right code. To edit the "subs.php" was no problem, the trouble starts in the "Subs-Editor.php".

Looks like, that i need to define a "image" and a "code" and so on.

i will wait, maybe later somebody can help. i´m a newbie in HTML and PHP.

thank you - and all the best wishes for you and this nice little baby in your arms (in your avatar).

saludos
peter


Thank you so much, Peter; that's my granddaughter.   :)

I'm so sorry that the Subs-Editor.php file is different, but perhaps someone else will wander by soon and will have the right code for that.
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

gbsothere

@divecall

You might trying finding in Subs-Editor.php


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



and adding after


array(
'image' => 'descriptivelink',
'code' => 'descriptivelink',
'before' => '[url=http://someSite]yourText',
'after' => '[/url]',
'description' => $txt['descriptive link']
),




After that, I'm out of ideas.   :D
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

divecall


gbsothere

Quote from: divecall on May 28, 2010, 06:01:17 AM
Thank you, but it is not working

greetings


That's disappointing; I'd really hoped it would but, not having a place to test it, I was groping.  It's time to upgrade all my test boards. 

:)
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Advertisement: