snipt

Ctrl+h for KB shortcuts

Text only

Git clone from http

$git clone http://example.com/PATH_TO_GIT_FOLDER/.git
https://snipt.net/embed/d2f042a29997f70d950c33e99a7dfbd5/
/raw/d2f042a29997f70d950c33e99a7dfbd5/
d2f042a29997f70d950c33e99a7dfbd5
text
Text only
1
2019-08-18T09:12:38
True
False
False
Feb 11, 2015 at 04:30 PM
/api/public/snipt/104665/
git-clone-from-http
<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>$git clone http://example.com/PATH_TO_GIT_FOLDER/.git </span></pre></div> </td></tr></table>
clone, git

PHP

PHP path arguments for block visibility in Drupal 7

1
2
3
4
5
6
7
8
<?php
global $user;
$uid = $user->uid; // Get the logged in user id
// If the path is 'mypath/myarg' the arg(0) is the 'mypath' and arg(1) is 'myarg'.
$show = (arg(0) == 'mypath') && (arg(1) == $uid); // It must both return TRUE

return $show;
?>
https://snipt.net/embed/e1421b507d61a3d3eacb1213dc44a459/
/raw/e1421b507d61a3d3eacb1213dc44a459/
e1421b507d61a3d3eacb1213dc44a459
php
PHP
8
2019-08-21T04:56:02
True
False
False
Jul 23, 2013 at 05:15 PM
/api/public/snipt/69236/
php-path-arguments-for-block-visibility-in-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> <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;?php</span> </span><span id="L-2"><a name="L-2"></a><span class="k">global</span> <span class="nv">$user</span><span class="p">;</span> </span><span id="L-3"><a name="L-3"></a><span class="nv">$uid</span> <span class="o">=</span> <span class="nv">$user</span><span class="o">-&gt;</span><span class="na">uid</span><span class="p">;</span> <span class="c1">// Get the logged in user id</span> </span><span id="L-4"><a name="L-4"></a><span class="c1">// If the path is &#39;mypath/myarg&#39; the arg(0) is the &#39;mypath&#39; and arg(1) is &#39;myarg&#39;.</span> </span><span id="L-5"><a name="L-5"></a><span class="nv">$show</span> <span class="o">=</span> <span class="p">(</span><span class="nx">arg</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="o">==</span> <span class="s1">&#39;mypath&#39;</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="p">(</span><span class="nx">arg</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="o">==</span> <span class="nv">$uid</span><span class="p">);</span> <span class="c1">// It must both return TRUE</span> </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a><span class="k">return</span> <span class="nv">$show</span><span class="p">;</span> </span><span id="L-8"><a name="L-8"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
"drupal 7", block, php, visibility