Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Text only

Conditional for Embedding Google Map from PODS custom field

1
2
3
4
5
6
7
<?php
$google_map = $obj->field( 'url_for_google_map', true );

if ( 0 < strlen( $google_map ) ) {
echo '<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="' . $google_map . '&output=embed"></iframe><br /><small><a href="' . $google_map . '&source=embed" style="color:#919191;text-align:left">View Larger Map</a></small>';
};
?>
https://snipt.net/embed/f84b30b282ce53b856156a3788fa9fc6/
https://snipt.net/raw/f84b30b282ce53b856156a3788fa9fc6/
f84b30b282ce53b856156a3788fa9fc6
text
Text only
7
2016-12-07T20:35:50
True
False
False
/api/public/snipt/60330/
conditional-for-embedding-google-map-from-pods-custom-field
<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>&lt;?php </span><span id="L-2"><a name="L-2"></a>$google_map = $obj-&gt;field( &#39;url_for_google_map&#39;, true ); </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a>if ( 0 &lt; strlen( $google_map ) ) { </span><span id="L-5"><a name="L-5"></a>echo &#39;&lt;iframe width=&quot;640&quot; height=&quot;480&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; src=&quot;&#39; . $google_map . &#39;&amp;output=embed&quot;&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;small&gt;&lt;a href=&quot;&#39; . $google_map . &#39;&amp;source=embed&quot; style=&quot;color:#919191;text-align:left&quot;&gt;View Larger Map&lt;/a&gt;&lt;/small&gt;&#39;; </span><span id="L-6"><a name="L-6"></a>}; </span><span id="L-7"><a name="L-7"></a>?&gt; </span></pre></div> </td></tr></table>
"google map", "loop buddy", conditional, php, pods, template

Text only

Getting the path to a PODS Image/File Field and Displaying it if it's not empty

1
2
3
4
5
6
7
<?php
$map_pdf_url = $obj->field( 'map_pdf.guid', true );

if ( 0 < strlen( $map_pdf_url ) ) {
echo '<a href="' . $map_pdf_url . '">Download PDF</a>';
};
?>
https://snipt.net/embed/506a0b70cfbd87afa6ebc68b78d8040d/
https://snipt.net/raw/506a0b70cfbd87afa6ebc68b78d8040d/
506a0b70cfbd87afa6ebc68b78d8040d
text
Text only
7
2016-12-10T07:41:22
True
False
False
/api/public/snipt/60329/
getting-the-path-to-a-pods-imagefile-field-and-displaying-it-if-its-not-empty
<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>&lt;?php </span><span id="L-2"><a name="L-2"></a>$map_pdf_url = $obj-&gt;field( &#39;map_pdf.guid&#39;, true ); </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a>if ( 0 &lt; strlen( $map_pdf_url ) ) { </span><span id="L-5"><a name="L-5"></a>echo &#39;&lt;a href=&quot;&#39; . $map_pdf_url . &#39;&quot;&gt;Download PDF&lt;/a&gt;&#39;; </span><span id="L-6"><a name="L-6"></a>}; </span><span id="L-7"><a name="L-7"></a>?&gt; </span></pre></div> </td></tr></table>
conditional, guid, if, image, php, pods, template

PHP

if PHP conditional

1
2
3
4
if($condicion)
{}
else
{}
https://snipt.net/embed/b79a7ce22990d2c5404bb1b4c3ef42b0/
https://snipt.net/raw/b79a7ce22990d2c5404bb1b4c3ef42b0/
b79a7ce22990d2c5404bb1b4c3ef42b0
php
PHP
4
2016-12-04T08:12:07
True
False
False
/api/public/snipt/42152/
if-php-conditional
<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">if($condicion)</span> </span><span id="L-2"><a name="L-2"></a><span class="x">{}</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">{}</span> </span></pre></div> </td></tr></table>
condicion, conditional, if, php

CSS

css

1
2
3
4
5
6
<!--[if IE]>
   You're using IE!
<![endif]-->
<![if !IE]>
   You're using something else!
<![endif]>
https://snipt.net/embed/a4a5218c9421e3f1d4705c6e2bad6880/
https://snipt.net/raw/a4a5218c9421e3f1d4705c6e2bad6880/
a4a5218c9421e3f1d4705c6e2bad6880
css
CSS
7
2016-12-07T11:38:36
True
False
False
/api/public/snipt/35452/
css-23
<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="o">&lt;!</span><span class="nt">--</span><span class="o">[</span><span class="nt">if</span> <span class="nt">IE</span><span class="o">]&gt;</span> </span><span id="L-2"><a name="L-2"></a> <span class="nt">You</span><span class="s1">&#39;re using IE!</span> </span><span id="L-3"><a name="L-3"></a><span class="s1">&lt;![endif]--&gt;</span> </span><span id="L-4"><a name="L-4"></a><span class="s1">&lt;![if !IE]&gt;</span> </span><span id="L-5"><a name="L-5"></a><span class="s1"> You&#39;</span><span class="nt">re</span> <span class="nt">using</span> <span class="nt">something</span> <span class="nt">else</span><span class="o">!</span> </span><span id="L-6"><a name="L-6"></a><span class="o">&lt;![</span><span class="nt">endif</span><span class="o">]&gt;</span> </span></pre></div> </td></tr></table>
conditional, css, jump
Copyrighted, illegal, or inappropriate content? Email [email protected].