Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Talk:Using images in a theme: Difference between revisions

From MoodleDocs
m (→‎standard.php ??: new section)
Line 38: Line 38:


: If you spot something that is clearly a typo, please just fix it directly. Thanks. Also, I don't think that it matters, for this example, whether the code uses background or gradient.--[[User:Tim Hunt|Tim Hunt]] 14:19, 8 October 2010 (UTC)
: If you spot something that is clearly a typo, please just fix it directly. Thanks. Also, I don't think that it matters, for this example, whether the code uses background or gradient.--[[User:Tim Hunt|Tim Hunt]] 14:19, 8 October 2010 (UTC)
== standard.php ?? ==
The instructions say "open the layout file e.g. standard.php". I don't see any file called standard.php in version 2.2. So what file am I looking for?

Revision as of 17:19, 16 December 2011

Just had a quick browse through this, I have not tested this but are there file extensions missing in the examples?

e.g. - body {background-image:url(gradient);}

shouldn't this read - body {background-image:url(gradient.png);}

--Matthew Cannings

No. It is intentional.

It is not really important for theme images. After all, if you are making a theme, you probably do know what type your images are. However, suppose in your theme you want to override one of the standard icons, for example i/edit. Well, even though the standard images is i/edit.gif, you might want to replace it with i/edit.png in your theme, and you can, and Moodle will find the image as long as it is one of the supported formats. We use the same basic system for all images (theme, core and plugin) so that is why you must not specify the extension when you link to the image, and you can use any format you like.--Tim Hunt 18:50, 10 June 2010 (UTC)

These documents are essentially for developers, but is there going to be a plainer version for us who do not speak the necessary jargon? I have been trying to figure out how to explain this in the Front Page FAQ to provide people looking at Moodle 2.0 with a hope of including their own logos onto their selected themes. Seriously, I do not have either the time or the patience to learn PHP to the point where I might be able to explain it in a non-technical manner. From what I am able to decipher, it might be easier than earlier versions, but I cannot be sure. --Colin Fraser 09:02, 2 October 2010 (UTC)

couple small errors

In the text below, the second "pattern" has no "n", and I believe "background.png" should be "gradient.png".


The above pattern is looked for by Moodle and gets replaced with the correct image URL when found. You should note the following things about this patter when using you own images within CSS:

  1. The bits in black don't change
  2. The bit in blue is the path to your image within the pix directory. It shouldn't start with a / but should end with one.
  3. The bit in green is the filename (no need to include the file extension) 

To use background.png as the background for our pages, add the following line of CSS to the themes core.css.

body {background-image:url(gradient);}


If you spot something that is clearly a typo, please just fix it directly. Thanks. Also, I don't think that it matters, for this example, whether the code uses background or gradient.--Tim Hunt 14:19, 8 October 2010 (UTC)

standard.php ??

The instructions say "open the layout file e.g. standard.php". I don't see any file called standard.php in version 2.2. So what file am I looking for?