$menu, $loggedinas etc.

$menu, $loggedinas etc.

by Borek Bernard -
Number of replies: 12
Hello, I'm trying to customize my Moodle installation and hence I need to make some little changes to header.html and footer.html.

I'd appreciate some guidelines about certain variables. For example $menu variable - sometimes it prints "logged in as" and sometimes some course navigation popup (with no "logged in as" text). Or the $loggedinas - I tried to use it right after opening <body> tag and it prints nothing - but the same variable in footer.html prints out "you are logged in as..." text.

Where can I find a complete list of applicable variables with some short description?

Regards, Borek
Average of ratings: -
In reply to Borek Bernard

Re: $menu, $loggedinas etc.

by Pamela Giles -
I can't help you, but I'd also like to know the answer to your question.

I'm using Himmat's Elektrik15 theme. Ideally, I'd like every page to have the "you are logged in as" line in the header, and no pages to have the navigational "jump" menu. (For one thing, the jump menu messes up printing for "web page" resources.) Like Borek, I'm puzzled why $menu does what I want on the first page, but provides the jump menu for other pages, even though the line of code looks identical in both sections.
In reply to Pamela Giles

Re: $menu, $loggedinas etc.

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Borek and Pamela,

I also want exactly the same, for the same reasons explained by Borek in his first post.

It would be very useful to Moodlers creating or customizing themes to have a full, documented list of all the variables which are available to the header.html and footer.html files.

Any Moodle guru listening?wink

Joseph

In reply to Joseph Rézeau

Re: $menu, $loggedinas etc.

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Got it cool
In file header.html, instead of:
<?php } else if ($heading) {  // This is what gets printed on any other page with a heading ?>
    <div id="header">
        <div class="headermain"><?php echo $heading ?></div>
        <div class="headermenu"><?php echo $menu ?></div>
    </div>
<?php } ?>
write:
 <?php } else if ($heading) {  // This is what gets printed on any other page with a heading ?>
    <div id="header">
        <div class="headermain"><?php echo $heading ?></div>
        <div class="headermenu"><?php echo user_login_string($usercourse, $USER) ?></div>
    </div>
Enjoy!
Joseph


In reply to Joseph Rézeau

Re: $menu, $loggedinas etc.

by Shaan p -

That 's Great Joseph !!

I have another question for you . How I bring the language selection select button seperately ? ie , look at he below table for the form which I require ,

The user information,logged in as must come here

some blank spaceThe language selection box must come here .

Can u help me in this regard too..

Thanks !!

In reply to Joseph Rézeau

Re: $menu, $loggedinas etc.

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

IMPORTANT NOTICE

Upon upgrading to Moodle 1.6 I found out that the hack explained in my post dated 19 Sep. 2005 caused the following problem.

  1. Log in as Admin or course teacher.
  2. In the People block, click on Participants.
  3. Select one of the students enrolled into this course and click on the Log in as button and Continue.
  4. Browse the course, being [User Admin] logged in as [student name].
  5. When you want to revert to Admin login, click on the [User Admin] link.
  6. You get an error message "Course ID was incorrect".

Solution to avoid this problem (valid for 1.5 through 1.6). In the above hack, instead of:

<div class="headermenu"><?php echo user_login_string($usercourse, $USER) ?></div>

put

<div class="headermenu"><?php echo user_login_string() ?></div>

i.e. user_login_string() must be empty!

Joseph


In reply to Borek Bernard

Re: $menu, $loggedinas etc.

by Urs Hunkler -
Picture of Core developers

Borek and Joseph,

please look at the MoodleDocs Theme Description for a list of applicable variables with some short description.

I hope this helps
Urs

In reply to Urs Hunkler

Re: $menu, $loggedinas etc.

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Urs,
Thanks for the pointer. I guess this list of variables could still be expanded, but it is useful as it is.
Joseph
In reply to Urs Hunkler

Re: $menu, $loggedinas etc.

by Shaan p -

I'm not sure whether you got my point .. <?php echo user_login_string($usercourse, $USER) ?> gives the 'you are logged in as ' info alone . similarlly , how can I bring the language selection select box in view . what is the respective method / variable that does this ? . as of now , the variable '$menu' gives both the 'you are logged in as ' text and the select box in view .

Thanks ,

Shaan

In reply to Borek Bernard

Re: $menu, $loggedinas etc.

by Владемир Девятов -
Have a same problem...
In reply to Владемир Девятов

Re: $menu, $loggedinas etc.

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi,
You are posting to a 4-year-old discussion thread with a rather cryptic "Have a same problem" message. Could you state exactly what your problem is, and whether the replies already provided in answer to the original poster have been useful to you?
Thanks
Joseph
In reply to Joseph Rézeau

Re: $menu, $loggedinas etc.

by Владемир Девятов -

How I bring the language selection select button seperately ? ie , look at he below table for the form which I require , 

The user information,logged in as must come here

some blank space The language selection box must come here .

Can u help me in this regard too..

That's my problem...

Can you help with it?

In reply to Владемир Девятов

Re: $menu, $loggedinas etc.

by Frank Ralf -
Please have a look at this discussion for hints on how to position the fields using CSS:
http://moodle.org/mod/forum/discuss.php?d=128599

And here you will find some more hints on the underlying code in header.html and footer.html:
http://moodle.org/mod/forum/discuss.php?d=138137

CSS FAQ and Themes FAQ are good starting points for learning more about CSS and theming.

hth
Frank