snipt

Ctrl+h for KB shortcuts

PHP

Include Wordpress Path

<?php include (TEMPLATEPATH . '/header2.php'); ?>
https://snipt.net/embed/74e84630d10615934ffa3a4f9a18ab86/
/raw/74e84630d10615934ffa3a4f9a18ab86/
74e84630d10615934ffa3a4f9a18ab86
php
PHP
1
2019-08-25T14:50:13
True
False
False
May 29, 2013 at 03:29 PM
/api/public/snipt/62530/
include-wordpress-path
<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;?php</span> <span class="k">include</span> <span class="p">(</span><span class="nx">TEMPLATEPATH</span> <span class="o">.</span> <span class="s1">&#39;/header2.php&#39;</span><span class="p">);</span> <span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
Wordpress, include, path

HTML

jquery include

<script src="//code.jquery.com/jquery.js"></script>
https://snipt.net/embed/e343435daf36524db91ba9797edaa1e4/
/raw/e343435daf36524db91ba9797edaa1e4/
e343435daf36524db91ba9797edaa1e4
html
HTML
1
2019-08-22T22:04:46
True
False
False
/api/public/snipt/27224/
jquery-include
<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="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;//code.jquery.com/jquery.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span> </span></pre></div> </td></tr></table>
include, jquery

PHP

Include a file in the same folder

require_once(dirname(__FILE__) . '/browser.php');
https://snipt.net/embed/1b5e3d3c85a2c16ca8a9e9454b7e2fb7/
/raw/1b5e3d3c85a2c16ca8a9e9454b7e2fb7/
1b5e3d3c85a2c16ca8a9e9454b7e2fb7
php
PHP
1
2019-08-20T17:26:34
True
False
False
/api/public/snipt/24579/
include-a-file-in-the-same-folder
<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="x">require_once(dirname(__FILE__) . &#39;/browser.php&#39;);</span> </span></pre></div> </td></tr></table>
include, php

PHP

testing set_include_path with php

1
2
3
4
5
<?
set_include_path('testinc');
$filename = 'include.txt';
include $filename;
?>
https://snipt.net/embed/619dc524c41a2993798b27553370f88d/
/raw/619dc524c41a2993798b27553370f88d/
619dc524c41a2993798b27553370f88d
php
PHP
5
2019-08-22T07:05:27
True
False
False
/api/public/snipt/10209/
testing-set_include_path-with-php
<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="nb">set_include_path</span><span class="p">(</span><span class="s1">&#39;testinc&#39;</span><span class="p">);</span> </span><span id="L-3"><a name="L-3"></a><span class="nv">$filename</span> <span class="o">=</span> <span class="s1">&#39;include.txt&#39;</span><span class="p">;</span> </span><span id="L-4"><a name="L-4"></a><span class="k">include</span> <span class="nv">$filename</span><span class="p">;</span> </span><span id="L-5"><a name="L-5"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
include, path, php, set, set_include_path

PHP

basic php include

<?php include("custom-includes/main-nav.php");?>
https://snipt.net/embed/23e40a791267ad519bc5b81750134bc2/
/raw/23e40a791267ad519bc5b81750134bc2/
23e40a791267ad519bc5b81750134bc2
php
PHP
1
2019-08-23T02:01:58
True
False
False
/api/public/snipt/3831/
basic-php-include
<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;?php</span> <span class="k">include</span><span class="p">(</span><span class="s2">&quot;custom-includes/main-nav.php&quot;</span><span class="p">);</span><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
include, php