Excuse me but $CFG->wwwroot is already defined in YOUR moodle/config.php check it out and see for yourself, so there is no need to change it.
Also the method employed in the example you posted is not recommended as the image is downloaded on each page refresh whereas the CSS image is cached.
Mary