website/public/docs/v3.1.3/JS/MODE.php

53 lines
No EOL
1.8 KiB
PHP

<?= VV::include("snippets/docs/v3.1.3/shell") ?>
<main>
<?= VV::include("snippets/docs/version-select"); ?>
<section>
<h1>VV::embed()</h1>
<p>Inline the contents of any file.</p>
<p>This can be very useful for bundling SVGs, plaintext files, HTML, and more for faster page loading.</p>
</section>
<section>
<?= VV::include("elements/HTMLCodeDemoElement?id=docs/v3.1.3/PHP/VV/embed/description") ?>
</section>
<section>
<h1>Parameters</h1>
</section>
<section class="param">
<h3><code class="mtk6">string</code></h3>
<h2><code class="mtk10">$pathname</code></h2>
<p>Path to an asset to inline.</p>
</section>
<section class="param">
<h3><code class="mtk6">bool</code></h3>
<h2><code class="mtk10">$relative</code></h2>
<p>Flag which when set to:</p>
<ol>
<li class="default">
<code class="mtk6">true</code>
<p>Will make <code class="mtk10">$pathname</code> look for a file relative to <a href=""><code>root_path</code></a>.</p>
</li>
<li>
<code class="mtk6">false</code>
<p>Will make <code class="mtk10">$pathname</code> look for a file relative to the root of the whole filesystem.</p>
</li>
</ol>
</section>
<section>
<h1>Return value</h1>
</section>
<section>
<h3><code class="mtk6">string</code></h3>
<p>Returns the contents of a file passed to <code class="mtk10">$pathname</code> as a string. If a file can not be found at <code class="mtk10">$pathname</code>, an empty string is returned.</p>
</section>
<hr>
<section>
<h1>Examples</h1>
</section>
<section>
<h2>Inlining an SVG icon</h2>
<p>In this example we will be inlining an SVG icon from <code>/public/assets/icon.svg</code> directly into our page as if it were hardcoded.</p>
</section>
<section>
<?= VV::include("elements/HTMLCodeDemoElement?id=docs/v3.1.3/PHP/VV/embed/example_import") ?>
</section>
</main>