Concrete5-Class方法不起作用


Concrete5 - Class method not working

我正试图在Concrete5中为我的一个客户端创建一个自定义面板应用程序。在控制器类中获取方法以使页面工作时遇到问题。

你可以在concrete5官方论坛上查看我的帖子,在这里进行全面深入的解释: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);
        }
    }

预期功能:我在框中键入一些内容并推送搜索,"裤子"的伪值更改为我键入的

发生了什么:什么都没有,当我点击搜索按钮时,页面会重新加载,并且没有任何信息更改。

我正在学习位于这里的C5工作人员的教程:http://andrewembler.com/posts/basic-mvc-in-concrete5/

据我所知,这应该有效,但当我进入搜索时,什么也没发生。我已经验证了访问类中的函数是因为print("sometext");在函数的顶部创建以下错误:无法修改标头信息-标头已由public_html/site/corete/core/librarys/view.php中963行的public_html/site/packages/xml_viewer/controllers/dashboard/core_commerce/xml_viewer/controller.php发送

这是意料之中的,因为它是在发送头之后打印的,但它确实证明了concrete5/.PHP正在找到该函数,但行没有发生任何事情

$this->set('uNamePosted', $uName);

如有任何帮助,我们将不胜感激,并提前表示感谢。甚至他们自己的工作人员的教程也说这应该有效。

在Conrete5论坛上回答。

我脑子里出了个屁,把变量设置为视图内的"裤子"。php而不是控制器内的。php

Doh!