Feature #44345
closedbackend_layout: customized width for columns
0%
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
Updated by Den Denyer almost 12 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 :)
Updated by Clément Plou over 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 } } } } }
Updated by Tilo Baller over 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.
Updated by Felix Kopp over 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.
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed