Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum

Get help for TinyWebGallery, the best image gallery. The forum is also home for the Joomla JFUploader, TWG Flash Uploader and the Wordpress flash uploader.
It is currently 22. Nov 2024, 10:41

This forum is readonly now. Please use the new forum if you don't find the answer to your question here. The new forum is at https://www.tinywebgallery.com/blog/forum/


All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: 19. Dec 2017, 07:28 
Offline
User avatar

Joined: 13. Apr 2015, 18:55
Posts: 52
Hai Michael,

I am struggling to get the standalone external workaround working. I need this for integrating our webshop into Drupal7 websites.
I have 'vision' and the webshop is loaded within a Drupal page. The sample is at http://drupal7.extravestiging.nl/node/3.
However, the external workaround does not work and it does not set the height based on the contents (of the container = element_to_measure)...

Below the code I use in Drupal in combination with the PHP-module.
It is a copy of your 'standalone-advanced-iframe.php' file, adjusted with some extra code for logging and js scripts-loading.

I have been strugling with this for hours and hours but am lost now..
I hope you can give me a clue to get this working.
I have the feeling that I am almost there...

Code:
<script src="\plugins\jquery\jquery-3.2.1.min.js"></script>
<script src="\plugins\jquery\jquery-migrate-1.4.1.min.js"></script>
<script src="\modules\php\advanced-iframe\js\ai.js"></script>

<?php

// Website can be found at http://drupal7.extravestiging.nl/node/3#overlay-context=node
// Configuration files (.js and .php):
// http://drupal7.extravestiging.nl/modules/php/advanced-iframe/standalone/standalone-ai_external_config_EV.js
// http://drupal7.extravestiging.nl/modules/php/advanced-iframe/standalone/standalone-advanced-iframe-settings-EV.php

// Load the External workarounds variables
// These are the contents of http://drupal7.extravestiging.nl/modules/php/advanced-iframe/standalone/standalone-advanced-iframe-settings-EV.php
// The dox state that these should be loaded before the standalone external workaround .js scripts so we put them here and after this, we load the 2 .js files

// These settings are based on the working Wordpress external workaround shortcode at http://www.bakkerijpot.nl/webshop
// [advanced_iframe securitykey="2db78864026a6612cd2c4a85961b413b06baa7e0" use_shortcode_attributes_only="true" src="http://webshop.bakkerijpot.nl" width="100%" height="2000"
// scrolling="no" enable_ios_mobile_scrolling="true" id="EVWebshop" name="EVWebshop" url_forward_parameter="ALL" add_iframe_url_as_param_prefix="webshop.bakkerijpot.nl"
// onload_scroll_top="true" show_iframe_loader="true" enable_responsive_iframe="true" hide_page_until_loaded="false" resize_on_ajax_jquery="false" enable_external_height_workaround="true"
// map_parameter_to_url="page" use_post_message="true"]

$iframeStandaloneOptions = array(
   'securitykey' => '2db78864026a6612cd2c4a85961b413b06baa7e0',
   'id' => 'EVWebshop',
   'name' => 'EVWebshop',
   'src' => 'http://webshop.bakkerijpot.nl',
   'url_forward_parameter' => 'ALL',
   'onload_scroll_top' => 'false',
   'additional_height' => '0',
   'enable_external_height_workaround' => 'external',
   'scrolling' => 'no',
   'width' => '100%',
   'height' => '2000',
   'enable_lazy_load' => 'false',
   'show_iframe_loader' => 'true',
   'enable_responsive_iframe' => 'true',
   'hide_page_until_loaded' => 'true',
   'enable_ios_mobile_scrolling' => 'true',
   'add_iframe_url_as_param_prefix' => 'webshop.bakkerijpot.nl',
   'resize_on_ajax_jquery' => 'false',
   'map_parameter_to_url' => 'page',
   'element_to_measure' => 'container'
);

// And now we can load the 2 .js files
// - Configuration (again?)
// - External workaround

?>

   <script src="\modules\php\advanced-iframe\standalone\standalone-ai_external_config_EV.js"></script>
   <script src="\modules\php\advanced-iframe\standalone\standalone-ai_external.js"></script>

<?php

// Setup the page and show some info...

Echo "Dit is de EV Testpage <br><br>";

// Check if we can find the scripts and other files!
$filename = 'C:\Websites\Drupal7\modules\php\advanced-iframe\js\ai.js';
if (file_exists($filename)) {
    echo "The file '$filename' exists";
} else {
    echo "ERROR : The file '$filename' does not exist";
}
echo "<br>";

$filename = 'C:\Websites\Drupal7\plugins\jquery\jquery-3.2.1.min.js';
if (file_exists($filename)) {
    echo "The file '$filename' exists";
} else {
    echo "ERROR : The file '$filename' does not exist";
}
echo "<br>";

$filename = 'C:\Websites\Drupal7\plugins\jquery\jquery-migrate-1.4.1.min.js';
if (file_exists($filename)) {
    echo "The file '$filename' exists";
} else {
    echo "ERROR : The file '$filename' does not exist";
}
echo "<br>";

$filename = 'C:\Websites\Drupal7\modules\php\advanced-iframe\standalone\standalone-ai_external_config_EV.js';
if (file_exists($filename)) {
    echo "The Advanced iFrame configuration file '$filename' exists";
} else {
    echo "ERROR : The Advanced iFrame configuration file '$filename' does not exist";
}
echo "<br>";

$filename = 'C:\Websites\Drupal7\modules\php\advanced-iframe\standalone\standalone-ai_external.js';
if (file_exists($filename)) {
    echo "The Advanced iFrame configuration file '$filename' exists";
} else {
    echo "ERROR : The Advanced iFrame configuration file '$filename' does not exist";
}
echo "<br>";

// We have to add these globals or else the code does not work
global $iframeStandaloneDefaultOptions;
global $aip_standalone;
global $iframeStandaloneOptions;
global $domain;
global $html;

// This is a copy of Standalone-advanced-iframe.php in Drupal so we can modify it easy here
// - Added some logging / progress

// Set the standalone version
$aip_standalone = true;

// Setup the default values
  $iframeStandaloneDefaultOptions = array(
    'securitykey'=>'standalone',
    'src' => '//www.extravestiging.nl', 'width' => '100%','height' => '600',
    'scrolling' => 'auto', 'marginwidth' => '0', 'marginheight' => '0',
    'frameborder' => '0', 'transparency' => 'true', 'content_id' => '', 'content_styles' => '',
    'hide_elements' => '', 'class' => '', 'shortcode_attributes' => 'true', 'url_forward_parameter' => '',
    'id' => 'advanced_iframe', 'name' => '',
    'onload' => '', 'onload_resize' => 'false', 'onload_scroll_top' => 'false',
    'additional_js' => '', 'additional_css' => '', 'store_height_in_cookie' => 'false',
    'additional_height' => '0', 'iframe_content_id' => '', 'iframe_content_styles' => '',
    'iframe_hide_elements' => '', 'version_counter' => '1', 'onload_show_element_only' => '' ,
    'include_url'=> '','include_content'=> '','include_height'=> '','include_fade'=> '',
    'include_hide_page_until_loaded' => 'false', 'donation_bottom' => 'false',
    'onload_resize_width' => 'false', 'resize_on_ajax' => '', 'resize_on_ajax_jquery' => 'true',
    'resize_on_click' => '', 'resize_on_click_elements' => 'a', 'hide_page_until_loaded' => 'false',
    'show_part_of_iframe' => 'false', 'show_part_of_iframe_x' => '100', 'show_part_of_iframe_y' => '100',
    'show_part_of_iframe_width' => '400', 'show_part_of_iframe_height' => '300',
    'show_part_of_iframe_new_window' => '' ,'show_part_of_iframe_new_url' => '',
    'show_part_of_iframe_next_viewports_hide' => 'false', 'show_part_of_iframe_next_viewports' => '',
    'show_part_of_iframe_next_viewports_loop' => 'false', 'style' => '',
    'use_shortcode_attributes_only' => 'false', 'enable_external_height_workaround' => 'external',
    'keep_overflow_hidden' => 'false', 'hide_page_until_loaded_external' => 'false',
    'onload_resize_delay' => '', 'expert_mode' => 'false',
    'show_part_of_iframe_allow_scrollbar_vertical' => 'false',
    'show_part_of_iframe_allow_scrollbar_horizontal' => 'false',
    'hide_part_of_iframe' => '', 'change_parent_links_target' => '',
    'change_iframe_links' => '','change_iframe_links_target' => '',
    'browser' => '', 'show_part_of_iframe_style' => '',
    'map_parameter_to_url' => '', 'iframe_zoom' => '',
    'show_iframe_loader' => 'false',
    'tab_visible' => '', 'tab_hidden' => '',
    'enable_responsive_iframe' => 'false',
    'allowfullscreen' => 'false', 'iframe_height_ratio' => '',
    'enable_lazy_load' => 'false', 'enable_lazy_load_threshold' => '3000',
    'enable_lazy_load_fadetime' => '0', 'enable_lazy_load_manual' => 'false',
    'pass_id_by_url' => '', 'include_scripts_in_footer' => 'false',
    'write_css_directly' => 'false', 'resize_on_element_resize' => '',
    'resize_on_element_resize_delay' => '250', 'add_css_class_parent' => 'false',
    'dynamic_url_parameter'  => '', 'auto_zoom'  => 'false',
    'enable_lazy_load_manual_element' => '',  'auto_zoom_by_ratio' => '',
    'enable_lazy_load_manual_element' => '', 'alternative_shortcode' => '',
    'iframe_redirect_url' => '', 'show_part_of_iframe_last_viewport_remove' => 'false',
    'show_iframe_as_layer' => 'false',
    'add_iframe_url_as_param' => 'false', 'add_iframe_url_as_param_prefix' => '',
    'reload_interval' => '', 'iframe_content_css' => '',
    'additional_js_file_iframe' => '', 'additional_css_file_iframe' => '',
    'add_css_class_iframe' => 'false',
    'iframe_zoom_ie8' => 'false', 'enable_lazy_load_reserve_space' => 'true',
    'hide_content_until_iframe_color' => '', 'use_zoom_absolute_fix' => 'false',
    'include_html' => '', 'enable_ios_mobile_scolling' => 'false',
    'sandbox' => '', 'show_iframe_as_layer_header_file' => '',
    'show_iframe_as_layer_header_height' => '100', 'show_iframe_as_layer_header_position' => 'top',
    'resize_min_height' => '1', 'show_iframe_as_layer_full' => 'false',
    'demo' => 'false', 'show_part_of_iframe_zoom' => 'false',
    'external_height_workaround_delay' => '0',
    'add_document_domain' => 'false' , 'document_domain' => '',
    'multi_domain_enabled' => 'true', 'check_shortcode' => 'false',
    'use_post_message' => 'true', 'element_to_measure_offset' => '0',
    'data_post_message' => '', 'element_to_measure' => 'default',
    'show_iframe_as_layer_keep_content' => 'true','roles' => 'none',
    'parent_content_css' => '', 'include_scripts_in_content' => 'false'
    );
   
    // load the config - Adjusted for the EV file... But we already have loaded this in the top of this script! I guess it does not matter
    if (isset($ai_settings_file)) {
        require_once dirname(__FILE__) . '/' . $ai_settings_file;
    } else {
        require_once dirname(__FILE__) . '\advanced-iframe\standalone\standalone-advanced-iframe-settings-EV.php';
    }

    if ( !function_exists( 'esc_html' ) ) {
      function esc_html( $html, $char_set = 'UTF-8' ) {
        if ( empty( $html ) && $html != '0' ) {
            return '';
        }
        $html = (string) $html;
        $html = htmlspecialchars( $html, ENT_QUOTES, $char_set );
        return $html;
      }
    }
   
    if ( !function_exists( 'site_url' ) ) {
      function site_url() {
        global $site_url;
        return $site_url;
      }
    }
   
    if ( !function_exists( 'home_url' ) ) {
      function home_url() {
        $domain = '';
        if (isset($_SERVER['HTTP_HOST'])) {
            $domain = $_SERVER['HTTP_HOST'];
        } else if (isset($_SERVER['SERVER_NAME'])) {
            $domain = $_SERVER['SERVER_NAME'];
        }
        $port = strpos($domain, ':');
        if ($port !== false) $domain = substr($domain, 0, $port);
        return $domain;
      }
    }
     
    if ( !function_exists( 'plugins_url' ) ) {
      function plugins_url() {
        global $site_url;
          return $site_url;
        }
    } 
   
    if ( !function_exists( 'esc_js' ) ) {
      function esc_js($value) {
        return esc_html($value);
      }
    }
   
    if ( !function_exists( 'get_absolute_path' ) ) {
      function get_absolute_path() {
        $domain =  home_url();
        // Get the path to the file
        $path = substr(dirname(__FILE__), strlen($_SERVER["DOCUMENT_ROOT"]));
        $apath = "//" . $domain . $path;
        $apath = str_replace('\\', '/' , $apath );
        return  $apath . '/..';
      }   
    }
   
    if ( !function_exists( 'plugin_dir_url' ) ) {
      function plugin_dir_url($file) {
        global $site_url;
          return $site_url . '/';
        }
      }

  // set the defaults url
  if (!isset($site_url)) {
    $site_url = get_absolute_path();   
  }

// *****************************************************************
// Start the iFrame Plugin routines
// *****************************************************************

    echo "<br>****** Start the iFrame Plugin ******";
 
   require_once dirname(__FILE__) . '\advanced-iframe\advanced-iframe.php';

    echo "<br>****** End the iFrame Plugin ******";

    echo "<br>****** Start to show HTML ******";

    //  setup new instance of plugin if not standalone
    if (class_exists("advancediFrame")) {
      $cons_advancediFrame = new advancediFrame();

       echo $cons_advancediFrame->do_iframe_script(null,null);
  }

    echo "<br>****** THE END ******";

?>

_________________
Greetings from sunny Curaçao!


Top
 Profile  
 
PostPosted: 19. Dec 2017, 18:58 
Offline
Site Admin
User avatar

Joined: 1. Aug 2005, 12:53
Posts: 11232
Not sure what you are doing here.

Normally you have to do something like this:

<script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script type="text/javascript" src="../js/ai.js"></script>
<?php
// $site_url = 'http://www.tinywebgallery.com/advanced-iframe-standalone'; // set this if needed
$ai_settings_file = 'standalone-advanced-iframe-settings2.php';
include 'standalone-advanced-iframe.php';
?>

and IN the iframe if you use/need the external workaround you put
<script src="../standalone/standalone-ai_external_config.js"></script>
<script src="../standalone/standalone-ai_external.js"></script>

this is all shown in stanalone-example.php.

Best, Michael


Top
 Profile  
 
PostPosted: 19. Dec 2017, 22:24 
Offline
User avatar

Joined: 13. Apr 2015, 18:55
Posts: 52
Sorry to say Michael but the dox and the sample are very vague and unclear regarding the standalone version icw the external workaround!

1 It was unclear (but is now clear) what variables you can use in the .js file (a link in the dox to these would be usefull)
2 It is still unclear what variables you can use in the .php file (a link in the dox to these would be usefull)
3 It was unclear that you have to include the .js files IN the iFrame-html
4 The use of the ai_settings_file is nowhere mentioned in the dox (as far as I could find it)

Hope you can supply a link to point 2: A list of php-variables to put in the php-settingsfile (i guess they are different from the .js variable names?)

I understand what you say and will try that.
Thanx for your time and info.

Regards, Marc

_________________
Greetings from sunny Curaçao!


Top
 Profile  
 
PostPosted: 20. Dec 2017, 22:20 
Offline
Site Admin
User avatar

Joined: 1. Aug 2005, 12:53
Posts: 11232
Hi,

The external workaround works exactly like you would use the normal wordpress version except you have your shortcode attributes defined in a settings file.

So
1. The js settings file is the one like explained on the "external workaround" tab. There is also the documentation of each setting. This you find explained already at http://www.tinywebgallery.com/advanced-iframe-standalone/standalone/readme.html -> External workaround. also with a link. So I'm not sure what to provide more here.
2. There are no "variables"! there is an array ($iframeStandaloneOptions) with the options you have to specify http://www.tinywebgallery.com/advanced-iframe-standalone/standalone/standalone-example.php shows many examples. You can simply use all short code attributes available there! I have now added this also on top of this file (It was already at the bottom)
3. Also see the demos and also the documentation on the external workaround tab. There is no difference at all how you use this with wordpress. The only difference is that ai_external.js is not generated automatially and therefore everything has to be specified in a settings file. This explained at http://www.tinywebgallery.com/advanced-iframe-standalone/standalone/readme.html -> External workaround.
4. Which settings file do you mean? The js one see 3. and the settings file for the server is shown on http://www.tinywebgallery.com/advanced-iframe-standalone/standalone/standalone-example.php a couple of times and also 4 setting files are included in the standalone folder as examples.

So what would have helped you in the documentation to find the info better. at 2. I have now already added additional information about the settings file.

Best, Michael


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 33 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron
powered by phpbb | Datenschutz/ Privacy policy