SilverStripe管理员更改

时间:2017-05-30 06:24:49

标签: php silverstripe

我正在尝试添加新的设置页面和电子邮件页面。当你点击电子邮件菜单时,它在silverstripe admin cms下,但在重新加载电子邮件页面后,它不在silverstripe admin cms下。

那么它不属于admin cms的原因是什么?

这是控制器代码:

public function index() {
    $getmem=Member::currentUser();
    if($getmem->RainloopEmail !='' && $getmem->Pass !='')
    {
        $com=$getmem->RainloopEmail.":".$getmem->Pass;
        $encrypted = base64_encode($getmem->RainloopEmail) ;
        $rainloopemail=$encrypted;
        $encrypted =base64_encode($getmem->Pass);
        $pss=$encrypted;

        $hash=base64_encode($com);

    }
    else
    {
        $rainloopemail='';
        $pss='';
        $com=$getmem->RainloopEmail.":".$getmem->Pass;
        $hash=base64_encode($com);

    }
    $url='http://op.mctitsolutions.com/rainloop/rainloop.php?hash='.$hash;
    $arrayData = new ArrayData(array(
'Width' => '100%',
'Height' => '100%',
'Location'=>$url ));

return $arrayData->renderWith(Array('EmailsAdminController_Content','Coach_message','Page'));

}

这是模板文件代码:

<div style="padding:55px 20px">
$EditForm
<iframe  id="MainPopupIframe"  width="$Width" height="605px" src="$Location"></iframe>

那么它不属于admin cms的原因是什么?

1 个答案:

答案 0 :(得分:2)

这是我的答案。

在控制器中添加了新功能。和循环用于在模板文件中显示。这解决了我的问题。

public function getViewEmails() {
    $hash='';
            $getmem=Member::currentUser();
    if($getmem->RainloopEmail !='' && $getmem->Pass !='')
    {
        $com=$getmem->RainloopEmail.":".$getmem->Pass;
        $encrypted = base64_encode($getmem->RainloopEmail) ;
        $rainloopemail=$encrypted;
        $encrypted =base64_encode($getmem->Pass);
        $pss=$encrypted;

        $hash=base64_encode($com);

    }
    else
    {
        $rainloopemail='';
        $pss='';
        $com=$getmem->RainloopEmail.":".$getmem->Pass;
        $hash=base64_encode($com);

    }
    $url='http://op.mctitsolutions.com/rainloop/rainloop.php?hash='.$hash;
        return new ArrayList(array(
                new ArrayData(array(
                        'Url'=>$url,
                        'Width' => '100%',
                ))
        ));
}

这是我的模板文件。

<div style="padding:55px 20px">

<% loop ViewEmails %>
<iframe  id="MainPopupIframe"  width="$Width" height="605px" src="$Url">
 </iframe>
   <% end_loop %>
</div>