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: Can I pass a variable to a snippet using Snippet Sync?

Status Resolved
Add-on / Version
Severity Trivial
EE Version

Kelly Cook

Mar 27, 2013

I have a snippet: {snippet:html-start}
I would like to pass a page_title variable to this snippet that gets added to the html <title> tag.
Is something like this possible? {snippet:html-start page_title="Home"}

#1

BoldMinded (Brian)

Snippet Sync doesn’t provide any additional functionality on top of what EE provides, but you can do this with preload_replace. Snippets can’t accept parameters like embeds can.

{preload_replace:pre-title="foo"}
{snippet:html-start}

Then in the html-start snippet file:

{!-- Set a default --}
{preload_replace:pre-title=""}

... your snippet code ...

{pre-title}
#2

BoldMinded (Brian)

This only works due to how EE’s parsing works: http://www.slideshare.net/lodewijkschutte/parse-order-pro

#3

Kelly Cook

Thanks, that works well!

Login to reply