Theme functions

Theme functions

Bjarne Varöystrand གིས-
Number of replies: 9
Hi there!

First post ever, after some lurking in the shadows! མིག་ཁྱབ་
Greate soft...

But i have run in to some minor problems! that i dont realy know how to solve with a custom theme that i'm building དགའ་འཛུམ་ (will be released here when it's ready)

I'm trying to move the;
<?=$homelink ?>
and
<?=$loggedinas ?>
from the footer.html to header.html, since this will better blend in with the rest of the sites layout, but for some reason these two is not printed out in header.html!

Can someone help me out here?
དཔྱ་སྙོམས་ཀྱི་སྐུགས་ཚུ།: -
In reply to Bjarne Varöystrand

Re: Theme functions

Martin Dougiamas གིས-
Core developers གི་པར Documentation writers གི་པར Moodle HQ གི་པར Particularly helpful Moodlers གི་པར Plugin developers གི་པར Testers གི་པར
Unfortunately, those variables are not transferable like that with the current theme code. Sorry.

The new output scheme planned for Moodle 2 (using XML with XSL) will remove these kinds of limitations.
In reply to Martin Dougiamas

Re: Theme functions

Bjarne Varöystrand གིས-
I was affraid for that answer! ;-(

But this could actually be implemented earlier...

if you take a look att how the OpenSource CMS PostNuke is handling the themes today.

It is not the most pretty, and easyest way to skin this cat, but it sure would give developers more freedom to give moodle a uniqe look today, without hindering the plans for Moodle 2.

(BTW
The attached theme.php is from my default theme at PostNuke Sweden

Just my 2 cents དགའ་འཛུམ་

// Bjarne
In reply to Bjarne Varöystrand

Re: Theme functions

Martin Dougiamas གིས-
Core developers གི་པར Documentation writers གི་པར Moodle HQ གི་པར Particularly helpful Moodlers གི་པར Plugin developers གི་པར Testers གི་པར
I'm not sure this is the same problem (the one of variables being available in one place or another).

Most of what is in the Postnuke themes can be done using CSS already, and if I was going further down that kind of route then I would move to real templates like Smarty or something. Moodle's current theme system is something like two years old and a series of quick hacks.

However, rather than too many more quick hacks to evolve the theme system I would rather leapfrog the whole mess and go straight to a clean, standards-based solution with complete flexibility. I'm convinced of XML with XSL and I promise this will happen next year.

In the meantime, though, there is other important work that needs to be done in defining the common interface. This is where my current interests lie. Rather than focussing on the computer-science side of producing thousands of divergent interfaces, designed by thousands of isolated designers, I want to focus (for the next few months) on designing a single excellent interface that works for a very wide variety of people and sites.

Even with a totally flexible theme system there still needs to be a great default design.

So, if you have (or anyone else has) specific good ideas for improving the Moodle interface and functionality then I would very much like to hear them and to join in constructive discussion about these issues (here is a good example). I am much more willing to work on this stuff as it's fairly easy to do with a bit of PHP.

Please, don't understand me as knocking your needs or ideas in any way at all! དགའ་འཛུམ་ I'm really glad you like Moodle enough to use it! I'm just using this opportunity to explain a few of my thoughts about my development priorities.

Cheers!
Martin
In reply to Martin Dougiamas

Re: Theme functions

Bjarne Varöystrand གིས-
Well, what i was aiming at, was to move some of the core functions out of the files, into the theme file, and that way giving guys like me more controll over how things actually is printed for our visitors (i'm a sucker for cusomizing things མིག་ཁྱབ་ )
And i'm not sure if i do agree with you about the fact that most things that i want to do can be done with the help of CSS, not right now at least.

But i do see your point due to the fact that the theming system that is used right now is old, and needs some tweaking to be made up to date.
And i can surely see why you dont want to do a "quick hack" system once again, instead of waiting a while and deliver a more robust theming system later. དགའ་འཛུམ་

I will try to be to some assistance in whatever areas i can, but i have to warn you... i'm known to be a real pain མིག་ཁྱབ་

One thing that has been bothering me the last couple of days is that there is no way to use different icons depending on what theme you choose, this is a thing that could be done rather easy with;
if(file_exists("$CFG->wwwroot/theme/$CFG->theme/pix/help.gif")) {
print /theme//pix/help.gif">
} else {
print /pix/help.gif">
}

Simple thing like this is what realy makes life pleasent for guys like me མིག་ཁྱབ་ And makes it much easyer for devs to actually make implementations of your soft that can be stunning.

And if a thing like this could be introduced, you would be a good way on the road to common UI. Let be on a devs level, but it is a start as a foundation for further development. And the transfer to GUI should be more smooth and easy both for your users, and devs.

The theme that i created, will be posted here for you to test out during the coming week. Hopefully it will be in your liking དགའ་འཛུམ་

And i dont take your comments to be knocking down my needs and ideas དགའ་འཛུམ་ After all development in Open Souce progress better when an open discussion is present མིག་ཁྱབ་ And since i'm new here... i have to learn the dev process... མིག་ཁྱབ་

// Bjarne - with no more cents
In reply to Bjarne Varöystrand

Re: Theme functions

wicked bob གིས-
Hi Bjarne

Moving the $homelink and $loggedinas variables is easy. Simply copy and paste the code in your weblib.php file (located in moodle's lib directory) under the function print_footer() (but not including the line: include ("$CFG->dirroot/theme/$CFG->theme/footer.html"); ) into the function print_header() just before the line: include ("$CFG->dirroot/theme/$CFG->theme/header.html");

Once you have completed this, simply paste the loggedinas or homelink code wherever you want the links to appear in your header file.

Note to Martin: the ability to post just clean text without interpretation would be good or even a [code] tag to preserve tags which weren't meant to be interpreted when posted in forums. This forum keeps messing things up when posting code and makes moodle behave oddly. Thanks for your work to date. ;)

Hope this helps Bjarne. :D
In reply to wicked bob

Re: Theme functions

Martin Dougiamas གིས-
Core developers གི་པར Documentation writers གི་པར Moodle HQ གི་པར Particularly helpful Moodlers གི་པར Plugin developers གི་པར Testers གི་པར
I usually use the <PRE> tag to post code. The "oddness" is probably because you're using "Moodle auto-format" which includes HTML tags but also does other transformations that most non-programmers seem to expect. དགའ་འཛུམ་

However, I think a BBcode format module would be a nice addition if someone wants to send me code for it.
In reply to wicked bob

Re: Theme functions

Bjarne Varöystrand གིས-
It will sure help མིག་ཁྱབ་

Thanks man!

Will keep up my studies of the core files, to learn it. But will still be bugging you wit my stupid questions about silly simple things like this... དགའ་འཛུམ་

// Bjarne
In reply to Bjarne Varöystrand

Re: Theme functions

Terri Teacher གིས-
Instead of XML and that things you are propossing for the new version, id suggest something like the system that EZPublish 2.2.X uses, you´d take a look, but the idea is this, you have a design (a mix between php and html where you can state where things goes); and templates for each "screen".
This allows a complete independence between the logic and the design, wont be that hard to implement and is a proven well working solution.
In reply to Terri Teacher

Re: Theme functions

Martin Dougiamas གིས-
Core developers གི་པར Documentation writers གི་པར Moodle HQ གི་པར Particularly helpful Moodlers གི་པར Plugin developers གི་པར Testers གི་པར
Correct me if I'm wrong, but I think eZ's template system looks more or less like Smarty.

I have been recently considering using Smarty for Moodle 2, depending on the state of XSLT later this year. The trick is to make a system where simple changes (like color schemes) can be done simply, but still allow full customisation of every little item for those who want to get into that. Without losing performance, and without making development painful. དགའ་འཛུམ་