Skip to content

Instantly share code, notes, and snippets.

@GDmac
Created September 7, 2012 17:12
Show Gist options
  • Save GDmac/3667859 to your computer and use it in GitHub Desktop.
Save GDmac/3667859 to your computer and use it in GitHub Desktop.
EE Preload replace double trick

main template

{preload_replace:preload_trick="preload_replace"}
{embed="group/template" preload='{{preload_trick}:pre_url_title="special"}'}

embedded template

if called via embed you can override the preload_replace once more.
It will insert the embed-variable and parse it early.

{embed:preload}
{if segment_3==""}{preload_replace:pre_url_title="fallback"}{/if}
{preload_replace:pre_url_title="{segment_3}"}

{exp:channel:entries url_title="{pre_url_title}" ....

The url_title for the channel:entries tag is now (in order)

  • if a preload replace was supplied in the embed var it will override the pre_url_title
  • else, if segment_3 was set, it will be segment_3
  • else, the default will be 'fallback'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment