2

Is there a way to capture in PHP a post processed version of an embed?

I have a footer embed template. There are 2 rendered states for the footer, user logged in and not. What I would like to do is cache the rendered version of the footer so that it does not need to be reprocessed on every page. The only time that EE processing needs to be done to rerender the template is when the user changes their login state.

I cannot create 2 footers and then do template caching them through EE because the footer contains information unique to each user so the caching needs to be done on per session basis and controlled through PHP.

So what I would like to do is capture the rendered state of the footer into a PHP variable and then store it into memcache. Is this possible?

1

I can't answer your question specifically but here is an alternative that might work...

Take a look at the CE Cache modules and specifically their Partial Caching option using the {exp:ce_cache:escape} tag. The modules offers a memcache driver option.

{exp:ce_cache:escape}
    <p>{if logged_in}Hello {username}{if:else}Please log in{/if}</p>
{/exp:ce_cache:escape}

You can also use the Static driver (which is very fast) and have it only enabled for logged out users with the $config\['ce_cache_fragment_logged_in_only'\] = 'yes'; config setting.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.