# smarty snippet in variabel zuweisen

**URL:** https://forum.shopware.com/t/smarty-snippet-in-variabel-zuweisen/46122
**Category:** Themes & Design
**Created:** [2. Juni 2017 um 08:56 UTC](https://forum.shopware.com/t/smarty-snippet-in-variabel-zuweisen/46122 "2017-06-02T08:56:10Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![wontfix](https://avatars.discourse-cdn.com/v4/letter/w/b19c9b/32.png) [@wontfix](https://forum.shopware.com/u/wontfix)
#### Post date: [2. Juni 2017 um 08:56 UTC](https://forum.shopware.com/t/smarty-snippet-in-variabel-zuweisen/46122/1 "2017-06-02T08:56:10Z")

</div>

wie zuweisen wir eine snippet in eine smarty variabel?  
wie es zbs. mit config möglich ist:

```
{$showAlsoViewed = {config name=similarViewedShow}}

```

> <https://github.com/shopware/shopware/blob/5.2/themes/Frontend/Bare/frontend/detail/index.tpl#L296>

foldendes ist leider ne smarty syntax error:

```
{$myText = false}

{if $foo}
    {$myText = {s namespace="whatever" name="foo"}{/s}}
{elseif $bar}
    {$myText = {s namespace="whatever" name="bar"}}
{/if}
{* hat eigentlich noch mehr ifs *}

{if $myText}
    
        {$mytext}
    
{else}
    {$smarty.block.parent}
{/if}

```

&nbsp;
