Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation With Templating Examples #13

Closed
23d1 opened this issue May 3, 2016 · 7 comments
Closed

Documentation With Templating Examples #13

23d1 opened this issue May 3, 2016 · 7 comments

Comments

@23d1
Copy link

23d1 commented May 3, 2016

Thanks for a brilliant plugin!

Would love to eventually see some documentation with examples of templating and so forth. Various basic use cases perhaps.

@benjamminf
Copy link
Contributor

benjamminf commented May 3, 2016

Cheers 👍

Absolutely, It's something I'm working on. For the most part it should work the same as Matrix fields. I'm working on having the template API be the same as entries in structures, so at the moment there's not a whole lot of support for handling child blocks. Fun fact though, you can use the {% nav %} tag to output a Neo field.

I actually haven't really advertised this plugin yet for this exact reason, but somehow people have found it, haha.

@smockensturm
Copy link

re: Templating. How do we get to, loop through and render the child blocks?

@smockensturm
Copy link

Right. If we use block.children we get ALL the children regardless of entry.

@smockensturm
Copy link

smockensturm commented May 10, 2016

Here we go:

{% for block in entry.neoContentBlocks  %}
    {% if block.type == 'multiColumn' %}
    {% for col in block.children.ownerId(entry.id).type('column') %}
        ...
    {% endfor %}
    {% endif %}
{% endfor %}

where "multiColumn" is the parent and 'column' the children.

EDIT: nah. still get 'em all. the children don't know who their parent neoBlock is.

@benjamminf
Copy link
Contributor

Hey @smockensturm sorry this has been trouble for you. Frustratingly this feature has been pretty hard to implement, but I've held back from advertising this plugin and writing the docs until it's implemented.

I've just released 1.0.2 which will let you get child blocks in the template, using a temporary API, just so it's usable in the meantime. This temporary API will remain supported throughout the 1.x version. You can now check the README on how to use Neo in your templates.

@smockensturm
Copy link

Fantastic! Works a charm. On behalf of our entire team, we thank you. Looking forward to what you get up to.

@benjamminf
Copy link
Contributor

My pleasure, thanks for using the plugin!

pvldigital added a commit that referenced this issue Sep 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants