【问题标题】:including php file in thickbox inline view in wordpress在wordpress的thickbox内联视图中包含php文件
【发布时间】:2016-08-05 19:33:45
【问题描述】:

在我的一个 wordpress 插件中,我使用thickbox 函数来调用同一插件目录中的另一个php 文件。只要内容来自同一个文件,厚盒就会显示内容,如果我在厚盒中包含另一个 php 文件,它将无法工作。请帮忙。

这是我的代码。

<?php 
add_thickbox();

include plugin_dir_path(__FILE__) . '/my_php_file.php'; ?>
<div id="cnt-id" style="display:none;">
   <h1><?php _e('Select an Item', 'txt-domain'); ?></h1>
   <?php print_r($tpl_list);?>
</div>

thickbox 锚链接

<a href="#TB_inline?width=600&height=550&inlineId=cnt-id" class="thickbox">
    <?php _e('Open thickbox', 'txt-domain'); ?>
</a>

所以当thickbox页面加载时,它只显示h1标题。我要打印的数组只是在包含的 php 文件中创建的静态数组。

我们将不胜感激。

谢谢

【问题讨论】:

    标签: php jquery wordpress thickbox


    【解决方案1】:

    仅适用于处于类似情况的人。这是我找到的解决方案。

    我在我的同一位置使用带有 TB_iframe 参数的厚框文件的绝对 URL。我调用了一个单独的 php 文件,其中包含另一个带有数组数据的文件。

    我不想直接访问那个文件,我通过 PHP 添加了 http_referer 检查,以检查 ref url 中是否有 wp-admin/post.php。这不是一个坚如磐石的黑客证明,但仍然有所帮助。

    谢谢

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-24
      • 2010-12-24
      • 2023-03-12
      • 2012-02-13
      • 2015-07-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多