Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Text only

Register JS

1
2
3
4
5
	$js = <<<JS
		
JS;

	$this->registerJs($js);
https://snipt.net/embed/675cab96f7025971f25ce9d49158987a/
https://snipt.net/raw/675cab96f7025971f25ce9d49158987a/
675cab96f7025971f25ce9d49158987a
text
Text only
6
2016-12-04T17:05:38
True
False
False
Oct 20, 2016 at 06:29 PM
/api/public/snipt/148028/
register-js
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a> $js = &lt;&lt;&lt;JS </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>JS; </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a> $this-&gt;registerJs($js); </span></pre></div> </td></tr></table>
yii

PHP

Yii base path directory

// Yii::app()->request->scriptFile will return entry script file path.
dirname(Yii::app()->request->scriptFile)
https://snipt.net/embed/f9aa74feff3e30fa9a30096464a4bdf2/
https://snipt.net/raw/f9aa74feff3e30fa9a30096464a4bdf2/
f9aa74feff3e30fa9a30096464a4bdf2
php
PHP
2
2016-12-10T08:47:21
True
False
False
/api/public/snipt/48763/
yii-base-path-directory
<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">// Yii::app()-&gt;request-&gt;scriptFile will return entry script file path.</span> </span><span id="L-2"><a name="L-2"></a><span class="x">dirname(Yii::app()-&gt;request-&gt;scriptFile)</span> </span></pre></div> </td></tr></table>
yii

PHP

SubNav

1
2
3
4
5
6
7
8
<?php
$this -> widget("foundation.widgets.FounSubNav", array('title' => 'Filter:', 'items' => array(
    array('label' => 'All', 'active' => true),
    array('label' => 'Active'),
    array('label' => 'Pending'),
    array('label' => 'Suspended'),
)));
?>
https://snipt.net/embed/53b2d352410d714bca5958a7669c6c6a/
https://snipt.net/raw/53b2d352410d714bca5958a7669c6c6a/
53b2d352410d714bca5958a7669c6c6a
php
PHP
8
2016-12-10T19:27:53
True
False
False
/api/public/snipt/38950/
subnav-3
<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> <a href="#L-8">8</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">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a><span class="nv">$this</span> <span class="o">-&gt;</span> <span class="na">widget</span><span class="p">(</span><span class="s2">&quot;foundation.widgets.FounSubNav&quot;</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;title&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;Filter:&#39;</span><span class="p">,</span> <span class="s1">&#39;items&#39;</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span> </span><span id="L-3"><a name="L-3"></a> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;label&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;All&#39;</span><span class="p">,</span> <span class="s1">&#39;active&#39;</span> <span class="o">=&gt;</span> <span class="k">true</span><span class="p">),</span> </span><span id="L-4"><a name="L-4"></a> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;label&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;Active&#39;</span><span class="p">),</span> </span><span id="L-5"><a name="L-5"></a> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;label&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;Pending&#39;</span><span class="p">),</span> </span><span id="L-6"><a name="L-6"></a> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;label&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;Suspended&#39;</span><span class="p">),</span> </span><span id="L-7"><a name="L-7"></a><span class="p">)));</span> </span><span id="L-8"><a name="L-8"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
foundation, ui, yii

PHP

Nav with inputs

1
2
3
4
5
6
<?php
$this -> widget("foundation.widgets.FounNavBar", array('items' => array(
CHtml::textField("search"),
array('label' => 'Nav Element', 'flyout' => 'content...'),
)));
?>
https://snipt.net/embed/b05d3464cc763fdca9b71bbaffb610e8/
https://snipt.net/raw/b05d3464cc763fdca9b71bbaffb610e8/
b05d3464cc763fdca9b71bbaffb610e8
php
PHP
6
2016-12-10T19:27:57
True
False
False
/api/public/snipt/38949/
-73
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a><span class="nv">$this</span> <span class="o">-&gt;</span> <span class="na">widget</span><span class="p">(</span><span class="s2">&quot;foundation.widgets.FounNavBar&quot;</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;items&#39;</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span> </span><span id="L-3"><a name="L-3"></a><span class="nx">CHtml</span><span class="o">::</span><span class="na">textField</span><span class="p">(</span><span class="s2">&quot;search&quot;</span><span class="p">),</span> </span><span id="L-4"><a name="L-4"></a><span class="k">array</span><span class="p">(</span><span class="s1">&#39;label&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;Nav Element&#39;</span><span class="p">,</span> <span class="s1">&#39;flyout&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;content...&#39;</span><span class="p">),</span> </span><span id="L-5"><a name="L-5"></a><span class="p">)));</span> </span><span id="L-6"><a name="L-6"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
foundation, ui, yii

PHP

FounPagination

1
2
3
4
5
6
7
<?php 
 $pager = new CPagination(60);
 $this->widget("foundation.widgets.FounPager", array(
    "pages" => $pager, 
    "displayFirstAndLast" => true
));
?>
https://snipt.net/embed/fe37efa59a95b332e603ce08d0065bf7/
https://snipt.net/raw/fe37efa59a95b332e603ce08d0065bf7/
fe37efa59a95b332e603ce08d0065bf7
php
PHP
7
2016-12-10T19:28:10
True
False
False
/api/public/snipt/38687/
founpagination
<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">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a> <span class="nv">$pager</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">CPagination</span><span class="p">(</span><span class="mi">60</span><span class="p">);</span> </span><span id="L-3"><a name="L-3"></a> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">widget</span><span class="p">(</span><span class="s2">&quot;foundation.widgets.FounPager&quot;</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span> </span><span id="L-4"><a name="L-4"></a> <span class="s2">&quot;pages&quot;</span> <span class="o">=&gt;</span> <span class="nv">$pager</span><span class="p">,</span> </span><span id="L-5"><a name="L-5"></a> <span class="s2">&quot;displayFirstAndLast&quot;</span> <span class="o">=&gt;</span> <span class="k">true</span> </span><span id="L-6"><a name="L-6"></a><span class="p">));</span> </span><span id="L-7"><a name="L-7"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
foundation, pagination, ui, yii
Copyrighted, illegal, or inappropriate content? Email [email protected].