snipt

Ctrl+h for KB shortcuts

ApacheConf

Ignorando uma pasta no .htaccess

RewriteRule ^nome_pasta/.*$ - [PT]
https://snipt.net/embed/c9dbdb9a708bc98daf7a391d2435f37a/
https://snipt.net/raw/c9dbdb9a708bc98daf7a391d2435f37a/
c9dbdb9a708bc98daf7a391d2435f37a
apacheconf
ApacheConf
1
2016-09-29T14:29:53
True
False
False
/api/public/snipt/44092/
ignorando-uma-pasta-no-htaccess
<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="nb">RewriteRule</span> ^nome_pasta/.*$ - [PT] </span></pre></div> </td></tr></table>
apache, cakephp, mvc, rewrite

PHP

Corrige erros com nomes em português no cakephp bake

1
2
3
4
5
<?php
//Adicione as linhas abaixo no app/config/bootstrap.php
Inflector::rules('singular', array('rules' => array('/^([a-zA-Z_-]*)oes$/i' => '\1ao')));
Inflector::rules('plural', array('rules' => array('/^([a-zA-Z_-]*)ao$/i' => '\1oes')));
?>
https://snipt.net/embed/d50fdfd62bf1b7945ff3da2e10f1e585/
https://snipt.net/raw/d50fdfd62bf1b7945ff3da2e10f1e585/
d50fdfd62bf1b7945ff3da2e10f1e585
php
PHP
5
2016-09-30T18:34:25
True
False
False
/api/public/snipt/28238/
corrige-erros-com-nomes-em-portugues-no-cakephp-bake
<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 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="c1">//Adicione as linhas abaixo no app/config/bootstrap.php</span> </span><span id="L-3"><a name="L-3"></a><span class="nx">Inflector</span><span class="o">::</span><span class="na">rules</span><span class="p">(</span><span class="s1">&#39;singular&#39;</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;rules&#39;</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;/^([a-zA-Z_-]*)oes$/i&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;\1ao&#39;</span><span class="p">)));</span> </span><span id="L-4"><a name="L-4"></a><span class="nx">Inflector</span><span class="o">::</span><span class="na">rules</span><span class="p">(</span><span class="s1">&#39;plural&#39;</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;rules&#39;</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;/^([a-zA-Z_-]*)ao$/i&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;\1oes&#39;</span><span class="p">)));</span> </span><span id="L-5"><a name="L-5"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
cakephp, php

PHP

set the same page title for every action in the controller

1
2
3
4
5
6
7
<?php
//put this method in your controller (or edit your beforeRender() if you already have one)
function beforeRender() {
	parent::beforeRender();
	$this->set('title_for_layout','page title here');
}
?>
https://snipt.net/embed/d38ed508b534d7e45f15c1736fe53775/
https://snipt.net/raw/d38ed508b534d7e45f15c1736fe53775/
d38ed508b534d7e45f15c1736fe53775
php
PHP
7
2016-09-30T18:34:29
True
False
False
/api/public/snipt/28237/
set-the-same-page-title-for-every-action-in-the-controller
<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 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="c1">//put this method in your controller (or edit your beforeRender() if you already have one)</span> </span><span id="L-3"><a name="L-3"></a><span class="k">function</span> <span class="nf">beforeRender</span><span class="p">()</span> <span class="p">{</span> </span><span id="L-4"><a name="L-4"></a> <span class="k">parent</span><span class="o">::</span><span class="na">beforeRender</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">set</span><span class="p">(</span><span class="s1">&#39;title_for_layout&#39;</span><span class="p">,</span><span class="s1">&#39;page title here&#39;</span><span class="p">);</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>
cakephp, php
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.