CFG variable

CFG variable

by Matthew Longman -
Number of replies: 4

Hello, I am creating a new theme in moodle 1.9 for a client and need clarification on how to reference the $CFG variable from a functions.php file included in my theme. 

One function, for instance, generates a language switcher based on the current language. The $CFG variable is required to specify the directory to find the image for the button. 

Adding

require (../../config.php)

To the functions.php file resulted in the header being printed twice, and other flaws. So how do I reference $CFG?

Average of ratings: -
In reply to Matthew Longman

Re: CFG variable

by Matthew Longman -

One interesting note is that the header.php and footer.php in my theme can reference $CFG without error, but if functions.php should try... undefined variable problems.

In reply to Matthew Longman

Re: CFG variable

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

To be perfectly honest your very first job should be to STRONGLY suggest that your clients upgrade to Moodle 2 - Moodle 1.9 has been out of support (including security fixes) for several years, let alone the additional features in Moodle2.

There will be minimal support in terms of plugins etc still being maintained and limited availability of support (even through these forums) for a version so far out of date as many contributors will not have any expertise or experience of issues in 1.9.