Reference - Single functions - APP


App: tags - Page: examples/dir/2-count
PHP
HTML
examples/dir/2-count.pad
Result
{meta title='Counted and joined', about='The entries are data like any other: a property of the loop, a separator between them.'}
{set $folder = APP . '_data/filesDemo/archive'}
<p>{dir $folder}{first@dir}{count@dir} reports: {/first@dir}{notFirst@dir}, {/notFirst@dir}{$dir}{/dir}</p>


App: tags - Page: examples/exists/1-pair
PHP
HTML
examples/exists/1-pair.pad
Result
{meta title='Content when the file is there', about='The path is used as given - built here from APP, the application\'s directory; @else@ renders when it is missing.'}
{set $notes = APP . '_data/filesDemo/notes.txt'}
{exists $notes}
<p>The notes are there.</p>
@else@
<p>No notes yet.</p>
{/exists}
{set $todo = APP . '_data/filesDemo/todo.txt'}
{exists $todo}
<p>The to-do list is there.</p>
@else@
<p>No to-do list yet.</p>
{/exists}


App: tags - Page: examples/exists/2-directory
PHP
HTML
examples/exists/2-directory.pad
Result
{meta title='A directory counts too', about='file_exists answers TRUE for a directory as well, so the tag cannot tell a file from a folder.'}
{set $archive = APP . '_data/filesDemo/archive'}
{set $old = APP . '_data/filesDemo/old'}
<p>archive: {exists $archive}there@else@missing{/exists}</p>
<p>old: {exists $old}there@else@missing{/exists}</p>