snipt

Ctrl+h for KB shortcuts

PHP

Log something in Kohana 3.1

1
2
3
$log = Kohana_Log::instance();
$log->add(Kohana_Log::DEBUG, $sql);
$log->write();
https://snipt.net/embed/5777e8e30809d3c3cccb9bfea3ba1437/
https://snipt.net/raw/5777e8e30809d3c3cccb9bfea3ba1437/
5777e8e30809d3c3cccb9bfea3ba1437
php
PHP
3
2016-09-22T18:38:45
True
False
False
/api/public/snipt/31695/
log-something-in-kohana-31
<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 id="L-1"><a name="L-1"></a><span class="x">$log = Kohana_Log::instance();</span> </span><span id="L-2"><a name="L-2"></a><span class="x">$log-&gt;add(Kohana_Log::DEBUG, $sql);</span> </span><span id="L-3"><a name="L-3"></a><span class="x">$log-&gt;write();</span> </span></pre></div> </td></tr></table>
kohana

PHP

Kohana 3 load view

 $content .= View::factory("user/login.js");
https://snipt.net/embed/2a7ab649107177fb34f31ecb5ac0facb/
https://snipt.net/raw/2a7ab649107177fb34f31ecb5ac0facb/
2a7ab649107177fb34f31ecb5ac0facb
php
PHP
1
2016-09-24T01:28:34
True
False
False
/api/public/snipt/22899/
kohana-3-load-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 id="L-1"><a name="L-1"></a><span class="x"> $content .= View::factory(&quot;user/login.js&quot;);</span> </span></pre></div> </td></tr></table>
kohana, view

PHP

Kohana 3 - redirect request

$this->request->redirect($login_route->uri() );
https://snipt.net/embed/b1e690601d1bc73ed84076f7a7b4829a/
https://snipt.net/raw/b1e690601d1bc73ed84076f7a7b4829a/
b1e690601d1bc73ed84076f7a7b4829a
php
PHP
1
2016-09-21T11:01:17
True
False
False
/api/public/snipt/22898/
kohana-3-redirect-request
<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 id="L-1"><a name="L-1"></a><span class="x">$this-&gt;request-&gt;redirect($login_route-&gt;uri() );</span> </span></pre></div> </td></tr></table>
kohana, redirect

PHP

Kohana 3 get route from bootstrap

 $login_route = Route::get('login');
https://snipt.net/embed/a8f969b17bc05a1c28f83057166f8450/
https://snipt.net/raw/a8f969b17bc05a1c28f83057166f8450/
a8f969b17bc05a1c28f83057166f8450
php
PHP
1
2016-09-23T00:19:27
True
False
False
/api/public/snipt/22897/
kohana-3-get-route-from-bootstrap
<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 id="L-1"><a name="L-1"></a><span class="x"> $login_route = Route::get(&#39;login&#39;);</span> </span></pre></div> </td></tr></table>
bootstrap, kohana, route

PHP

Call a Kohana controller within a controller

//Kohana, call a controller within a controller
Request::factory('internal_user/authenticated/')->execute()->response;
https://snipt.net/embed/5afb43f2ab7e768b078229eba011ad90/
https://snipt.net/raw/5afb43f2ab7e768b078229eba011ad90/
5afb43f2ab7e768b078229eba011ad90
php
PHP
2
2016-09-16T11:03:58
True
False
False
/api/public/snipt/22896/
call-a-kohana-controller-within-a-controller
<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 id="L-1"><a name="L-1"></a><span class="x">//Kohana, call a controller within a controller</span> </span><span id="L-2"><a name="L-2"></a><span class="x">Request::factory(&#39;internal_user/authenticated/&#39;)-&gt;execute()-&gt;response;</span> </span></pre></div> </td></tr></table>
controller, kohana, php

PHP

Kohana 3 Call one controller from another

1
2
3
4
//PHP Kohana 3
//Call one controller from another

$output .= Request::factory("controller/methodName/{$param1}/{$param2}")->execute()->response;
https://snipt.net/embed/e1a6c1d616443d4741794f84ffc98e65/
https://snipt.net/raw/e1a6c1d616443d4741794f84ffc98e65/
e1a6c1d616443d4741794f84ffc98e65
php
PHP
4
2016-09-24T12:02:02
True
False
False
/api/public/snipt/20854/
kohana-3-call-one-controller-from-another
<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 id="L-1"><a name="L-1"></a><span class="x">//PHP Kohana 3</span> </span><span id="L-2"><a name="L-2"></a><span class="x">//Call one controller from another</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="x">$output .= Request::factory(&quot;controller/methodName/{$param1}/{$param2}&quot;)-&gt;execute()-&gt;response;</span> </span></pre></div> </td></tr></table>
controller, kohana, php
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.