Project

General

Profile

Actions

Feature #44345

closed

backend_layout: customized width for columns

Added by Uwe Jakobs over 11 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Could have
Assignee:
Category:
Backend User Interface
Target version:
Start date:
2013-01-06
Due date:
% Done:

0%

Estimated time:
PHP Version:
5.3
Tags:
Complexity:
Sprint Focus:

Description

Some editors wanted me to assimilate the columns width in the Backend with the output in Frontend. Since I am using "Backend Layouts" (Grid View), all columns are displayed with an equal width. The backend-Layout is rendered in the class typo3/sysext/backend/Classes/View/PageLayoutView.php, so I had to fiddle around here a little bit.

My small solution could be interesting for the community, so here it is:

in PageLayoutView.php replace lines 534 - 542


    // Add colgroups
    $colCount = intval($parser->setup['backend_layout.']['colCount']);
    $rowCount = intval($parser->setup['backend_layout.']['rowCount']);

    $grid .= '<colgroup>';
        for ($i = 0; $i < $colCount; $i++) {
            $grid .= '<col style="width:' . (100 / $colCount) . '%"></col>';
    }
    $grid .= '</colgroup>';

with these lines:

    // Add colgroups
    $colCount = intval($parser->setup['backend_layout.']['colCount']);
    $rowCount = intval($parser->setup['backend_layout.']['rowCount']);
    $colRatio = $parser->setup['backend_layout.']['colRatio'];

    $grid .= '<colgroup>';
    if ($colRatio){
        $splitRatioArr = explode('|',$colRatio);
        foreach ($splitRatioArr as $colWidth) {
            $grid .= '<col style="width:' . $colWidth . '%"></col>';
        }
    } else {
        for ($i = 0; $i < $colCount; $i++) {
            $grid .= '<col style="width:' . (100 / $colCount) . '%"></col>';
        }
    }
    $grid .= '</colgroup>';

This little exercise gives you the possibility to add a new Element to the backend_layout-Array: it is called colRatio and contains width-ratio in percentages (devided by the Pipe-Symbol |):

backend_layout {
    colCount = 2
    *colRatio = 80|20*
    rowCount = 3
    rows {
        1 {
            columns {
                1 {
                    name = Banner 1
                    colPos = 8
                }
                2 {
                    name = Banner 2
                    rowspan = 3
                    colPos = 9
                }
            }
        }
        2 {
            columns {
                1 {
                    name = Header
                    colPos = 3
                }
            }
        }
        3 {
            columns {
                1 {
                    name = Content
                    colPos = 0
                }
            }
        }
    }
}

Files

backend_layout.JPG (16.3 KB) backend_layout.JPG Uwe Jakobs, 2013-01-06 19:11
Actions #1

Updated by Den Denyer about 11 years ago

  • Target version deleted (6.1.0)

Having just come into this exact problem, this proposal gets +1 from me. I've been so far unable to locate the manual pages detailing how to use backend_layout, my search continues :)

Actions #2

Updated by Clément Plou about 11 years ago

  • Target version set to 4.5.26

As for typo3 4.5, it's possible to set width proportions using colCount = 4 and colspan = 3.

The result here will be a 25% left column and a 75% right column (3/4)

backend_layout {
    colCount = 4
    rowCount = 1
    rows {
        1 {
            columns {
                1 {
                    name = Left column (25%)
                    colPos = 1
                }
                2 {
                    name = main Column (75%)
                    colspan = 3
                    colPos = 0
                }
            }
        }
    }
}
Actions #3

Updated by Tilo Baller almost 11 years ago

The trick proposed by Clément Plou works perfect for me.

@Uwe Jakobs: Can you please have a look at it if it meets your requirements too, so that we can close this issue.

Actions #4

Updated by Felix Kopp almost 11 years ago

  • Status changed from New to Resolved

As mentioned the approach should be to internally use more columns than necessary and then group columns with "colspan"
To solve your demand there is no further technical/code needed.

Actions #5

Updated by Riccardo De Contardi over 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF