snipt

Ctrl+h for KB shortcuts

Text only

Check if logged in

1
2
3
4
5
6
7
$user = JFactory::getUser();
if($user->id){
      // do something because user is logged in
}
esle{
      // do something because user is not logged in
}
https://snipt.net/embed/36ab338cb18ebbd002ec051fca5afe19/
/raw/36ab338cb18ebbd002ec051fca5afe19/
36ab338cb18ebbd002ec051fca5afe19
text
Text only
7
2019-08-19T16:45:55
True
False
False
Dec 03, 2013 at 06:10 AM
/api/public/snipt/98156/
check-if-logged-in
<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>$user = JFactory::getUser(); </span><span id="L-2"><a name="L-2"></a>if($user-&gt;id){ </span><span id="L-3"><a name="L-3"></a> // do something because user is logged in </span><span id="L-4"><a name="L-4"></a>} </span><span id="L-5"><a name="L-5"></a>esle{ </span><span id="L-6"><a name="L-6"></a> // do something because user is not logged in </span><span id="L-7"><a name="L-7"></a>} </span></pre></div> </td></tr></table>
joomla, login, user

PHP

Module position count

1
2
3
4
5
<?php if ($this->countModules( 'position' )) : ?>
  <div>
    <jdoc:include type="modules" name="position" />
  </div>
<?php endif; ?>
https://snipt.net/embed/fb456f32b8fe58fb96fbd70db002da6e/
/raw/fb456f32b8fe58fb96fbd70db002da6e/
fb456f32b8fe58fb96fbd70db002da6e
php
PHP
5
2019-08-19T20:06:20
True
False
False
Sep 25, 2013 at 02:25 PM
/api/public/snipt/67730/
module-position-count
<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;?php</span> <span class="k">if</span> <span class="p">(</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">countModules</span><span class="p">(</span> <span class="s1">&#39;position&#39;</span> <span class="p">))</span> <span class="o">:</span> <span class="cp">?&gt;</span><span class="x"></span> </span><span id="L-2"><a name="L-2"></a><span class="x"> &lt;div&gt;</span> </span><span id="L-3"><a name="L-3"></a><span class="x"> &lt;jdoc:include type=&quot;modules&quot; name=&quot;position&quot; /&gt;</span> </span><span id="L-4"><a name="L-4"></a><span class="x"> &lt;/div&gt;</span> </span><span id="L-5"><a name="L-5"></a><span class="cp">&lt;?php</span> <span class="k">endif</span><span class="p">;</span> <span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
count, joomla, module, position, template

Text only

K2 Introtext word limit

<?php echo K2HelperUtilities::wordLimit($this->item->introtext, 50); ?>
https://snipt.net/embed/3acf78fd50c687d499793263d7493433/
/raw/3acf78fd50c687d499793263d7493433/
3acf78fd50c687d499793263d7493433
text
Text only
1
2019-08-16T15:31:27
True
False
False
Jun 28, 2013 at 09:15 AM
/api/public/snipt/65945/
k2-introtext-word-limit
<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;?php echo K2HelperUtilities::wordLimit($this-&gt;item-&gt;introtext, 50); ?&gt; </span></pre></div> </td></tr></table>
introtext, joomla, k2, wordlimit

CSS

box-shadow left right bottom

1
2
3
-moz-box-shadow: 0px 3px 8px rgb(100,100,100);
-webkit-box-shadow: 0px 3px 8px rgb(100,100,100);
box-shadow: 0px 3px 8px rgb(100,100,100);
https://snipt.net/embed/87ad7bdc47afaa066d95c5ad4c1bdcc6/
/raw/87ad7bdc47afaa066d95c5ad4c1bdcc6/
87ad7bdc47afaa066d95c5ad4c1bdcc6
css
CSS
3
2019-08-17T05:44:38
True
False
False
Jun 12, 2013 at 03:34 AM
/api/public/snipt/63912/
box-shadow-left-right-bottom
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nt">-moz-box-shadow</span><span class="o">:</span> <span class="nt">0px</span> <span class="nt">3px</span> <span class="nt">8px</span> <span class="nt">rgb</span><span class="o">(</span><span class="nt">100</span><span class="o">,</span><span class="nt">100</span><span class="o">,</span><span class="nt">100</span><span class="o">);</span> </span><span id="L-2"><a name="L-2"></a><span class="nt">-webkit-box-shadow</span><span class="o">:</span> <span class="nt">0px</span> <span class="nt">3px</span> <span class="nt">8px</span> <span class="nt">rgb</span><span class="o">(</span><span class="nt">100</span><span class="o">,</span><span class="nt">100</span><span class="o">,</span><span class="nt">100</span><span class="o">);</span> </span><span id="L-3"><a name="L-3"></a><span class="nt">box-shadow</span><span class="o">:</span> <span class="nt">0px</span> <span class="nt">3px</span> <span class="nt">8px</span> <span class="nt">rgb</span><span class="o">(</span><span class="nt">100</span><span class="o">,</span><span class="nt">100</span><span class="o">,</span><span class="nt">100</span><span class="o">);</span> </span></pre></div> </td></tr></table>
box-shadow, css