Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: rexall9000 - toukokuu 10, 2014, 07:23:24 IP

Otsikko: Editor button w/link to popup or post?
Kirjoitti: rexall9000 - toukokuu 10, 2014, 07:23:24 IP
Sun 11 May 2014, 6:11 am

Good Morning ForumMates!

I don't work with code, but I have someone who can help if you can provide instructions.

I want to add a button to the editor (Advanced Editor in this case) with a link to a tooltip, or popup window, or failing that, an existing post or article on the forum.  I have no idea how difficult the first two might be, but I suspect the third option is quite easy.   I am running 2.0.7.

If anyone could provide the code and walk me through the steps, I would be grateful.

LainaaBTW, in case anyone is interested, I want this button to open instructions for how to post a video.   Being able to post a video by just pasting the video URL into the post body is fantastic, but I don't think many users know that; they are probably more familiar with other forums where you have to click a button and then add the video URL, similarly to they way you add images.   At first, I was thinking just to install such an "add video" button even though it would be redundant and unecessary, however  there has been a lot of discussion about that on this forum about that, and it seems quite difficult to do for some reason.

I appreciate your help, guys.  Thanks!
Otsikko: Re: Editor button w/link to popup or post?
Kirjoitti: margarett - toukokuu 10, 2014, 07:28:30 IP
It's actually simpler than that, if I'm seeing the problem correctly.
There are a few MODs that allow you to embed videos by just pasting it's link.
So it would be easier just to add a note in Post.template.php, with a fixed text like "Remember you can add a video just by pasting it's link"
Otsikko: Re: Editor button w/link to popup or post?
Kirjoitti: rexall9000 - toukokuu 10, 2014, 07:40:27 IP
Wow, Margarett!  What took you so long???   Hehehe . . . Seriously, thanks for the LIGHTNING-FAST reply!

Yes, we already have the mod for pasting the video URL directly into the post body, and it works great.  Now, we just need some way to inform users about it.

I think you answered my question, but could you explain to this novice the basics of "add a note in Post.template.php"

First of all, what is that going to do, where does it show up, and what does it look like?  I assume that you would define the look and formatting with standard html?

Thanks, a million!
Otsikko: Re: Editor button w/link to popup or post?
Kirjoitti: margarett - toukokuu 10, 2014, 07:46:44 IP
It should be really simple. I'm just not on the computer now (actually fighting the need my body feels about sleeping :P ) so the next reply should not happen this fast ;D

Tomorrow I'll do a quick test here and show you the result. If I forget it, scream ;D
Otsikko: Re: Editor button w/link to popup or post?
Kirjoitti: rexall9000 - toukokuu 17, 2014, 06:47:50 AP
Lainaus käyttäjältä: margarett - toukokuu 10, 2014, 07:46:44 IP
It should be really simple. I'm just not on the computer now (actually fighting the need my body feels about sleeping :P ) so the next reply should not happen this fast ;D

Tomorrow I'll do a quick test here and show you the result. If I forget it, scream ;D

Tomorrow and tomorrow and tomorrow . . . Scream!  (Please?)   :D
Otsikko: Re: Editor button w/link to popup or post?
Kirjoitti: margarett - toukokuu 19, 2014, 09:55:17 AP
Sorry, I forgot it :P

Would something like attached work for you?
Otsikko: Re: Editor button w/link to popup or post?
Kirjoitti: rexall9000 - toukokuu 19, 2014, 10:20:38 AP
Brilliant, Bruno!  That will definitely do!  Thanks, a million.   

Can you walk me through how to do it?

Is is easy to format the text with simple html, maybe add a little icon . . . or not?

Much appreciated!
Otsikko: Re: Editor button w/link to popup or post?
Kirjoitti: margarett - toukokuu 19, 2014, 10:25:50 AP
That's very simple, actually. Just edit Post.template.php and

Find:
// The post header... important stuff
Add before:
echo '
<p class="information" style="text-align:center;">
<strong>Remember that you can embed a video by just pasting its link!</strong>
</p>';

And that's it ;)

In order to edit the style, it would be necessary to probably create a CSS class and configure it as you wish. You can add any HTML in there, so to add an icon is just a matter of placing it there ;)