Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Need help to get started

Status Resolved
Add-on / Version
Severity Trivial
EE Version

Divadeo Online Shops

Nov 14, 2012

Hello,
I would like to achive the following: An editor should add an image to a blogpost where ever it makes sense contentwise. So, no fixed position in the template. I hope to achive this with Template & Snippet Select.

I set up addon and added a snippet called add_image

<div class="{image1_width} columns bild">

    <div id="copyright" class="text-right">© <a href="{image1_original_url}">{image1_photographer}</a>, <a href="{image1_licence_url}">{image1_licence}</a></div>
    <img src="{image1}" />
    <div class="panel"><p>{image1_bu}</p>
</div>

<p> </p>
</div>

I have a channel called blog and a channmel field group called blog_entries.
blog_entries has the fields blog_body and blog_image and a few more for all the fields used in the snippet above.
blog_body is a textarea
blog_image is a Template & Snippet Select field. During set up I added snippet “add_image” under the section “Available Snippets”

Now I publish an entry via Content/Publish in the CP.
I enter text into blog_body and fill out all fields.
Let´s say, I want to place the image after the 2nd paragraph of text. To achive this I add the string {add_image embed="y"} after the 2nd paragraph and enterthe rest of my text.

When I save the entry and let EE render the entry it´s not rendering the entry, but shows it as a normal string like the rest of the text.
So, what do I wrong? I understand, that I nested channel fields within another channel field ( image1_width, image1, etc.. are part of blog_body, but I was under the impression, that Template & Snippet select would do some magic to the standard pare order.

Can you pls give me ashort example on how to use the plugin?

Thanks
awa

 

#1

BoldMinded (Brian)

Hi there. This fieldtype doesn’t really alter the parsing order. It will just insert the snippet into the template wherever the {field_name} tag is. If you’re trying to nest the snippet inside of another content field then it won’t work. Snippets are early parsed global variables, meaning they are parsed before entry fields, thus the {blog_body} field content won’t even be on the page and {add_image embed=”y”} won’t exist yet. Does that make sense?

#2

Divadeo Online Shops

Thanks for the quick answer. I now understand, why my undertaking won´t work. But what I still don´t get is: What can I achive with your plugin? It seems to be a valuable tool, since it has good ratings on devot-ee and people seem to like it. Given my scenario, how can I use the plugin? I think, I don´t get “It allows you to select a template from within your publish field for embedding into the template.”

The “select a template from within your publish field” part: That must be my snippet with the image, caption and credit, right?

The “embedding into the template”-part must be then the “blog/single-entry”-template. This is where I place my single entries. Is this correct?

But what I don´t get is: What do I have to do within the CP and how will this affect the rendering of that single entry?

Do I have to add {add_image embed=”y”} to the single-entry-template and when I choose this template while entering a new blog entry, the image will appear, and if I don´t choose this template the picture will not appear? regards Albert

#3

Brian Litzinger

I use the fieldtype for a couple of main features. I can create a small template with something like the “3 latest news stories” and the client can then embed that anywhere I let them via this fieldtype. I also use it to embed contact forms and such too. Its great for just adding small blocks of content to a page easily without having to add code. Basically it lets you put {embed=”some/template”} wherever you want through the CP.

Yes, your main template will need to have the {field_name embed=”y”} for it to work.

Login to reply