Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Adding a button to the html editor (textarea)

Asked Modified Viewed 1,275 times
Z
zizub
Z
zizub 10
  • Member, joined since
  • Contributed 156 posts on the community forums.
  • Started 29 threads in the forums
  • Started this discussions
asked
Member

Adding a button to the html editor (textarea) in new PHPFusion 9, xx. Open the file ../includes/html_buttons_include.php and add the code for the new button.
Sample code. Buttons that work for me in pf-9

Ul button
 $res .= "<input type='button' type='button' class='btn btn-sm btn-default m-b-10 button' value='ul' title='UL for the list' onclick=\"addText('".$textarea."', '<ul>', '</ul>', '".$formname."');\">\n";

Li button
 $res .= "<input type='button' type='button' class='btn btn-sm btn-default m-b-10 button' value='li' title='Li list' onclick=\"addText('".$textarea."', '<li>', '</li>', '".$formname."');\">\n";

Awesome download icon for file links
 $res .= "<button type='button' value='download' title='Download Link Style' class='btn btn-sm btn-default m-b-10 button' onclick=\"addText('".$textarea."', '<span class=\'fas fa-download\'>', '</span>', '".$formname."');\"><span class='fas fa-download'></span></button>\n";

DIV block with custom css
 $res .= "<button type='button' value='div css' title='Div css for link block download' class='btn btn-sm btn-default m-b-10 button' onclick=\"addText('".$textarea."', '<div class=\'dw-block\'>', '</div>', '".$formname."');\">div css</button>\n";

YouTube button
 $res .= "<button type='button' value='YouTube' title='Insert iframe videos from YouTube' class='btn btn-sm btn-default m-b-10 button' onclick=\"addText('".$textarea."', '<iframe width=\'560\' height=\'315\' src=\'https://www.youtube.com/embed/XXXXX?rel=0&showinfo=0', '\' frameborder=\'0\' allowfullscreen></iframe>', '".$formname."');\"><i class='fab fa-youtube'></i></button>\n";

Instead of XXXXX, insert the id of the video. Such a video will not display well on small mobile screens.
Edited by zizub on 29-02-2020 18:22,
0 replies

1 post

Z
zizub
Z
zizub 10
  • Member, joined since
  • Contributed 156 posts on the community forums.
  • Started 29 threads in the forums
  • Started this discussions
answered
Member

Button with two div's for responsive videos from YouTube and HTML5 Video
 $res .= "<button type='button' value='div video' title='Video container' class='btn btn-sm btn-default m-b-10 button' onclick=\"addText('".$textarea."', '&lt;div class=\'outer-wrapper\'&gt;&lt;div class=\'video-container\'&gt;', '&lt;/div&gt;&lt;/div&gt;', '".$formname."');\">div video</button>\n";

HTML
<div class='outer-wrapper'><div class='video-container'> Insert iframe YouTube or HTML5 Video here </div></div>

CSS
.outer-wrapper {
 width: 100%;
 max-width: 560px;
 margin: 0 0 10px;
}
.video-container {
 height: 0;
 margin: auto;
 z-index: 1;
 position: relative;
 padding-top: 25px;
 padding-bottom: 56.25%;
 display: block;
 overflow: hidden;
}
 iframe, video {
 display: block;
 top: 0;
 left: 0;
 width: 100%;
 height: 100%;
 z-index: 5;
 position: absolute;
 }

For me, this is a good solution. I need the player to not be full-width on the desktop monitor. max-width: 560px; in outer-wrapper allows me to control the size.
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 1 post
  • Votes 0 votes
  • Topic users 1 member

1 participant

Z
Z
zizub 10
  • Member, joined since
  • Contributed 156 posts on the community forums.
  • Started 29 threads in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet