You can use:

id.blocks.name.title

Where “title” is a property of the block. And name is the name of your block.

If your name includes spaces:

id.blocks[“name of block”].title

Cheers, Marc



Sent from my iPhone

On 14 Jan 2024, at 09:32, 'Seann Aswell' via Zotonic developers <[email protected]> wrote:


Very interesting...

So, if I add a Header block called "header1" and a Text block called "text1", are those fields directly addressable using something like "blk.name"?

For instance, I see in "_block_view_page_inline.tpl":

    {% for blk in id.blocks %}
        {% if blk.type == "header" %}

Is there a blk.name variable associated with the name of the block added? If so, can you recommend how to address each block via name directly?

What I am hoping to achieve is to have one resource with multiple Header and Text blocks, but I need to address each one directly, to display in a particular place in the HTML layout. However, I am unsure how to display a specific blk by name, rather than listing them all as the above example shows.

The flexibility you built into the system is impressive, but I am still learning my way around...

On Saturday, January 13, 2024 at 5:14:14 AM UTC-7 Marc Worrell wrote:
Another question...

In the admin there is the option of adding content blocks to resources, which seems really handy. 

How can I address the additional blocks in HTML? I am obviously missing something, as I do not see any properties defined in m_rsc regarding content blocks.

Currently on a few webpages, I have added multiple resources and called {id.body} multiple times in HTML to achieve the same affect...

--

---
You received this message because you are subscribed to the Google Groups "Zotonic developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/zotonic-developers/971f861c-3850-4fe1-b1fc-815c4d6ba794n%40googlegroups.com.

--

---
You received this message because you are subscribed to the Google Groups "Zotonic developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/zotonic-developers/f442e3c8-8ef6-4b9a-b8f9-5425de3acbe7n%40googlegroups.com.

--

---
You received this message because you are subscribed to the Google Groups "Zotonic developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/zotonic-developers/859943B7-DBAC-4054-83D4-013D8B9FA0C6%40me.com.

Reply via email to