dongtao4319 2012-11-13 11:54
浏览 110
已采纳

Moodle登录前首页$ OUTPUT变量无法正常工作

I have created a theme by copying the boxxie theme folder in the moodle/theme folder and renaming it to my theme. Now I wanted to have my own BEFORE LOGIN front page so in the theme/mytheme/config.php i changed the file for 'frontpage' of the $THEME->layouts from 'frontpage.php' to 'index.php' where index.php is the index page of my custom html theme.

I have put the folders(css, js etc) in the layout folder of the theme and after the selecting the theme from the moodle admin section, its working fine.

Now, the problem is that I am using the same theme for about.php and a few other php pages. Now whenever i open the about.php page from the browser, it displays an error that the $OUTPUT variable is not recognizable as I am using $OUTPUT->login_info() method in all the pages to get the login info of either logged in or not logged in.

Following is the code which is working fine in the theme/mytheme/layout/index.php (as it is being included in the main index.php file) but showing an error in the theme/mytheme/layout/about.php

<span style="font-size: 15px; color: #ffffff;"><?php echo $OUTPUT->login_info(); ?></span>

What have i tried ?

  1. Storing the output in a session variable ($_SESSION['myoutputvar']).

  2. Making a global variable and storing the $OUTPUT in that variable.

But none of this worked. I know the problem but can't find a solution and after hours of searching, I am finally posting it here.

So, I would be glad to receive any kind of help from you guys. Thanks in advance.

  • 写回答

1条回答 默认 最新

  • duanhao4909 2012-12-06 09:17
    关注

    You need to check layout config file layout values.

    and also need to set in about.php

    $PAGE->set_pagelayout('frontpage');
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 poi合并多个word成一个新word,原word中横版没了.
  • ¥15 【火车头采集器】搜狐娱乐这种列表页网址,怎么采集?
  • ¥15 求MCSCANX 帮助
  • ¥15 机器学习训练相关模型
  • ¥15 Todesk 远程写代码 anaconda jupyter python3
  • ¥15 我的R语言提示去除连锁不平衡时clump_data报错,图片以下所示,卡了好几天了,苦恼不知道如何解决,有人帮我看看怎么解决吗?
  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?