snipt

Ctrl+h for KB shortcuts

PHP

Drupal detect front page

1
2
3
4
5
If($is_front){
  // do something;
} else {
  // do something;
}
https://snipt.net/embed/96a770c28a13671f40b0827621e8d608/
/raw/96a770c28a13671f40b0827621e8d608/
96a770c28a13671f40b0827621e8d608
php
PHP
5
2019-06-02T23:11:25
True
False
False
/api/public/snipt/27488/
drupal-detect-front-page
<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><span class="x">If($is_front){</span> </span><span id="L-2"><a name="L-2"></a><span class="x"> // do something;</span> </span><span id="L-3"><a name="L-3"></a><span class="x">} else {</span> </span><span id="L-4"><a name="L-4"></a><span class="x"> // do something;</span> </span><span id="L-5"><a name="L-5"></a><span class="x">}</span> </span></pre></div> </td></tr></table>
drupal6

PHP

Drupal print node array contents

print_r($node);
https://snipt.net/embed/ed6ae1fe421b45cddb5bc2073be318c5/
/raw/ed6ae1fe421b45cddb5bc2073be318c5/
ed6ae1fe421b45cddb5bc2073be318c5
php
PHP
1
2019-05-31T04:58:36
True
False
False
/api/public/snipt/27487/
drupal-print-node-array-contents
<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">print_r($node);</span> </span></pre></div> </td></tr></table>
drupal6

PHP

Drupal 6 Template Views Block Code w/ args

$block['content'] = views_embed_view('my_view_name', 'block', $some_arg);
return $block;
https://snipt.net/embed/cc56d9001c124515b314df025fc7a9ca/
/raw/cc56d9001c124515b314df025fc7a9ca/
cc56d9001c124515b314df025fc7a9ca
php
PHP
2
2019-05-25T09:32:34
True
False
False
/api/public/snipt/27480/
drupal-6-template-views-block-code-w-args
<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">$block[&#39;content&#39;] = views_embed_view(&#39;my_view_name&#39;, &#39;block&#39;, $some_arg);</span> </span><span id="L-2"><a name="L-2"></a><span class="x">return $block;</span> </span></pre></div> </td></tr></table>
drupal6, php

PHP

Drupal 6 Template Block Embed Code

$block = module_invoke('views', 'block' , 'view', 'News-block_1');
print $block['content'];
https://snipt.net/embed/eafc51de4a9c3c06c427b758ee845696/
/raw/eafc51de4a9c3c06c427b758ee845696/
eafc51de4a9c3c06c427b758ee845696
php
PHP
2
2019-06-05T01:18:59
True
False
False
/api/public/snipt/27474/
drupal-6-template-block-embed-code
<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">$block = module_invoke(&#39;views&#39;, &#39;block&#39; , &#39;view&#39;, &#39;News-block_1&#39;);</span> </span><span id="L-2"><a name="L-2"></a><span class="x">print $block[&#39;content&#39;];</span> </span></pre></div> </td></tr></table>
drupal6, php