Concrete5 - Class 方法无效
Concrete5 - Class method not working
我正尝试在 Concrete5 中为我的一个客户创建自定义仪表板应用程序。我无法在控制器中获取方法 class 以使页面正常工作。
您可以在官方 concrete5 论坛上查看我的 post 以获得完整的 in-depth 解释:https://www.concrete5.org/community/forums/customizing_c5/call-to-controller-method-throwing-404-page-not-found-error/
这是我的 view.php 仪表板页面文件,用于生成表单
<?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); ?>
这是我的仪表板页面 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);
}
}
预期功能:我在框中键入内容并推送搜索,'pants' 的虚拟值更改为我键入的内容
发生了什么:没有,当我点击搜索按钮时,页面重新加载并且没有信息发生变化。
我正在学习位于此处的 C5 工作人员的教程:http://andrewembler.com/posts/basic-mvc-in-concrete5/
据我所知这应该可行,但当我点击搜索时没有任何反应。我已经验证 class 中的函数正在被访问,因为 print("sometext");在函数顶部创建以下错误:无法修改 header 信息 - headers 已经发送(输出开始于 public_html/site/packages/xml_viewer/controllers/dashboard/core_commerce/xml_viewer/controller.php:6) in [=36] =]public_html/site/concrete/core/libraries/view.php 在线 963
这是预期的,因为它在 headers 发送后打印,但它确实证明 concrete5/.PHP 正在寻找函数,但是行
没有任何反应
$this->set('uNamePosted', $uName);
感谢任何帮助,在此先感谢。甚至他们自己的工作人员的教程也说这应该有效。
在 Conrete5 论坛上回答。
我脑袋放屁,将变量设置为 'pants' 在 view.php 内,而不是在 controller.php
内
哎呀!
我正尝试在 Concrete5 中为我的一个客户创建自定义仪表板应用程序。我无法在控制器中获取方法 class 以使页面正常工作。
您可以在官方 concrete5 论坛上查看我的 post 以获得完整的 in-depth 解释:https://www.concrete5.org/community/forums/customizing_c5/call-to-controller-method-throwing-404-page-not-found-error/
这是我的 view.php 仪表板页面文件,用于生成表单
<?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); ?>
这是我的仪表板页面 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);
}
}
预期功能:我在框中键入内容并推送搜索,'pants' 的虚拟值更改为我键入的内容
发生了什么:没有,当我点击搜索按钮时,页面重新加载并且没有信息发生变化。
我正在学习位于此处的 C5 工作人员的教程:http://andrewembler.com/posts/basic-mvc-in-concrete5/
据我所知这应该可行,但当我点击搜索时没有任何反应。我已经验证 class 中的函数正在被访问,因为 print("sometext");在函数顶部创建以下错误:无法修改 header 信息 - headers 已经发送(输出开始于 public_html/site/packages/xml_viewer/controllers/dashboard/core_commerce/xml_viewer/controller.php:6) in [=36] =]public_html/site/concrete/core/libraries/view.php 在线 963
这是预期的,因为它在 headers 发送后打印,但它确实证明 concrete5/.PHP 正在寻找函数,但是行
没有任何反应$this->set('uNamePosted', $uName);
感谢任何帮助,在此先感谢。甚至他们自己的工作人员的教程也说这应该有效。
在 Conrete5 论坛上回答。
我脑袋放屁,将变量设置为 'pants' 在 view.php 内,而不是在 controller.php
内哎呀!