Problem:
If site is using Theme A, and a teacher sets their course to Theme B, Theme B's header graphics will not show. The source code has all of the tags for Theme B's header graphics, but it is looking for them in Theme A's folder.
Now, this could very well be a problem of the themes Himmat and I have created, as we do similar things, but it might also be a Moodle problem which is why I mention it.
Thanks for any help on this from the higher ups.
Jeff
Hi Jeff,
it could be that you stumbled over the same point as I did.
Please look at my forum post "Linking to the current theme".
I hope you get it that way.
Urs
When using graphics in the header, I was using this format:
<?php echo "$CFG->wwwroot/theme/$CFG->theme/image.jpg" ?>
switched to this as suggested by Urs:
<?php echo $CFG->wwwroot.'/theme/'.current_theme() ?>/image.jpg ?>
and everything works fine.
Jeff
Thanks everyone for helping and using our themes.
Jeff
<?php echo "$CFG->wwwroot/theme/$CFG->theme" ?>
with
<?php echo $CFG->wwwroot.'/theme/'.current_theme() ?>
in the header.html file of the theme
Thanks for the suggestion. This was driving me crazy!
Thanks, this solution worked for me, too! It seems that the quotations around '/theme/' made the difference! Why is adding graphics to headers so difficult?
Here's a link in case you need it! http://moodle.org/mod/forum/more info/discuss.php?d=24190
Thanks again!
Adele
<?php echo "$CFG->wwwroot/theme/$CFG->theme/image.jpg" ?>
switched to this as suggested by Urs:
<?php echo $CFG->wwwroot.'/theme/'.current_theme() ?>/image.jpg ?>
It's because the line is written in php as an echo, Adele.
In the first line <?php echo "$CFG->wwwroot/theme/$CFG->theme/image.jpg" ?> the line is going to echo everything inside the ""
In the second line <?php echo $CFG->wwwroot.'/theme/'.current_theme() ?>/image.jpg ?> the echo command first takes whatever comes out of $CFG->wwwroot, then the . tells the echo command to concatenate it (add it to) whatever comes next, in this case the bit inside the ' ' /theme/ followed by another . to add it to the next part which calls the name of the current theme being used current_theme()
Just for neatness sake I would probably have added the final /image.jpg inside the echo as well giving you
<?php echo $CFG->wwwroot.'/theme/'.current_theme().'/image.jpg' ?>
All this seems to add additional complexity to what should be a straightforward <img> link, but it allows the theme to be renamed (current_theme()) or used on different server setups ($CFG->wwwroot) without having to recode the theme each time.
It does take some getting used to when you start looking at themes, but its well worth getting to know
Hope that explanation helps a bit
Richard
It's not as simple as adding quotations around '/theme/' in the example you linked to, there are other factors at play too.
Here's a link in case you need it!
Mary
Dear sir,
im having a problem with the them i guess nearly the same ive upload a theme and its showing the header and footer but the middle pic and the remain inside nothing plz can u help me to solve it thanks check the site www.websedu.com it as also inside a background and everything none of them are showing only the header and footer and the footer has enlarged