evocms-community / pagebuilder

Page Builder for Evolution CMS
29 stars 23 forks source link

Trying to grab content #31

Closed fourroses666 closed 7 years ago

fourroses666 commented 7 years ago

I have started some testsite with ContentBlocks. Its a Onepage site. The blocks/sections need to have an anchor, (scrollto) that anchor name also has to show up in the navigation. When some new block is being added it also is being added in the navigation.

But how can I show it in both the anchor and the navigation? Is it possible to grab content out of ContentBlocks outside ContentBlocks?.

Lets say, grab field "header" out of config file "about".

[[ContentBlocks? &block=`about` &field=`header`]]

    'templates' => [
        'owner' => '@CHUNK cb-about',
        'images' => '@CHUNK cb-about-images'
    ],

    'fields' => [
        'header' => [
            'caption' => 'Header',
            'type'    => 'text',
        ],

        'images' => [
            'caption' => 'Images',
            'type'    => 'group',
            'fields'  => [
                'image' => [
                    'caption' => 'Image',
                    'type'    => 'image'   
                ],
            ],
        ],
    ],
mnoskov commented 7 years ago

I think, better to build nav by javascript. Or you can create custom snippet for this.

Otherwise, it would be great to select "templates set" in snippet parameter. Of course, these templates should be defined in config. For example:

'templates' => [
    'owner' => '@CHUNK cb-about',
    'images' => '@CHUNK cb-about-images'

    // this used by menu builder
    'anchors' => [
        'owner' => '<a href="#about[+iteration+]">About</a>',
    ],
],

In this case snippet call will look like:

[[ContentBlocks? &tplSet=`anchors`]]
mnoskov commented 7 years ago

[+iteration+] placeholder is not exists yet, it's in nearest plan

fourroses666 commented 7 years ago

Cool, I think that will be a great solution. I'm very pleased with contentblocks :)

I don't need the iteration for the navigation I think. It will grab the sortorder of the blocks already? Maybe it can be extended with the sortOrder parameter?

[[ContentBlocks? &tplSet=`anchors` &sortOrder=`ASC`]]

mnoskov commented 7 years ago

Is sorting really needed? It is implied that sorting makes by manager

fourroses666 commented 7 years ago

Ah not really needed. When the templateSet already picks the sortorder of the contentblocks order thats ok.

I was just thinking for other options for the templateSet snippet order.