Concrete5 - 类方法不起作用
我正在为Concrete5中的客户端创建一个自定义仪表板应用程序。我无法在控制器类中获取页面的工作方法。Concrete5 - 类方法不起作用
您可以查看我的岗位上正式concrete5论坛,完全深入解释一下:https://www.concrete5.org/community/forums/customizing_c5/call-to-controller-method-throwing-404-page-not-found-error/
这对于生成表单
<?php defined('C5_EXECUTE') or die(_("Access Denied."));
$dh = Loader::helper('concrete/dashboard');
$ih = Loader::helper('concrete/interface');
$uNamePosted = "Pants";
$help = 'This add-on works in conjuction with my XML Export add-on ';
$help .= 'this is a new dashboard page which allows you to open these';
$help .= 'XML files, edit and then save them, so that you can then';
$help .= 'import them using Core Commerce Import.';
echo $dh->getDashboardPaneHeaderWrapper(t('XML Viewer'), t($help), 'span8', false);
?>
<div class="ccm-pane-body">
<?php echo $uNamePosted; ?>
<form method="post"
action="<?php echo $this->action('test_form'); ?>">
<input type="text" name="uName" value="" />
<input type="submit" value="Search" />
</form>
</div>
<?php echo $dh->getDashboardPaneFooterWrapper(false); ?>
仪表板页面我view.php文件这是我的controller.php文件的仪表板页面的内容
<?php defined('C5_EXECUTE') or die(_("Access Denied."));
class DashboardCoreCommerceXmlViewerController extends Controller {
public function test_form() {
$uName = $this->post('uName');
$this->set('uNamePosted', $uName);
}
}
预期的功能:我在框中键入内容并推送搜索,'裤子'的虚拟值更改为我输入的内容
发生了什么:什么都没有,当我点击搜索按钮时,页面重新加载并且没有信息改变。
我由位于这里C5职员以下的教程:http://andrewembler.com/posts/basic-mvc-in-concrete5/
至于我可以告诉这个应该工作,但没有任何反应,当我点击搜索。我已经验证了类中的函数正在被访问,因为一个print(“sometext”);在函数顶部创建以下错误:无法修改头信息 - 已在(public_html/site/packages/xml_viewer/controllers/dashboard/core_commerce/xml_viewer/controller.php:6开始的输出)发送的标头在public_html/site /concrete/core/libraries/view.php在线
这是预料之中,因为头后的打印已发送,但它确实证明concrete5/.PHP是找到功能但是什么也没有发生与行
$this->set('uNamePosted', $uName);
任何帮助表示赞赏,在此先感谢。即使是他们自己的工作人员的教程说,这应该是工作。
在Conrete5论坛上回答。
我有一个大脑放屁,并设置变量“裤”内view.php内部没有Controller.php这样
卫生署!
小说明:我最初有一个命名空间问题与控制器的名称 - 当我点击搜索时得到404错误。解决这个问题之后,我发现它在运行时的功能不会达到预期的效果。 – SC1988 2015-03-30 22:53:17