Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

PHP

Zend Auth Custon namspace

1
2
3
4
5
6
7
8
//if you have multiple projects on the same host, you need to specify the zend auth session namespace

<?php
$this->auth = Zend_Auth::getInstance();
$this->auth->setStorage(new Zend_Auth_Storage_Session('Test_User'));
//if (!$this->auth->hasIdentity()) {
//    $this->_redirector->gotoUrl('/entry');
//}
https://snipt.net/embed/ea190294ff4856acef5b41f624aae57e/
https://snipt.net/raw/ea190294ff4856acef5b41f624aae57e/
ea190294ff4856acef5b41f624aae57e
php
PHP
8
2016-12-07T22:32:08
True
False
False
Feb 06, 2013 at 03:09 AM
/api/public/snipt/55283/
zend-auth-custon-namspace
<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="x">//if you have multiple projects on the same host, you need to specify the zend auth session namespace</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="cp">&lt;?php</span> </span><span id="L-4"><a name="L-4"></a><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">auth</span> <span class="o">=</span> <span class="nx">Zend_Auth</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span> </span><span id="L-5"><a name="L-5"></a><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">auth</span><span class="o">-&gt;</span><span class="na">setStorage</span><span class="p">(</span><span class="k">new</span> <span class="nx">Zend_Auth_Storage_Session</span><span class="p">(</span><span class="s1">&#39;Test_User&#39;</span><span class="p">));</span> </span><span id="L-6"><a name="L-6"></a><span class="c1">//if (!$this-&gt;auth-&gt;hasIdentity()) {</span> </span><span id="L-7"><a name="L-7"></a><span class="c1">// $this-&gt;_redirector-&gt;gotoUrl(&#39;/entry&#39;);</span> </span><span id="L-8"><a name="L-8"></a><span class="c1">//}</span> </span></pre></div> </td></tr></table>
namespace, php, session, zend

Text only

Zend render view from view

$this->render('this_controller/_tutorial.phtml');
https://snipt.net/embed/93df4ee775c4846b707c5394ce24aee6/
https://snipt.net/raw/93df4ee775c4846b707c5394ce24aee6/
93df4ee775c4846b707c5394ce24aee6
text
Text only
1
2016-12-02T15:43:35
True
False
False
Jul 31, 2012 at 07:11 AM
/api/public/snipt/44826/
zend-render-view-from-view
<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>$this-&gt;render(&#39;this_controller/_tutorial.phtml&#39;); </span></pre></div> </td></tr></table>
php, zend

PHP

Zend disable from controller layout and view renderer

1
2
3
4
<?php

$this->_helper->layout()->disableLayout();//enableLayout();
 $this->_helper->viewRenderer->setNoRender(true);
https://snipt.net/embed/21572be175a2991d2f952318bc80e806/
https://snipt.net/raw/21572be175a2991d2f952318bc80e806/
21572be175a2991d2f952318bc80e806
php
PHP
4
2016-12-06T11:42:19
True
False
False
/api/public/snipt/36554/
zend-disable-from-controller-layout-and-view-renderer
<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></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><span id="L-3"><a name="L-3"></a><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_helper</span><span class="o">-&gt;</span><span class="na">layout</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">disableLayout</span><span class="p">();</span><span class="c1">//enableLayout();</span> </span><span id="L-4"><a name="L-4"></a> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_helper</span><span class="o">-&gt;</span><span class="na">viewRenderer</span><span class="o">-&gt;</span><span class="na">setNoRender</span><span class="p">(</span><span class="k">true</span><span class="p">);</span> </span></pre></div> </td></tr></table>
layout, view, zend

PHP

zend just number

echo Zend_Filter::filterStatic('abc-123-def-456', 'Digits'); // 123456
https://snipt.net/embed/c5622a951306c5e2f3a5a065249133d4/
https://snipt.net/raw/c5622a951306c5e2f3a5a065249133d4/
c5622a951306c5e2f3a5a065249133d4
php
PHP
1
2016-11-25T13:07:44
True
False
False
/api/public/snipt/26633/
zend-just-number
<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">echo Zend_Filter::filterStatic(&#39;abc-123-def-456&#39;, &#39;Digits&#39;); // 123456</span> </span></pre></div> </td></tr></table>
filter, zend

JavaScript

zend debuggers

1
2
3
4
5
6
die(Zend_Debug::dump($q->getRawSQL() , NULL, false));

die(Zend_Debug::dump($q->execute(array(), Doctrine::HYDRATE_ARRAY), NULL, false));


die(Zend_Debug::dump( $q->fetchList(), NULL, false));
https://snipt.net/embed/81fb826adc16a8d789eeb5d175c7fede/
https://snipt.net/raw/81fb826adc16a8d789eeb5d175c7fede/
81fb826adc16a8d789eeb5d175c7fede
js
JavaScript
6
2016-12-03T03:38:32
True
False
False
/api/public/snipt/19327/
zend-debuggers
<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="nx">die</span><span class="p">(</span><span class="nx">Zend_Debug</span><span class="o">::</span><span class="nx">dump</span><span class="p">(</span><span class="nx">$q</span><span class="o">-&gt;</span><span class="nx">getRawSQL</span><span class="p">()</span> <span class="p">,</span> <span class="nx">NULL</span><span class="p">,</span> <span class="kc">false</span><span class="p">));</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="nx">die</span><span class="p">(</span><span class="nx">Zend_Debug</span><span class="o">::</span><span class="nx">dump</span><span class="p">(</span><span class="nx">$q</span><span class="o">-&gt;</span><span class="nx">execute</span><span class="p">(</span><span class="nx">array</span><span class="p">(),</span> <span class="nx">Doctrine</span><span class="o">::</span><span class="nx">HYDRATE_ARRAY</span><span class="p">),</span> <span class="nx">NULL</span><span class="p">,</span> <span class="kc">false</span><span class="p">));</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a><span class="nx">die</span><span class="p">(</span><span class="nx">Zend_Debug</span><span class="o">::</span><span class="nx">dump</span><span class="p">(</span> <span class="nx">$q</span><span class="o">-&gt;</span><span class="nx">fetchList</span><span class="p">(),</span> <span class="nx">NULL</span><span class="p">,</span> <span class="kc">false</span><span class="p">));</span> </span></pre></div> </td></tr></table>
debuggers, zend
Copyrighted, illegal, or inappropriate content? Email [email protected].