Concrete5 – Blöcke im Template

Concrete5 wird standardmässig mit verschiedenen “Blöcken” ausgeliefert, welche man auf seiner Seite mit wenigen Klicks einbauen kann. Manchmal möchte man aber einen Block auf sämtlichen Seiten anzeigen. Zum Beispiel eine Navigation. Wie macht man das?

block-in-template

Zwei Möglichkeiten! Mehr auf der nächsten Seite..

Page Defaults

Concrete5 kennt die sogenannten “Page Defaults”. Man findet sie im Dashboard:

page-defaults

Mit einem Klick auf “Defaults” wird der Seiten-Typ und nicht eine Seite bearbeitet. Jegliche Inhalt (Blöcke) der dort hinzugefügt wird, erscheint später auf jeder Seite die neu angelegt wird. Klick man im während dem Bearbeiten eines Seiten-Typs auf einen Block, erscheint folgendens Menü:

setup-child-pages

Diese Funktion ist ganz praktisch, da sie es ermöglicht, die neuen Blöcke in der Seiten-Vorlage auf bereits vorhandenen Seiten zu verteilen. Es ist vermutlich einfacher, wenn die Blöcke in der Vorlage bereits vorhanden sind, bevor man die Seiten anlegt. Die Wahl steht einem aber frei!

Blöcke die per “Page Defaults” hinzugefügt werden, können später vom Benutzer auf jeder Seite bearbeitet werden, wenn man das erweiterte Berechtigungs Modell (advanced permission model) nicht aktiviert. Die erweiterten Berechtigungen sind gut, aber für manch kleine Seite zu komplex. Es gibt noch eine Alternative! Mehr auf dern nächsten Seite..




Seguir leyendo: 1, 2


17 Comments

Here are the autonav attributes and values I found by looking at the code:
controller->orderBy = ‘display_asc’;
//$bt_links->controller->displayUnavailablePages = ‘false’;
$bt_links->controller->displayPages=’second_level’;
$bt_links->controller->displaySubPages = ‘none’;
$bt_links->controller->displaySubPageLevels = ‘enough’;
$bt_links->render(‘view’);
?>

‘orderBy’
‘display_asc’ – in their sitemap order
‘display_desc’ – in reverse sitemap order
‘chrono_desc’ – with the most recent first
‘chrono_asc’ – with the earliest first
‘alpha_asc’ – in alphabetical order
‘alpha_desc’ – in reverse alphabetical order

‘displayUnavailablePages’
?’true’/’false’? (not sure if value be quoted)

‘displayPages’
‘top’ – at the top level
‘second_level’ – at the second level
‘third_level’ – at the third level
‘above’ – at the level above
‘current’ – at the current level
‘below’ – at the level below
‘custom’ – beneath a particular page

‘displaySubPages’
‘none’ – none
‘relevant’ – Relevant sub pages
‘relevant_breadcrumb’ – Display breadcrumb trail
‘all’ – Display all

‘displaySubPageLevels’
‘enough’ – Display sub pages to current
‘enough_plus1’ – Display sub pages to current +1
‘all’ – Display all
‘custom’ – Display a custom amount

‘render’
‘view’ – use default view
‘templates/custom_view’ – apply custom template

I used this method to modify the “full width” page type, adding a phone number above the navigation. But when I view the site following the update, the phone number is located below the navigation. If I go back to the “full width” template, the phone number is in the correct location. Why is it flipping positions on the child pages?

DEUTSCH:
Ich möchte bei einem Theme-Page-Type einen vorgegebenen nicht lösch- oder verschiebbaren Block (z.B. den Blocktyp “Slideshow”) verpassen, welcher aber Einstellbar ist (z.B. Bilderauswahl).

ENGLISH:
How to implement a Blocktype (for example “slideshow”) in a pagetype of a theme permanently which is still customizable (assortment of pictures)?

Hi there!

I defiened a block slideshow on every page using the Page Type method, I also limited the number of Blocks to one (using setBlockLimit), but someone is still able to add more than one block (through deleting and re-adding) as well as blocks of an other type.

is ist possible to prohibit the deleting of the block but still allow to change it (i.e. change the pictures by an other user, not admin).

setBlockLimit only means that there can never be more than one block at the same time. This doesn’t mean that only the admin can remove it or anything like that.

There are some patches in the forums that allow you to specify the block types allowed in an area but as far as I know they never made it into the core.

The only thing you can do out of the box is to use the “advanced permission mode”. Check this site: http://www.concrete5.org/documentation/general-topics/simple-permissions/ There’s a line you have to insert in site/config.php to enable it.

But be careful: The advanced permission mode gives you a lot of power and increases the complexity as well. Just give it a try, you can always remove the line and go back to the basic permission mode if you don’t want to use the advanced settings.

Defaults doesnt really work does it? If Im in page type default and add a html block and some html within it, I’d expect the html that I wrote to be in every page that uses this page type. But it doesn’t do that.

So what exactly default is I dont know and no one has be any to match their description with what it actually does. (same as composer)

That’s probably because you’ve created the page first and then added blocks to the page defaults. Concrete5 can’t know if you’ve manually added that block on the previously created page first in which case it should put the block from page defaults there.

However, when you’re editing the page defaults and add a block, you can click on it again and you’ll see a menu entry which allows you to set up the block on existing pages as well.
Open it and you’ll see a list of all pages from the same type, mark those where you’d like to place the block and you’re done.

Hinterlasse eine Antwort

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *