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 怎样才能让鼠标沿着线条的中心线轨迹移动
  • ¥60 用visual studio编写程序,利用间接平差求解水准网
  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?
  • ¥15 win10权限管理,限制普通用户使用删除功能
  • ¥15 minnio内存占用过大,内存没被回收(Windows环境)
  • ¥65 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?