コード例 #1
0
ファイル: template.php プロジェクト: siberlee526/faa7419db
/**
 * Override or insert PHPTemplate variables into the templates.
 */
function deco_preprocess_html(&$vars)
{
    $vars['classes_array'] = isset($vars['classes_array']) ? $vars['classes_array'] : '';
    // variable to see if we have a triple sidebars and are not on block admin page
    $vars['sidebar_triple'] = FALSE;
    // add variable for block admin page
    $vars['block_admin'] = FALSE;
    if (arg(2) == 'block' && arg(3) == FALSE) {
        $vars['block_admin'] = TRUE;
        _deco_alert_layout($vars);
        $vars['classes_array'][] .= ' block-admin';
    } else {
        // convert secondary right sidebar to right sidebar if there's no right sidebar
        if (!empty($vars['page']['sidebar_right_sec']) && empty($vars['page']['sidebar_second'])) {
            $vars['page']['sidebar_second'] = $vars['page']['sidebar_right_sec'];
            $vars['page']['sidebar_right_sec'] = '';
        }
        // set a class on the body to allow easier css themeing based on the layout type
        if (!empty($vars['page']['sidebar_second']) && !empty($vars['page']['sidebar_right_sec']) && !empty($vars['page']['sidebar_first'])) {
            $vars['classes_array'][] .= ' sidebar-triple';
            $vars['sidebar_triple'] = TRUE;
        } elseif (!empty($vars['page']['sidebar_first']) && !empty($vars['page']['sidebar_second'])) {
            $vars['classes_array'][] .= ' sidebar-double';
        } elseif (!empty($vars['page']['sidebar_second']) && !empty($vars['page']['sidebar_right_sec'])) {
            $vars['classes_array'][] .= ' sidebar-right-double';
        } elseif (!empty($vars['page']['sidebar_first'])) {
            $vars['classes_array'][] .= ' sidebar-left';
        } elseif (!empty($vars['page']['sidebar_second']) || !empty($vars['page']['sidebar_right_sec'])) {
            $vars['classes_array'][] .= ' sidebar-right';
        }
        if (!empty($vars['page']['sidebar_second'])) {
            $vars['classes_array'][] .= ' rightbar';
        }
    }
}
コード例 #2
0
ファイル: template.php プロジェクト: k4ml/drupal6-pulut
/**
 * Override or insert PHPTemplate variables into the templates.
 */
function phptemplate_preprocess_page(&$vars)
{
    $vars['body_classes'] = isset($vars['body_classes']) ? $vars['body_classes'] : '';
    // variable to see if we have a triple sidebars and are not on block admin page
    $vars['sidebar_triple'] = FALSE;
    // add variable for block admin page
    $vars['block_admin'] = FALSE;
    if (arg(2) == 'block' && arg(3) == FALSE) {
        $vars['block_admin'] = TRUE;
        _deco_alert_layout($vars);
        $vars['body_classes'] .= ' block-admin';
    } else {
        // convert secondary right sidebar to right sidebar if there's no right sidebar
        if ($vars['sidebar_right_sec'] && empty($vars['sidebar_right'])) {
            $vars['sidebar_right'] = $vars['sidebar_right_sec'];
            $vars['sidebar_right_sec'] = '';
        }
        // set a class on the body to allow easier css themeing based on the layout type
        if ($vars['sidebar_right'] && $vars['sidebar_right_sec'] && $vars['sidebar_left']) {
            $vars['body_classes'] .= ' sidebar-triple';
            $vars['sidebar_triple'] = TRUE;
        } elseif ($vars['sidebar_left'] && $vars['sidebar_right']) {
            $vars['body_classes'] .= ' sidebar-double';
        } elseif ($vars['sidebar_right'] && $vars['sidebar_right_sec']) {
            $vars['body_classes'] .= ' sidebar-right-double';
        } elseif ($vars['sidebar_left']) {
            $vars['body_classes'] .= ' sidebar-left';
        } elseif ($vars['sidebar_right'] || $vars['sidebar_right_sec']) {
            $vars['body_classes'] .= ' sidebar-right';
        }
        // add additional rightbar body class to reduce css to refer to right sidebars
        if ($vars['sidebar_right']) {
            $vars['body_classes'] .= ' rightbar';
        }
    }
    // set variables for the logo and slogan
    $site_fields = array();
    if ($vars['site_name']) {
        $site_fields[] = check_plain($vars['site_name']);
    }
    if ($vars['site_slogan']) {
        $site_fields[] = '- ' . check_plain($vars['site_slogan']);
    }
    $vars['site_title'] = implode(' ', $site_fields);
    if (isset($site_fields[0])) {
        $site_fields[0] = '<span class="site-name">' . $site_fields[0] . '</span>';
    }
    if (isset($site_fields[1])) {
        $site_fields[1] = '<span class="site-slogan">' . $site_fields[1] . '</span>';
    }
    $vars['site_title_html'] = implode(' ', $site_fields);
    // convert primary links to lowercase and secondary links to uppercase
    if ($vars['primary_links']) {
        foreach ($vars['primary_links'] as $key => $link) {
            $vars['primary_links'][$key]['title'] = strtolower($link['title']);
        }
    }
    if ($vars['secondary_links']) {
        foreach ($vars['secondary_links'] as $key => $link) {
            $vars['secondary_links'][$key]['title'] = strtoupper($link['title']);
        }
    }
}