mirror of
https://codeberg.org/vegvisir/website.git
synced 2025-09-14 00:43:42 +02:00
71 lines
No EOL
2.3 KiB
PHP
71 lines
No EOL
2.3 KiB
PHP
<?= VV::include("modules/snippet/Snippet.php") ?>
|
|
<?php // General information ?>
|
|
<section class="md">
|
|
<container>
|
|
<p>(Vegvisir 2, Vegvisir 3)</p>
|
|
<h1><code>VV::embed()</code></h1>
|
|
<p>Import and inline the contents of any file without executing code.</p>
|
|
<p>The syntax is identical to <a href=""><code>VV::js()</code></a>, and <a href=""><code>VV::css()</code></a>.</p>
|
|
</container>
|
|
</section>
|
|
<section class="md">
|
|
<container>
|
|
<h1>Description</h1>
|
|
<?= Snippet::put("docs/API/PHP/VV/embed/description", Snippet::PHP) ?>
|
|
<p><code>VV::embed()</code> returns the contents of any file as a string.</p>
|
|
</container>
|
|
</section>
|
|
|
|
<?php // Method parameters ?>
|
|
<section class="md">
|
|
<container>
|
|
<h2>Parameters</h2>
|
|
</container>
|
|
</section>
|
|
<section class="md inset">
|
|
<container>
|
|
<h3><code>pathname</code></h3>
|
|
<p>Path to a file to embed relative from <a href="">project root</a>.</p>
|
|
</container>
|
|
</section>
|
|
<section class="md inset">
|
|
<container>
|
|
<h3><code>relative</code></h3>
|
|
<p>Path provided to <a href=""><code>pathname</code></a> will be a relative when this parameter is <code>true</code> (default). Set to <code>false</code> to make path absolute.</p>
|
|
</container>
|
|
</section>
|
|
|
|
<?php // Method return values ?>
|
|
<section class="md">
|
|
<container>
|
|
<h2>Return values</h2>
|
|
</container>
|
|
</section>
|
|
<section class="md inset">
|
|
<container>
|
|
<h3><code>string</code></h3>
|
|
<p>A string containing the raw contents of the file. File encoding is preserved.</p>
|
|
<p>Will return an empty string if the path provided to <a href=""><code>pathname</code></a> is not a valid file, or if it failed to import.</p>
|
|
</container>
|
|
</section>
|
|
|
|
<?php // Examples ?>
|
|
<section class="md">
|
|
<container>
|
|
<h1>Examples</h1>
|
|
</container>
|
|
</section>
|
|
<section class="md inset">
|
|
<container>
|
|
<h2>Basic usage</h2>
|
|
<p>Here is an example the embeds an SVG file directly on a page.</p>
|
|
<p>This can come in handy for inlining small vector icons.</p>
|
|
<?= Snippet::put("docs/API/PHP/VV/embed/example-1-0", Snippet::PHP) ?>
|
|
<?= Snippet::put("docs/API/PHP/VV/embed/example-1-1", Snippet::PHP) ?>
|
|
<p>By using <code>VV::css()</code> inside a <code class="tag">style</code>, we've enabled this stylesheet for that specific page.</p>
|
|
</container>
|
|
</section>
|
|
|
|
<?php // Contribute ?>
|
|
|
|
<?= VV::shell("shells/docs") ?>
|