1

Can someone comment on if there is an advantage over Option 1 vs Option 2 or vice-versa.

Option 1 - Stash with LVs

{exp:stash:set name="product_description"}
{if segment_3 == 'content-management'}{lv_cm}{/if}
{if segment_3 == 'crm'}{lv_crm}{/if}
{if segment_3 == 'project-management'}{lv_pjm}{/if}
{if segment_3 == 'business-intelligence'}{lv_bi}{/if}
{if segment_3 == 'marketing-automation'}{lv_ma}{/if}
{/exp:stash:set}  

{exp:stash:parse}   
<p>{stash:product_description}</p>
{/exp:stash:parse}

Option 2 - Low Variables only

{if segment_3 == 'content-management'}{lv_cm}{/if}
{if segment_3 == 'crm'}{lv_crm}{/if}
{if segment_3 == 'project-management'}{lv_pjm}{/if}
{if segment_3 == 'business-intelligence'}{lv_bi}{/if}
{if segment_3 == 'marketing-automation'}{lv_ma}{/if}

Any advice is appreciated!!

1

There'll be a slight hit to the stash version but if used correctly it can be utilized to cache the results.

So there's plus & minus to both versions.

| improve this answer | |
0

The main advantage of using Stash here is for markup reusability. In your example you've wrapped a simple <p> tag around your product_description variable... In real world use on a large site, that markup might be 50 lines long and be reused in a dozen different templates. Stash allows you to abstract that markup away so that you only need to update it once. In the pure LV approach, you'd need to repeat that markup 5 times.

| 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.