Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Smarty

CMSMS | mettere in una variabile il path root del sito

//non prende il parametro assign quindi è necessario usare capture
{capture assign='root_url'}{root_url}{/capture}
https://snipt.net/embed/642f890bcd879d56a681dc9800d7d751/
https://snipt.net/raw/642f890bcd879d56a681dc9800d7d751/
642f890bcd879d56a681dc9800d7d751
smarty
Smarty
2
2016-12-02T16:54:35
True
False
False
/api/public/snipt/30913/
cmsms-vettere-in-una-variabile-il-path-root-del-sito
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="x">//non prende il parametro assign quindi è necessario usare capture</span> </span><span id="L-2"><a name="L-2"></a><span class="cp">{</span><span class="nf">capture</span> <span class="na">assign</span><span class="o">=</span><span class="s1">&#39;root_url&#39;</span><span class="cp">}{</span><span class="nf">root_url</span><span class="cp">}{</span><span class="nf">/capture</span><span class="cp">}</span><span class="x"></span> </span></pre></div> </td></tr></table>
cmsms, root, smarty

Smarty

CMSMS | presets NEWS

<!-- visualizza una news a caso dalla categoria data e da tutte le sotto categorie, imposta i template sommario e dettaglio -->
{news number='1' summarytemplate='sommario_ricetta' detailtemplate='dettaglio_ricetta' sortby='random' category='categoria*' detailpage='alias_pagina_dettaglio'}
https://snipt.net/embed/fee745a07facce6621e25570fe8d82e8/
https://snipt.net/raw/fee745a07facce6621e25570fe8d82e8/
fee745a07facce6621e25570fe8d82e8
smarty
Smarty
2
2016-12-02T16:54:53
True
False
False
/api/public/snipt/30608/
cmsms-presets-news
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="x">&lt;!-- visualizza una news a caso dalla categoria data e da tutte le sotto categorie, imposta i template sommario e dettaglio --&gt;</span> </span><span id="L-2"><a name="L-2"></a><span class="cp">{</span><span class="nf">news</span> <span class="na">number</span><span class="o">=</span><span class="s1">&#39;1&#39;</span> <span class="na">summarytemplate</span><span class="o">=</span><span class="s1">&#39;sommario_ricetta&#39;</span> <span class="na">detailtemplate</span><span class="o">=</span><span class="s1">&#39;dettaglio_ricetta&#39;</span> <span class="na">sortby</span><span class="o">=</span><span class="s1">&#39;random&#39;</span> <span class="na">category</span><span class="o">=</span><span class="s1">&#39;categoria*&#39;</span> <span class="na">detailpage</span><span class="o">=</span><span class="s1">&#39;alias_pagina_dettaglio&#39;</span><span class="cp">}</span><span class="x"></span> </span></pre></div> </td></tr></table>
cmsms, news, preset, smarty

Smarty

CMSMS | richiamare attributi di pagina (extra1, extra2, extra3)

1
2
3
{capture assign='extra1'}{$content_obj->GetPropertyValue('extra1')}{/capture}
{capture assign='extra2'}{$content_obj->GetPropertyValue('extra2')}{/capture}
{capture assign='extra3'}{$content_obj->GetPropertyValue('extra3')}{/capture}
https://snipt.net/embed/41737489ac56988151faa68c1ceaadc2/
https://snipt.net/raw/41737489ac56988151faa68c1ceaadc2/
41737489ac56988151faa68c1ceaadc2
smarty
Smarty
3
2016-12-02T16:54:56
True
False
False
/api/public/snipt/30607/
cmsms-richiamare-attributi-di-pagina-extra1-extra2-extra3
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="cp">{</span><span class="nf">capture</span> <span class="na">assign</span><span class="o">=</span><span class="s1">&#39;extra1&#39;</span><span class="cp">}{</span><span class="nv">$content_obj</span><span class="o">-&gt;</span><span class="na">GetPropertyValue</span><span class="o">(</span><span class="s1">&#39;extra1&#39;</span><span class="o">)</span><span class="cp">}{</span><span class="nf">/capture</span><span class="cp">}</span><span class="x"></span> </span><span id="L-2"><a name="L-2"></a><span class="cp">{</span><span class="nf">capture</span> <span class="na">assign</span><span class="o">=</span><span class="s1">&#39;extra2&#39;</span><span class="cp">}{</span><span class="nv">$content_obj</span><span class="o">-&gt;</span><span class="na">GetPropertyValue</span><span class="o">(</span><span class="s1">&#39;extra2&#39;</span><span class="o">)</span><span class="cp">}{</span><span class="nf">/capture</span><span class="cp">}</span><span class="x"></span> </span><span id="L-3"><a name="L-3"></a><span class="cp">{</span><span class="nf">capture</span> <span class="na">assign</span><span class="o">=</span><span class="s1">&#39;extra3&#39;</span><span class="cp">}{</span><span class="nv">$content_obj</span><span class="o">-&gt;</span><span class="na">GetPropertyValue</span><span class="o">(</span><span class="s1">&#39;extra3&#39;</span><span class="o">)</span><span class="cp">}{</span><span class="nf">/capture</span><span class="cp">}</span><span class="x"></span> </span></pre></div> </td></tr></table>
attributi, cmsms, smarty

Smarty

CMSMS | stampa link ai figli di una pagina dato l'alias

1
2
3
4
5
6
7
{content block='aliasPagina' oneline='true' assign='aliasPagina'}
{$cgsimple->get_children($aliasPagina,'',variabile)}
{if count($variabile)}
{foreach from=$variabile item='varIndice'}
<a href="index.php?page={$varIndice.alias}">{$varIndice.title}</a>
{/foreach}
{/if}
https://snipt.net/embed/0ef941dbd3d428e6cc0be5c3489ea2b2/
https://snipt.net/raw/0ef941dbd3d428e6cc0be5c3489ea2b2/
0ef941dbd3d428e6cc0be5c3489ea2b2
smarty
Smarty
7
2016-12-02T07:22:31
True
False
False
/api/public/snipt/30606/
cmsms-stampa-figli-di-una-pagina-dato-lalias
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="cp">{</span><span class="nf">content</span> <span class="na">block</span><span class="o">=</span><span class="s1">&#39;aliasPagina&#39;</span> <span class="na">oneline</span><span class="o">=</span><span class="s1">&#39;true&#39;</span> <span class="na">assign</span><span class="o">=</span><span class="s1">&#39;aliasPagina&#39;</span><span class="cp">}</span><span class="x"></span> </span><span id="L-2"><a name="L-2"></a><span class="cp">{</span><span class="nv">$cgsimple</span><span class="o">-&gt;</span><span class="na">get_children</span><span class="o">(</span><span class="nv">$aliasPagina</span><span class="o">,</span><span class="s1">&#39;&#39;</span><span class="o">,</span><span class="na">variabile</span><span class="o">)</span><span class="cp">}</span><span class="x"></span> </span><span id="L-3"><a name="L-3"></a><span class="cp">{</span><span class="nf">if</span> <span class="na">count</span><span class="o">(</span><span class="nv">$variabile</span><span class="o">)</span><span class="cp">}</span><span class="x"></span> </span><span id="L-4"><a name="L-4"></a><span class="cp">{</span><span class="nf">foreach</span> <span class="na">from</span><span class="o">=</span><span class="nv">$variabile</span> <span class="na">item</span><span class="o">=</span><span class="s1">&#39;varIndice&#39;</span><span class="cp">}</span><span class="x"></span> </span><span id="L-5"><a name="L-5"></a><span class="x">&lt;a href=&quot;index.php?page=</span><span class="cp">{</span><span class="nv">$varIndice.alias</span><span class="cp">}</span><span class="x">&quot;&gt;</span><span class="cp">{</span><span class="nv">$varIndice.title</span><span class="cp">}</span><span class="x">&lt;/a&gt;</span> </span><span id="L-6"><a name="L-6"></a><span class="cp">{</span><span class="nf">/foreach</span><span class="cp">}</span><span class="x"></span> </span><span id="L-7"><a name="L-7"></a><span class="cp">{</span><span class="nf">/if</span><span class="cp">}</span><span class="x"></span> </span></pre></div> </td></tr></table>
alias, cmsms, smarty

Smarty

CMSMS | stampa alias come id del body

<body id="{$page_alias}">
https://snipt.net/embed/2a577b9dec2ee36ecb9cb5baf051e01d/
https://snipt.net/raw/2a577b9dec2ee36ecb9cb5baf051e01d/
2a577b9dec2ee36ecb9cb5baf051e01d
smarty
Smarty
1
2016-12-02T07:22:32
True
False
False
/api/public/snipt/30605/
cmsms-stampa-alias-come-id-del-body
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="x">&lt;body id=&quot;</span><span class="cp">{</span><span class="nv">$page_alias</span><span class="cp">}</span><span class="x">&quot;&gt;</span> </span></pre></div> </td></tr></table>
alias, cmsms, smarty

Smarty

Explode in smarty (split)

{assign var=images value=","|explode:$string_with_commas}
https://snipt.net/embed/faa25fe67813b68ade98c0a6d8d82b2a/
https://snipt.net/raw/faa25fe67813b68ade98c0a6d8d82b2a/
faa25fe67813b68ade98c0a6d8d82b2a
smarty
Smarty
1
2016-12-02T15:39:02
True
False
False
/api/public/snipt/28291/
explode-in-smarty-split
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="cp">{</span><span class="nf">assign</span> <span class="na">var</span><span class="o">=</span><span class="na">images</span> <span class="na">value</span><span class="o">=</span><span class="s2">&quot;,&quot;</span><span class="o">|</span><span class="na">explode</span><span class="o">:</span><span class="nv">$string_with_commas</span><span class="cp">}</span><span class="x"></span> </span></pre></div> </td></tr></table>
explode, smarty

Smarty

smarty debug variable

{$foo|@debug_print_var}
https://snipt.net/embed/807ec8c721ae3af370e5c5e3b664c978/
https://snipt.net/raw/807ec8c721ae3af370e5c5e3b664c978/
807ec8c721ae3af370e5c5e3b664c978
smarty
Smarty
1
2016-12-02T16:55:02
True
False
False
/api/public/snipt/22841/
smarty-debug-variable
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="cp">{</span><span class="nv">$foo</span><span class="o">|@</span><span class="na">debug_print_var</span><span class="cp">}</span><span class="x"></span> </span></pre></div> </td></tr></table>
php, smarty
Copyrighted, illegal, or inappropriate content? Email [email protected].