Assiging custom CSS classes to tables instead of "maintable"? Assiging custom CSS classes to tables instead of "maintable"?
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Assiging custom CSS classes to tables instead of "maintable"?

Started by thecoalman, August 19, 2005, 02:47:23 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

thecoalman

Is there any way to assign custom css classes to specific tables instead of "maintable"? Specifically I want to assign a class to the breadcrumb table. I'm aware I can edit theme.php and wrap the breadcrub in a custom table but that in turn will still be wrapped by the maintable which won't work for what I'm trying to accomplish.

thecoalman

Nevermind  :) If anyone is interested this is how I did it. Be aware that this works with the standard theme/template files I modified and I'm not sure if has any conflicts with unmodified standard template/theme files.

Open theme.php and find:
EOT;
// HTML template for the breadcrumb
$template_breadcrumb = <<<EOT
<!-- BEGIN breadcrumb -->


Replace with:
EOT;
// HTML template for the breadcrumb
$template_breadcrumb = <<<EOT
<!-- BEGIN breadcrumb -->
<table class="yourcustomclass">


---------------------------------------------------------

Find:
function theme_display_breadcrumb($breadcrumb, &$cat_data)
{
    /**
     * ** added breadcrumb as a seperate element
     */
    global $template_breadcrumb, $lang_breadcrumb;

    starttable('100%');
    if ($breadcrumb) {
        $template = template_extract_block($template_breadcrumb, 'breadcrumb');
        $params = array('{BREADCRUMB}' => $breadcrumb
            );
        echo template_eval($template, $params);
    }
    endtable();
}


Replace with:
function theme_display_breadcrumb($breadcrumb, &$cat_data)
{
    /**
     * ** added breadcrumb as a seperate element
     */
    global $template_breadcrumb, $lang_breadcrumb;


    if ($breadcrumb) {
        $template = template_extract_block($template_breadcrumb, 'breadcrumb');
        $params = array('{BREADCRUMB}' => $breadcrumb
            );
        echo template_eval($template, $params);
    }
    endtable();
}


Pretty simple actually. I tried just wrapping the html template in a table and remove endtable();   but the for whatever reason the closing table tag doesn't appear. The above code seems to work fine. I haven't tried it but it appaers you could do this with any table template. I'm sure this posted before or something similar but I couldn't find it.