SproutCMS

This is the code documentation for the SproutCMS project

class Skin

Skin stuff - autoversioning mainly.

Extending this class

<?php
/**
* New class description goes here
* 
* @author Your Name, 2024-05-07
**/
class NewClassName extends Skin {
    
    /**
    * Find a template within the current skin.
    **/
    public function findTemplate (mixed $name, mixed $extension) {
        // Method code goes here
    }
    
    /**
    * Return the URL for a JS file in the skin for the current subsite.
    * The URL will have an embedded timestamp.
    * 
    * Usage example:
    *   &lt;script src=&quot;&lt;?php echo Skin::cssUrl('site'); ?&gt;&quot;&gt;&lt;/script&gt;
    **/
    public function jsUrl ($file) {
        // Method code goes here
    }
    
    /**
    * ECHOs one or more &lt;script&gt; tags referring to specified JS files.
    * Uses variable arguments, one per css file.
    * The URLs will contain embedded timestamps, making them auto-versioned
    * 
    * Usage example:
    *   &lt;?php Skin::js('site', 'home'); ?&gt;
    * 
    * Optionally provide an array to specify attributes, like so:
    *   &lt;?php Skin::js('site', 'home', ['crossorigin' =&gt; 'anonymous', 'defer' =&gt; '']); ?&gt;
    * Will return:
    *   &lt;script src=&quot;skin-ts/skin/js/site.js&quot; crossorigin=&quot;anonymous&quot; defer=&quot;&quot;&gt;&lt;/script&gt;
    *   &lt;script src=&quot;skin-ts/skin/js/home.js&quot; crossorigin=&quot;anonymous&quot; defer=&quot;&quot;&gt;&lt;/script&gt;
    * 
    * There isn't a guarantee that multiple tags will be ECHOed, but the order will always remain as specified.
    * If you need more control use the helper `js_url` and echo the tags yourself.
    **/
    public function js () {
        // Method code goes here
    }
    
    /**
    * ECHOs a &lt;link&gt; tag and a &lt;script&gt; tag which point to common.css and common.js respectively.
    **/
    public function common () {
        // Method code goes here
    }
    
    /**
    * ECHOs one or more &lt;link&gt; tags referring to specified CSS files.
    * Uses variable arguments, one per css file.
    * The URLs will contain embedded timestamps, making them auto-versioned
    * 
    * Usage example:
    *   &lt;?php Skin::css('reset', 'layout', 'content'); ?&gt;
    * 
    * Optionally provide an array to specify attributes, like so:
    *   &lt;?php Skin::css('site', 'home', ['crossorigin' =&gt; 'anonymous', 'media' =&gt; 'print']); ?&gt;
    * Will return:
    *   &lt;link href=&quot;skin-ts/skin/css/site.css&quot; rel='stylesheet' media='print'&gt;
    *   &lt;link href=&quot;skin-ts/skin/css/home.css&quot; rel='stylesheet' media='print'&gt;
    * 
    * There isn't a guarantee that multiple tags will be ECHOed, but the order will always remain as specified.
    * If you need more control use the helper `css_url` and echo the tags yourself.
    **/
    public function css () {
        // Method code goes here
    }
    
    /**
    * Return the URL for a CSS file in the skin for the current subsite.
    * The URL will have an embedded timestamp.
    * 
    * Usage example:
    *   &lt;link href=&quot;&lt;?php echo Skin::cssUrl('layout'); ?&gt;&quot; rel=&quot;stylesheet&quot;&gt;
    **/
    public function cssUrl ($file) {
        // Method code goes here
    }
    
    /**
    * ECHOs one or more &lt;link&gt; tags for the module css
    * Uses either modules.css in the the skin css directory or the module.css in the modules media directories
    **/
    public function modules () {
        // Method code goes here
    }
    
}
?>