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?

Modify v9.10.20 html buttons include for images

Asked Modified Viewed 839 times
G
Grimloch
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Started this discussions
  • Answered 2 questions
asked
Senior Member

I have done this before in ver7 but can't seem to make it work right in v9. What I do is copy 'includes/html_buttons_include.php' renaming it to 'html_buttons_inc.php' to the include folder in my infusion changing 'display_html' to 'show_html'. That works fine. But I can't figure out how to modify the image insert line which is:
$res .= "<button type='button' value='img' title='".$locale['html_011']."' class='btn btn-sm btn-default dropdown-toggle button' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false' >"addText('".$textarea."', '<img src='".str_replace("../", "", $folder)."', '' style='margin:5px' alt='' align='left' />', '".$formname."');"><i class='fa fa-picture-o'></i></button>n";

What I want to do is change this: img src='".str_replace("../", "", $folder)." to this: img src='infusions/bootstrap_tab_panel/images/' so that the entire line would be:
$res .= "<button type='button' value='img' title='".$locale['html_011']."' class='btn btn-sm btn-default dropdown-toggle button' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false' >"addText('".$textarea."', '<img src='infusions/bootstrap_tab_panel/images/' style='margin:5px' alt='' align='left' />', '".$formname."');"><i class='fa fa-picture-o'></i></button>n";

But it won't work to insert an image. In fact it won't add anything to the textarea when clicked. Any ideas or help here?
Edited by Grimloch on 07-04-2022 19:16,
0 replies

6 posts

F
Falk
F
Falk 131
Need help?, Having trouble?
• View our Documentation for Guides, Standards and Functions
• Name and Organize your Topics and Content correctly in the corresponding Forums for best support results
• Attaching Log Files and Screenshots when reporting issues will help
• Provide with an URL to live example if one exists
• Please read the How to Report an Error post
• Please read and comply with the Code of Conduct

(¯·._.·(¯°·._.·°º*[ Project Manager ]*º°·._.·°¯)·._.·¯)
  • Super Admin, joined since
  • Contributed 6,201 posts on the community forums.
  • Started 639 threads in the forums
  • Answered 11 questions
answered
Super Admin

is $formname & $textarea defined in your code somewhere?
0 replies
K
karrak
K
karrak 32
Van mi sosem változik..smile
  • Senior Member, joined since
  • Contributed 310 posts on the community forums.
  • Started 94 threads in the forums
  • Answered 1 question
answered
Senior Member

works well, you need to enter the file name.
do not change the path to the file,
where you want to display it, such as bootstrap_tab_panel,
form_textarea('area_name', name, 'value', ['path' => 'infusions/bootstrap_tab_panel/images/'])

click insert image, -> <img src='xxx/xxx/filename.gif' style='margin:5px' alt='' align='left' />
add filename.gif
default == empty

or

if form_select insert image, (the file name can be selected.)
Edited by karrak on 08-04-2022 11:31,
0 replies
G
Grimloch
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Started this discussions
  • Answered 2 questions
answered
Senior Member

@Falk
Yes of course they are.
@karrak
I tried to decipher what you posted; it makes no sense to me. Please explain further. When I set the last parameter to 'true' for $folder on the display_html line, an insert image button is shown OK but dropdown is not clickable to select an image. If instead of 'true' I add the line as you show i.e
".display_html("tab1form", "tab1_content", true, false, true, ['path' => 'infusions/bootstrap_tab_panel/images/'], '')."
it gives me an error of 'array to string conversion'...
Here is the entire form in my script:
      echo "<form name='tab1form' method='post' action='".FUSION_SELF.$aidlink."'>n";
      echo "<div class='row'>n";
      echo "<div class='col-md-4'></div>n";
      echo "<div class='col-md-4'>n";
      echo "<div class='form-group'>n";
      echo "<label for='tab1'><strong>".$locale['bs_set30']."</strong></label>n";
      echo "<select class='form-control' id='tab1' name='tab1_enable'>n";
      echo "<option value='1'>".$locale['bs_set60']."</option>n";
      echo "<option value='0'>".$locale['bs_set61']."</option>n";
      echo "</select>n";
      echo "</div></div>n";
      echo "<div class='col-md-4'></div>n";
      echo "</div>n";
      echo "<div class='row'>n";
      echo "<div class='col-md-4'></div>n";
      echo "<div class='col-md-4'>n";
      echo "<div class='form-group'>n";
      echo "<label for='name1'><strong>".$locale['bs_set31']."</strong></label>n";
      echo "<input type='text' class='form-control' name='tab1_name' id='name1' value='".$tabsettings['tab1_name']."'>n";
      echo "</div></div>n";
      echo "<div class='col-md-4'></div>n";
      echo "</div>n";
      echo "<div class='row'>n";
      echo "<div class='col-md-4'></div>n";
      echo "<div class='col-md-4'>n";
      echo "<div class='form-group'>n";
      echo "<label for='content1'><strong>".$locale['bs_set32']."</strong></label>n";
      echo "<textarea class='form-control' name='tab1_content' id='content1' rows='5'>".stripslashes(html_entity_decode($tabsettings['tab1_content']))."</textarea>n";
      echo "<div align='center'>".display_html("tab1form", "tab1_content", true, false, true, ['path' => 'infusions/bootstrap_tab_panel/images/'], '')."</div>n";
      echo "<div align='center'><br><h4><strong>".$locale['bs_set78']."</strong></h4></div>n";
      echo "</div></div>n";
      echo "<div class='col-md-4'></div>n";
      echo "</div>n";
      echo "<div align='center'><button type='submit' name='savetab1settings' class='btn btn-primary btn-md'>".$locale['bs_set20']."</button></div>n";
      echo "</form><br>n";
0 replies
G
Grimloch
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Started this discussions
  • Answered 2 questions
answered
Senior Member

OK; I have it figured out and it works as I need it to. I simply got rid of the 'path =>' part and did this:
".display_html("tab1form", "tab1_content", true, false, false, 'infusions/bootstrap_tab_panel/images/', '')."
Thanks very much karrak!!
Edited by Grimloch on 08-04-2022 15:28,
0 replies
K
karrak
K
karrak 32
Van mi sosem változik..smile
  • Senior Member, joined since
  • Contributed 310 posts on the community forums.
  • Started 94 threads in the forums
  • Answered 1 question
answered
Senior Member

this code is not v9 compatible

 if (!fusion_get_settings("tinymce_enabled")) {
 $Extended = [
 'required' => TRUE,
 'preview' => TRUE,
 'html' => TRUE,
 'autosize' => TRUE,
 'form_name' => 'tab1form',
 'wordcount' => TRUE,
 'path' => INFUSIONS.'bootstrap_tab_panel/images/'
 ];
 } else {
 $Extended = [
 'required' => TRUE,
 'type' => fusion_get_settings('tinymce_enabled') ? 'tinymce' : 'html',
 'tinymce' => fusion_get_settings('tinymce_enabled') && iADMIN ? 'advanced' : 'simple',
 'tinymce_image' => FALSE,
 'path' => INFUSIONS.'bootstrap_tab_panel/images/',
 'form_name' => 'tab1form'
 ];
 }
 echo openform('tab1form', 'post', FUSION_REQUEST);
 echo form_select('tab1_enable', $locale['bs_set30'], $settings['default_search'], [
 'options' => [0 => $locale['bs_set61'], 1 => $locale['bs_set60']],
 'inline' => TRUE
 ]);
 echo form_text('tab1_name', $locale['bs_set31'], $tabsettings['tab1_name'], [
 'inline' => TRUE,
 'error_text' => $locale['error_value']
 ]);
 echo form_textarea('tab1_content', $locale['bs_set32'], $tabsettings['tab1_content'], $Extended);
 echo "<div class='text-center'><h4><strong>".$locale['bs_set78']."</strong></h4></div>n";
 echo form_button('savetab1settings', $locale['bs_set20'], $locale['bs_set20'], ['class' => 'btn-primary']);
 echo closeform();
Edited by karrak on 08-04-2022 18:18,
0 replies
G
Grimloch
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Started this discussions
  • Answered 2 questions
answered
Senior Member

Well thanks I'll play around with it however, it now works perfectly just the way I need it to.
0 replies

Labels

Statistics

  • Views 0 views
  • Posts 6 posts
  • Votes 0 votes
  • Topic users 3 members

3 participants

F
F
Falk 131
Need help?, Having trouble?
• View our Documentation for Guides, Standards and Functions
• Name and Organize your Topics and Content correctly in the corresponding Forums for best support results
• Attaching Log Files and Screenshots when reporting issues will help
• Provide with an URL to live example if one exists
• Please read the How to Report an Error post
• Please read and comply with the Code of Conduct

(¯·._.·(¯°·._.·°º*[ Project Manager ]*º°·._.·°¯)·._.·¯)
  • Super Admin, joined since
  • Contributed 6,201 posts on the community forums.
  • Started 639 threads in the forums
  • Answered 11 questions
K
K
karrak 32
Van mi sosem változik..smile
  • Senior Member, joined since
  • Contributed 310 posts on the community forums.
  • Started 94 threads in the forums
  • Answered 1 question
G
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Started this discussions
  • Answered 2 questions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet