website/public/docs/v3.1.3/API/PHP/VV/root.php

76 lines
No EOL
2.4 KiB
PHP

<?= VV::include("modules/snippet/Snippet.php") ?>
<?php // General information ?>
<section class="md">
<container>
<p>(Vegvisir 3)</p>
<h1><code>VV::root()</code></h1>
<p>Return an absolute path to a file or folder relative from <a href="">project root</a>.</p>
</container>
</section>
<section class="md">
<container>
<h1>Description</h1>
<?= Snippet::put("docs/API/PHP/VV/root/description", Snippet::PHP) ?>
<p>Return an absolute path to a file or folder relative from <a href="">project root</a>. This method does not process the entity at the provided location in any way. It simply returns an absolute path to it, which can be used with other functions.</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 location relative from <a href="">project root</a>. This parameter is an empty string by default, which will return an absolute path to <a href="">project root</a> itself.</p>
<details>
<summary>Example</summary>
<?= Snippet::put("docs/API/PHP/VV/root/0", Snippet::PHP) ?>
</details>
</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>An absolute path to the relative location provided by <a href=""><code>pathname</code></a>.</p>
<details>
<summary>Example</summary>
<?= Snippet::put("docs/API/PHP/VV/root/1", Snippet::PLAINTEXT) ?>
</details>
</container>
</section>
<?php // Examples ?>
<section class="md">
<container>
<h1>Examples</h1>
</container>
</section>
<section class="md inset">
<container>
<h2>Basic usage</h2>
<p><code>VV::root()</code> doesn't do anything on its own other than "convert" a relative path into an absolute one.</p>
<p>This can come in really handy when importing other PHP classes within your project. Let's import a PHP class from one location in the project into a public page.</p>
</container>
</section>
<section class="md inset">
<container>
<?= Snippet::put("docs/API/PHP/VV/root/2", Snippet::PHP) ?>
<p>Let's import and use this class on our page with <code>VV::root()</code>.</p>
<?= Snippet::put("docs/API/PHP/VV/root/3", Snippet::PHP) ?>
</container>
</section>
<?php // Contribute ?>
<?= VV::shell("shells/docs") ?>