2013-04-22 74 views
2

我一直在寻找this tutorial但在Apache日志获取分段错误错误。如何另一个页面上添加一个简单的页面Silverstripe(3.0.5)的管理区域添加到Silverstripe CMS管理

我认为问题是“customHelp.php”中的“索引”方法 - 当我将“index”重命名为其他内容时,我在管理菜单中没有崩溃和条目,但显然没有显示任何内容我点击它。

这里是我的“customHelp.php”的内容 - 可有人请点我在正确的方向?

<?php 

class customHelp extends LeftAndMain { 

    static $url_segment = "customHelp"; 
    static $menu_title = "Site Help";  
    static $allowed_actions = array ('customHelp'); 

    public function index() { 
     return $this->renderWith('customHelp'); 
    }  

    public function init() { 
     parent::init(); 
    } 
} 
+0

为什么你认为这个问题是用食指方法是什么?你能对错误更具体吗?你在customHelp.ss文件中有什么? – drzax 2013-04-23 05:07:38

+0

我刚刚在我的网页(URL为http://mysite.local/admin/customHelp/)中收到“No data received - server sent no data”。例如,如果我将index()重命名为xindex(),管理网站加载正常,可能是因为该方法没有被调用。我的“customHelp.ss”是一样的教程页面上(存储在/ customHelp /模板) – finster 2013-04-23 19:16:00

回答

0

我猜的教程是不正确的或过时。

我在这里尝试过了,得到了错误:

Declaration of customHelp::index() should be compatible with that of LeftAndMain::index() 

所以使它兼容与overiding:

public function index($request) { 
    return $this->renderWith('customHelp'); 
} 

使它在这里工作。

+0

谢谢 - 我现在有点进一步(不知道为什么我没有看到相同的错误信息),但现在一旦我已经点击“网站帮助”菜单项,页面的右侧似乎会粘住。点击任何其他菜单项不会摆脱“自定义html内容”文本。有任何想法吗?谢谢。 – finster 2013-04-26 20:00:48

+0

我可以证实这种奇怪的行为,但我不能告诉为什么会发生这种情况。内容被加载但不显示。也许你应该使用LeftAndMainExtension而不是扩展。 http://doc.silverstripe.org/framework/en/howto/extend-cms-interface – ivoba 2013-05-02 17:02:28

+0

谢谢 - 我会尝试。不要以为我选择了最好的教程;)你的解决方案修正了原来的问题,所以谢谢。 – finster 2013-05-07 12:01:19

-1

可能不相关的,但你应该使用正确的类名命名约定,甚至引导否则建议:

类应以大写字母http://doc.silverstripe.org/framework/en/trunk/misc/coding-conventions启动和文件名应遵循此。

,供应文件作为区分大小写的服务器上运行时,您可以运行中的问题。

编辑:

刚打我,指数问题可能是由unlfushed模板缓存造成的:运行冲水=所有的网站?

+0

谢谢 - 我重复运行冲水=所有我的网站上,每当我做任何改变?你认为重命名类名会有帮助吗?我只是按照教程页面,这是如何命名的类... – finster 2013-04-23 19:18:32

相关问题