- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在开发 Joomla! 2.5/3.x editor-xtd 按钮,我在单击按钮时从文件加载布局时遇到问题。
我尝试过这个方法:
$link = 'plugins/editors-xtd/myplugin/myplugin.layout.php?name='.$name;
$button = new JObject;
$button->modal = true;
$button->class = 'btn';
$button->link = $link;
$button->text = 'Insert something';
$button->name = 'myplugin';
$button->options = "{handler: 'iframe', size: {x: 500, y: 300}}";
...但是管理中生成的完整链接看起来像 http://my.local.host/mywebsite/administrator/plugins/editor-xtd/link-etc ..而且它不起作用。我也尝试过在 $link 中包含 JURI::base,但管理员路径仍然加载。
我是 Joomla 插件开发的新手!我进行了很多搜索,但没有找到解决方案。
** 我也尝试了这样的链接 index.php?folder=plugins.editors-xtd.myplugin&file=myplugin.layout.php&name=$name 但仍然没有。有没有针对此的练习,或者我必须创建并使用 JavaScript 函数来在按钮单击时运行?
最佳答案
像这样修改链接变量(如果应用程序是管理员):
$link = '../plugins/editors-xtd/myplugin/myplugin.layout.php?name='.$name;
...和删除按钮选项(这意味着文件内容将通过模态中的ajax加载)
此外,在 myplugin.layout.php 中我们可以添加一些安全检查,并且我们可以导入 Joomla!框架库并定义,以便我们可以使用 Joomla!我们文件中的框架(例如语言加载之类的东西)这是我的实际文件头:
<?php
// No direct access
define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
if( ! IS_AJAX) die;
// Include J!Framework for later use
define( '_JEXEC', 1 );
define( 'JPATH_BASE', realpath(dirname(__FILE__).'/../../..'));
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE.DS.'includes'.DS.'defines.php');
require_once ( JPATH_BASE.DS.'includes'.DS.'framework.php');
//more magic goes here...
关于乔姆拉! - 从按钮的 iframe 处理程序中的指定文件加载 editor-xtd 插件布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22644845/
我正在开发 Joomla! 2.5/3.x editor-xtd 按钮,我在单击按钮时从文件加载布局时遇到问题。 我尝试过这个方法: $link = 'plugins/editors-xtd/mypl
我的网站实际上是一个 wagtail 网站,尽管我不确定这是否会有所不同。这是一个简单的博客应用程序,其中包含一个用于查看帖子的博客页面和一个用于显示每个帖子的页面。 我按照指示 here设置 dja
我是一名优秀的程序员,十分优秀!