Ale nie! Kde je JavaScript?
Váš webový prehliadač nemá povolený JavaScript alebo nepodporuje JavaScript. Ak chcete správne zobraziť túto webovú lokalitu, povoľte JavaScript vo svojom webovom prehliadači, alebo inovujte na webový prehliadač, ktorý podporuje JavaScript.

Fórum

How to Add Buttons in textual editor PHP-Fusion v9

9 príspevkov
3853 zobrazení
Naposledy aktualizované pred 3 rokmi
Z
Člen 67
Odoslané pred 3 rokmi
#1
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.
Upravil/a zizub dňa 14/10/2017 00:07, pred 3 rokmi
Kvido
Člen 284
Odoslané pred 3 rokmi
#2
Thank! Zveřejníme tento návod jako článek v Technologie. Díky.
Kvido
Člen 284
Odoslané pred 3 rokmi
#3
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
Člen 67
Odoslané pred 3 rokmi
#4
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.
Upravil/a zizub dňa 16/10/2017 02:41, pred 3 rokmi
Kvido
Člen 284
Odoslané pred 3 rokmi
#5
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
Člen 284
Odoslané pred 3 rokmi
#6
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
Člen 67
Odoslané pred 3 rokmi
#7
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
Člen 284
Odoslané pred 3 rokmi
#8
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

[youtube]https://www.youtube.com/embed/HtZy5TtVcgM[/youtube]
Upravil/a Kvido dňa 16/10/2017 11:21, pred 3 rokmi
Kvido
Člen 284
Odoslané pred 3 rokmi
#9
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";
}