snipt

Ctrl+h for KB shortcuts

Text only

twig zebra

<li class="{{ cycle(['even','odd'],loop.index) }}">
https://snippets.siftie.com/embed/110f51fc6f3ab4072625205c51b383c3/
/raw/110f51fc6f3ab4072625205c51b383c3/
110f51fc6f3ab4072625205c51b383c3
text
Text only
1
2019-03-13T19:20:22
True
False
False
Oct 25, 2012 at 05:59 PM
/api/public/snipt/49065/
twig-zebra
<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>&lt;li class=&quot;{{ cycle([&#39;even&#39;,&#39;odd&#39;],loop.index) }}&quot;&gt; </span></pre></div> </td></tr></table>
even, odd, symfony2, twig, zebra

Text only

devel

1
2
3
4
5
6
7
dpr – Shortcut for dprint_r.
dvr – Similar to dpr, but uses var_dump instead of print_r.
dpm – Similar to dpr but print_r's a variable as a message using drupal_set_message.
dvm – Similar to dpm but uses var_dump instead of print_r.

The dpr simply "saves carpal tunnel syndrome" (as the comment for the function in devel.module says) and the dvr function is funky useful as it not only dumps the data but also the data TYPE too (eg, is this variable a integer zero or boolean false?). The dpm and dvm functions are useful as the message only gets printed out on a visible page. This makes form output debuging easier.
*/
https://snippets.siftie.com/embed/92d075f85b347dca057ae2a3b9a53251/
/raw/92d075f85b347dca057ae2a3b9a53251/
92d075f85b347dca057ae2a3b9a53251
text
Text only
7
2019-02-27T05:05:51
True
False
False
/api/public/snipt/39933/
devel
<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></span><span id="L-1"><a name="L-1"></a>dpr – Shortcut for dprint_r. </span><span id="L-2"><a name="L-2"></a>dvr – Similar to dpr, but uses var_dump instead of print_r. </span><span id="L-3"><a name="L-3"></a>dpm – Similar to dpr but print_r&#39;s a variable as a message using drupal_set_message. </span><span id="L-4"><a name="L-4"></a>dvm – Similar to dpm but uses var_dump instead of print_r. </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a>The dpr simply &quot;saves carpal tunnel syndrome&quot; (as the comment for the function in devel.module says) and the dvr function is funky useful as it not only dumps the data but also the data TYPE too (eg, is this variable a integer zero or boolean false?). The dpm and dvm functions are useful as the message only gets printed out on a visible page. This makes form output debuging easier. </span><span id="L-7"><a name="L-7"></a>*/ </span></pre></div> </td></tr></table>
devel, drupal

PHP

taxonomy_node_get_terms_by_vocabulary Drupal 7

1
2
3
4
function _taxonomy_node_get_terms_by_vocabulary($node, $vid, $key = 'tid') {
  $result = db_query('SELECT t.tid, t.* FROM {taxonomy_term_data} t INNER JOIN {taxonomy_index} r ON r.tid = t.tid WHERE t.vid = :vid AND r.nid = :node_nid ORDER BY weight', array(':vid' => $vid, ':node_nid' => $node->nid));
  return $result->fetchAll();
}
https://snippets.siftie.com/embed/a03fcffb98069194c90569ce3092c0ce/
/raw/a03fcffb98069194c90569ce3092c0ce/
a03fcffb98069194c90569ce3092c0ce
php
PHP
4
2019-03-21T16:39:32
True
False
False
/api/public/snipt/39576/
taxonomy_node_get_terms_by_vocabulary-drupal-7
<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="x">function _taxonomy_node_get_terms_by_vocabulary($node, $vid, $key = &#39;tid&#39;) {</span> </span><span id="L-2"><a name="L-2"></a><span class="x"> $result = db_query(&#39;SELECT t.tid, t.* FROM {taxonomy_term_data} t INNER JOIN {taxonomy_index} r ON r.tid = t.tid WHERE t.vid = :vid AND r.nid = :node_nid ORDER BY weight&#39;, array(&#39;:vid&#39; =&gt; $vid, &#39;:node_nid&#39; =&gt; $node-&gt;nid));</span> </span><span id="L-3"><a name="L-3"></a><span class="x"> return $result-&gt;fetchAll();</span> </span><span id="L-4"><a name="L-4"></a><span class="x">}</span> </span></pre></div> </td></tr></table>
"Drupal 7", drupal