snipt

Ctrl+h for KB shortcuts

PHP

how to call a theme function in drupal

<? theme('name_of_theme_function',$items);
https://snipt.net/embed/dc9702168615721a750230eb5f777603/
/raw/dc9702168615721a750230eb5f777603/
dc9702168615721a750230eb5f777603
php
PHP
1
2019-06-14T21:57:23
True
False
False
/api/public/snipt/2396/
how-to-call-a-theme-function-in-drupal
<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="cp">&lt;?</span> <span class="nx">theme</span><span class="p">(</span><span class="s1">&#39;name_of_theme_function&#39;</span><span class="p">,</span><span class="nv">$items</span><span class="p">);</span> </span></pre></div> </td></tr></table>
drupal, php

PHP

example of a default drupal theme function

1
2
3
4
5
<?
function theme_name_of_theme_function($items = NULL) {
  $output = 'hey, this is some output that gets generated when theme_name_of_theme_function($items) is called from somewhere';
  return $output;
}
https://snipt.net/embed/581e02657be24d26aeebcf3a81cbefcc/
/raw/581e02657be24d26aeebcf3a81cbefcc/
581e02657be24d26aeebcf3a81cbefcc
php
PHP
5
2019-05-27T18:04:45
True
False
False
/api/public/snipt/2395/
example-of-a-default-drupal-theme-function
<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="cp">&lt;?</span> </span><span id="L-2"><a name="L-2"></a><span class="k">function</span> <span class="nf">theme_name_of_theme_function</span><span class="p">(</span><span class="nv">$items</span> <span class="o">=</span> <span class="k">NULL</span><span class="p">)</span> <span class="p">{</span> </span><span id="L-3"><a name="L-3"></a> <span class="nv">$output</span> <span class="o">=</span> <span class="s1">&#39;hey, this is some output that gets generated when theme_name_of_theme_function($items) is called from somewhere&#39;</span><span class="p">;</span> </span><span id="L-4"><a name="L-4"></a> <span class="k">return</span> <span class="nv">$output</span><span class="p">;</span> </span><span id="L-5"><a name="L-5"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
drupal, php

PHP

how to register a drupal 6 theme function

1
2
3
4
5
6
7
8
<?
function name_of_module_theme() {
  return array(
    'name_of_theme_function' => array(
      'arguments' => array('items' => NULL)
    )
  );
}
https://snipt.net/embed/90153e18c041bb6d1ac98ce7224cc6e0/
/raw/90153e18c041bb6d1ac98ce7224cc6e0/
90153e18c041bb6d1ac98ce7224cc6e0
php
PHP
8
2019-06-17T21:29:49
True
False
False
/api/public/snipt/2394/
how-to-register-a-drupal-6-theme-function
<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;?</span> </span><span id="L-2"><a name="L-2"></a><span class="k">function</span> <span class="nf">name_of_module_theme</span><span class="p">()</span> <span class="p">{</span> </span><span id="L-3"><a name="L-3"></a> <span class="k">return</span> <span class="k">array</span><span class="p">(</span> </span><span id="L-4"><a name="L-4"></a> <span class="s1">&#39;name_of_theme_function&#39;</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span> </span><span id="L-5"><a name="L-5"></a> <span class="s1">&#39;arguments&#39;</span> <span class="o">=&gt;</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">NULL</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="p">);</span> </span><span id="L-8"><a name="L-8"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
drupal, php

Text only

example of drupal theme generator owrap url

http://www.mpnnow.com/drupal_owrap
https://snipt.net/embed/5865d8deffff32fd4f624c86a6942782/
/raw/5865d8deffff32fd4f624c86a6942782/
5865d8deffff32fd4f624c86a6942782
text
Text only
1
2019-06-09T23:54:13
True
False
False
/api/public/snipt/2388/
example-of-drupal-theme-generator-owrap-url
<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>http://www.mpnnow.com/drupal_owrap </span></pre></div> </td></tr></table>
drupal

Text only

example of drupal theme generator site id

wicked_local_plymouth
https://snipt.net/embed/d35aabffa4a7d2dd7fb3976fe2c2996f/
/raw/d35aabffa4a7d2dd7fb3976fe2c2996f/
d35aabffa4a7d2dd7fb3976fe2c2996f
text
Text only
1
2019-06-10T00:45:52
True
False
False
/api/public/snipt/2387/
example-of-drupal-theme-generator-site-id
<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>wicked_local_plymouth </span></pre></div> </td></tr></table>
drupal

Text only

drupal theme generator region replacement tag

__%name_of_region%__
https://snipt.net/embed/64e80d8112844748305fdd6eb6450394/
/raw/64e80d8112844748305fdd6eb6450394/
64e80d8112844748305fdd6eb6450394
text
Text only
1
2019-05-18T01:24:57
True
False
False
/api/public/snipt/2386/
drupal-theme-generator-region-replacement-tag
<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>__%name_of_region%__ </span></pre></div> </td></tr></table>
drupal

Text only

drupal theme generator region replacement regex

__%(.+)%__
https://snipt.net/embed/de5fbeaa20bc564d576b1aab6d98b333/
/raw/de5fbeaa20bc564d576b1aab6d98b333/
de5fbeaa20bc564d576b1aab6d98b333
text
Text only
1
2019-05-18T01:24:57
True
False
False
/api/public/snipt/2385/
drupal-theme-generator-region-replacement-regex
<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></pre></div> </td></tr></table>
drupal

PHP

how to print a drupal region in a theme file

<? if ($name_of_new_region) print $name_of_new_region;
https://snipt.net/embed/7cc1893b671638c68a8076ba42939fdc/
/raw/7cc1893b671638c68a8076ba42939fdc/
7cc1893b671638c68a8076ba42939fdc
php
PHP
1
2019-06-02T04:10:10
True
False
False
/api/public/snipt/2384/
how-to-print-a-drupal-region-in-a-theme-file
<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="cp">&lt;?</span> <span class="k">if</span> <span class="p">(</span><span class="nv">$name_of_new_region</span><span class="p">)</span> <span class="k">print</span> <span class="nv">$name_of_new_region</span><span class="p">;</span> </span></pre></div> </td></tr></table>
drupal, php

INI

how to create a region in drupal 6

regions[name_of_new_region] = name of new region
https://snipt.net/embed/6f5598cb7d1931255c18add33d7d7bde/
/raw/6f5598cb7d1931255c18add33d7d7bde/
6f5598cb7d1931255c18add33d7d7bde
ini
INI
1
2019-06-14T14:33:46
True
False
False
/api/public/snipt/2383/
how-to-create-a-region-in-drupal-6
<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="na">regions[name_of_new_region]</span> <span class="o">=</span> <span class="s">name of new region</span> </span></pre></div> </td></tr></table>
drupal, php

PHP

how to create a region in drupal 5

1
2
3
4
5
6
<?
function name_of_theme_regions() {
  return array(
        'name_of_new_region' => t('name of new region'),
   );
}
https://snipt.net/embed/72e26cef854412790f5032e9ec3f1738/
/raw/72e26cef854412790f5032e9ec3f1738/
72e26cef854412790f5032e9ec3f1738
php
PHP
6
2019-05-22T04:53:09
True
False
False
/api/public/snipt/2382/
how-to-create-a-region-in-drupal-5
<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;?</span> </span><span id="L-2"><a name="L-2"></a><span class="k">function</span> <span class="nf">name_of_theme_regions</span><span class="p">()</span> <span class="p">{</span> </span><span id="L-3"><a name="L-3"></a> <span class="k">return</span> <span class="k">array</span><span class="p">(</span> </span><span id="L-4"><a name="L-4"></a> <span class="s1">&#39;name_of_new_region&#39;</span> <span class="o">=&gt;</span> <span class="nx">t</span><span class="p">(</span><span class="s1">&#39;name of new region&#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="p">}</span> </span></pre></div> </td></tr></table>
drupal, php