PHP min. 5.6.8MySQL min. 5.1Apache min. 2.0
PHP-Fusion 9 Jádro
v9.0
Český překlad
Pravidelně aktualizovaný

How to Add Buttons in textual editor PHP-Fusion v9

Poslední aktualizace před 9 měsíci
Z
I want to share an example of creating an additional button, in a text editor, for inserting a video into news, a blog or an article. This topic has already been discussed at the German forum. There, dimki, showed an example code, for the version of PF 7.02.07, which you need to insert into the file /includes/html_buttons_include.php
 $res .= "<input type='button' value='YouTube' class='button' onclick=\"addText('".$textarea."', '<iframe width=\'100%\' height=\'240\' src=\'https://www.youtube.com/embed/', '\' frameborder=\'0\' allowfullscreen></iframe>', '".$formname."');\" />\n";

If you have Bootstrap enabled on your site pf-9. It in Admin Dashboard / Settings / Theme Settings -> it is enable: Enable Bootstrap. You can use, Responsive Video, Embed.
 $res .= "<input type='button' value='YouTube' class='btn btn-default btn-sm button m-b-10' onclick=\"addText('".$textarea."', '<div class=\'embed-responsive embed-responsive-16by9\'><iframe class=\'embed-responsive-item\' style=\'max-width: 100%;\' src=\'https://www.youtube.com/embed/XXXXX?rel=0&showinfo=0', '\' frameborder=\'0\' allowfullscreen></iframe></div>', '".$formname."');\" />\n";

After clicking the YouTube button, you need to replace XXXXXX, on, the id of the clip is - p7wTDIcWqzM.
You can change the parameters of the video yourself, as you need. For example, if you want to change Aspect Ratio in Video Embeds, change 16by9 to 4by3.
Based on this sample, you can create any button. For example, now in pf 9.xx you can not publish news, with an empty brief part (Snippet*). I do not know how to disable it, and for this, I created a button to insert a symbol, an indissoluble space, into Snippet*.
 $res .= "<button type='button' class='btn btn-default btn-sm button m-b-10' value=' ' onclick=\"insertText('".$textarea."', ' ', '".$formname."');\">NBSP</button>\n";

I'm inserting the code in the file /includes/html_buttons_include.php, on the line 157, below </ul> and higher </div>.
Perhaps it will be useful for someone.
Kvido
Thank! Zveřejníme tento návod jako článek v Technologie. Díky.
Kvido
Návod není zřejmě celý. Mně to nechodí.
Hm, nestačilo by třeba tohle:
<iframe width="500" height="340" src="http://www.youtube.com/embed/12aqm3nfphU"></iframe>
Z
The first upper code, for the version of pf-7. I checked, it also works on pf9. After clicking the button, you need to insert the identifier after the slash in the text editor (...embed/ ). I showed it for the sample, so that others could see the difference between the pf7 code and the pf9 code. If you compare two codes, then it becomes obvious that you need to change to create your own button for another video hosting, for example vimeo.
Here is another version of the simple code pf9, for videos from youtube:
 $res .= "<input type='button' value='YouTube2' class='btn btn-default btn-sm button m-b-10' onclick=\"addText('".$textarea."', '<iframe width=\'100%\' height=\'240\' src=\'https://www.youtube.com/embed/XXXXX?rel=0&showinfo=0', '\' frameborder=\'0\' allowfullscreen></iframe>', '".$formname."');\" />\n";

PS: I inserted your code iframe, into my editor, the player booted, everything is fine, but without video. Your video 12aqm3nfphU is not available on YouTube. Try another video, another identifier, such as this -> iKzRIweSBLA
Try again, for verification, copy the code from the forum, and paste it into the file html_buttons_include.php, do not change anything in it. Click the YouTube button and paste the video identifier.
When copying the code from the forum, disable Google translator, or another, it may distort the code. More I do not know what to advise.
Kvido
Thanks for the effort!
I tried the phpf7. It works, the video display will be displayed, but the video will not start.
I'm going to phpf9
Kvido
There is no Youtube2 button in phpf9. I added the code here:

style='font-size:11px; font-family: Georgia, \'Times New Roman\', Times, serif !important;'>Heading 5</span></a>\n</li>\n";
 $res .= "<li>\n<a value='H6' class='pointer' onclick=\"addText('".$textarea."', '&lt;h6&gt;', '&lt;/h6&gt;', '".$formname."');\"><span class='strong' style='font-size:9px; font-family: Georgia, \'Times New Roman\', Times, serif !important;'>Heading 6</span></a>\n</li>\n";
$res .= "<input type='button' value='YouTube' class='button' onclick=\"addText('".$textarea."', '&lt;iframe width=\'100%\' height=\'240\' src=\'https://www.youtube.com/embed/', '\' frameborder=\'0\' allowfullscreen&gt;&lt;/iframe&gt;', '".$formname."');\" />\n";
$res .= "<input type='button' value='YouTube2' class='btn btn-default btn-sm button m-b-10' onclick=\"addText('".$textarea."', '<iframe width=\'50%\' height=\'240\' src=\'https://www.youtube.com/embed/HtZy5TtVcgM?rel=0&showinfo=0', '\' frameborder=\'0\' allowfullscreen></iframe>', '".$formname."');\" />\n";

 $res .= "</ul>\n";
 $res .= "</div>\n";
Z
I do not know what might be the reason. On my test site, all the buttons appear well and work.
i89.fastpic.ru/big/2017/1016/82/84a0cc9b76a6fd8f996a016f5a951d82.jpg
Kvido
Thanks. Buduto still try. Although it is a rather impractical procedure.
It should work as in news commentaries where the "youtube" icon is. Click on the icon and

Kvido
We must not forget, I think, of the bbcode function.
In order for bbcode video (icon) to be in the editor menu, add the following:

// BB Codes For News Mod Kvido
if ((file_exists(INCLUDES."na_bbcodes_settings.php")) && $settings['tinymce_enabled'] !== 1) {
require_once INCLUDES."na_bbcodes_settings.php";
}
Vy můžete zobrazit všechny příspěvky v tomto fóru.
Vy nemůžete začít nový diskusní příspěvek v tomto fóru.
Vy nemůžete odpovědět v této diskusi.
Vy nemůžete začít v anketu v tomto fóru.
Vy nemůžete na tomto fóru nahrát přílohy.
Vy nemůžete stáhnout přílohy v tomto fóru.
Uživatelé, kteří se účastnili diskuse:Kvido, zizub
Nejnovější témata fóra
  Vlákno Zobrazení Odpovědi Poslední příspěvek
zvlastny bug [Vyřešeno]
v PHP-Fusion 9.0
252 34 jany
16-07-2018 10:29
úprava témy Fusion theme
v Administrace nastavení
116 9 RobiNN
13-07-2018 12:40
Vložené video
v Bugy a chyby
42 5 RobiNN
12-07-2018 20:14
akt. z 7.02.04 na 9xx [Vyře...
v PHP-Fusion 9.0.3
128 12 vlado254
10-07-2018 13:12
Registrácia zo zahraničia
v PHP-Fusion 9.0
53 2 RobiNN
07-07-2018 14:40
odosielanie mailov
v PHP-Fusion 9.0
73 3 RobiNN
05-07-2018 13:04