RomanGraborov
4/7/2016 - 9:18 PM

CSS loader

CSS loader

<script>
    function loadCSS(hf) {
        var ms = document.createElement("link");
        ms.rel = "stylesheet";
        ms.href = hf;
        document.getElementsByTagName("head")[0].appendChild(ms);
    }
    <? if ($_CURENT_PAGE == "index"): ?>
    loadCSS("/mobile/css/index.css");
    <? ELSEIF($_CURENT_PAGE == "catalog" && $ch == 'category'): ?>
    loadCSS("/mobile/css/category.css");
    <? ELSEIF($_CURENT_PAGE == "catalog" && $ch == 'item'): ?>
    loadCSS("/mobile/css/product.css");
    <? ELSEIF($_CURENT_PAGE == "recipes"): ?>
    loadCSS("/mobile/css/category.css");
    <? else :?>
    loadCSS("/mobile/css/page.css");
    <? endif; ?>
</script>