Easier to maintain template structure

This the head and footer don't have to be included everytime and the hierarchy is easier to read
This commit is contained in:
Pierre Rudloff 2022-02-03 21:38:29 +01:00
parent de74808459
commit ac8c53375a
11 changed files with 201 additions and 195 deletions

View file

@ -1,8 +1,8 @@
{include file='inc/head.tpl'} {extends file='page.tpl'}
<div class="wrapper"> {block name='main'}
<main class="main error"> <div class="error">
{include file="inc/logo.tpl"} {include file="inc/logo.tpl"}
<h2>{t}An error occurred{/t}</h2> <h2>{t}An error occurred{/t}</h2>
<p><i>{$error|escape|nl2br}</i></p> <p><i>{$error|escape|nl2br}</i></p>
</main> </div>
{include file='inc/footer.tpl'} {/block}

View file

@ -1,5 +1,5 @@
{include file='inc/head.tpl'} {extends file='page.tpl'}
{include file='inc/header.tpl'} {block name='main'}
{include file='inc/logo.tpl'} {include file='inc/logo.tpl'}
<h2 class="titre">{t}Supported websites{/t}</h2> <h2 class="titre">{t}Supported websites{/t}</h2>
<div class="tripleliste"> <div class="tripleliste">
@ -9,4 +9,4 @@
{/foreach} {/foreach}
</ul> </ul>
</div> </div>
{include file='inc/footer.tpl'} {/block}

View file

@ -1,4 +1,3 @@
</div>
<footer class="small-font"> <footer class="small-font">
<div class="footer_wrapper"> <div class="footer_wrapper">
{include file='snippets/dev.tpl' assign=dev} {include file='snippets/dev.tpl' assign=dev}
@ -21,9 +20,3 @@
{t params=['@youtubedl'=>$youtubedl]}Based on @youtubedl{/t} {t params=['@youtubedl'=>$youtubedl]}Based on @youtubedl{/t}
</div> </div>
</footer> </footer>
</div>
{if isset($debug_render)}
{$debug_render->render()}
{/if}
</body>
</html>

View file

@ -1,5 +1,3 @@
<!doctype html>
<html lang="{$locale->getLocale()->getBcp47()}">
<head> <head>
<meta charset="UTF-8"/> <meta charset="UTF-8"/>
<meta name=viewport content="width=device-width, initial-scale=1"/> <meta name=viewport content="width=device-width, initial-scale=1"/>
@ -27,5 +25,3 @@
{$debug_render->renderHead()} {$debug_render->renderHead()}
{/if} {/if}
</head> </head>
<body>
<div class="page {$class}">

View file

@ -27,4 +27,3 @@
</div> </div>
{/if} {/if}
</header> </header>
<div class="wrapper">

View file

@ -1,5 +1,8 @@
<h1 class="logobis"> <h1 class="logobis">
<a class="logocompatible" href="{base_url}"> <a class="logocompatible" href="{base_url}">
<span class="logocompatiblemask"><img src="{base_url}/img/logocompatiblemask.png" width="447" height="107" <span class="logocompatiblemask">
alt="{$config->appName}"/></span> <img src="{base_url}/img/logocompatiblemask.png" width="447" height="107"
</a></h1> alt="{$config->appName}"/>
</span>
</a>
</h1>

View file

@ -1,6 +1,5 @@
{include file='inc/head.tpl'} {extends file='page.tpl'}
{include file='inc/header.tpl'} {block name='main'}
<main class="main">
<div><img class="logo" src="{base_url}/img/logo.png" <div><img class="logo" src="{base_url}/img/logo.png"
alt="{$config->appName}" width="328" height="284"></div> alt="{$config->appName}" width="328" height="284"></div>
<form action="{path_for name="info"}"> <form action="{path_for name="info"}">
@ -20,17 +19,22 @@
{if $config->convert} {if $config->convert}
<div class="mp3 small-font"> <div class="mp3 small-font">
<div class="mp3-inner"> <div class="mp3-inner">
<input type="checkbox" id="audio" class="audio" name="audio" {($config->defaultAudio) ? 'checked' : ''}> <input type="checkbox" id="audio" class="audio"
name="audio" {($config->defaultAudio) ? 'checked' : ''}>
<label for="audio"><span class="ui"></span> <label for="audio"><span class="ui"></span>
{t}Audio only (MP3){/t} {t}Audio only (MP3){/t}
</label> </label>
{if $config->convertSeek} {if $config->convertSeek}
<div class="seekOptions"> <div class="seekOptions">
<label for="from">{t}From{/t}</label> <input type="text" pattern="(\d+:)?(\d+:)?\d+(\.\d+)?" <label for="from">{t}From{/t}</label> <input type="text"
placeholder="HH:MM:SS" value="" name="from" pattern="(\d+:)?(\d+:)?\d+(\.\d+)?"
placeholder="HH:MM:SS" value=""
name="from"
id="from"/> id="from"/>
<label for="to">{t}to{/t}</label> <input type="text" pattern="(\d+:)?(\d+:)?\d+(\.\d+)?" <label for="to">{t}to{/t}</label> <input type="text"
placeholder="HH:MM:SS" value="" name="to" id="to"/> pattern="(\d+:)?(\d+:)?\d+(\.\d+)?"
placeholder="HH:MM:SS" value="" name="to"
id="to"/>
</div> </div>
{/if} {/if}
</div> </div>
@ -44,6 +48,4 @@
<a class="bookmarklet small-font" <a class="bookmarklet small-font"
href="javascript:window.location='{$domain}{path_for name='info' queryParams=['url' => '%url%']}'.replace('%url%', encodeURIComponent(location.href));">{t}Bookmarklet{/t}</a> href="javascript:window.location='{$domain}{path_for name='info' queryParams=['url' => '%url%']}'.replace('%url%', encodeURIComponent(location.href));">{t}Bookmarklet{/t}</a>
</div> </div>
{/block}
</main>
{include file='inc/footer.tpl'}

View file

@ -1,7 +1,6 @@
{include file="inc/head.tpl"} {extends file='page.tpl'}
<div class="wrapper"> {block name='main'}
<div itemscope itemtype="https://schema.org/VideoObject"> <div itemscope itemtype="https://schema.org/VideoObject">
<main class="main">
{include file="inc/logo.tpl"} {include file="inc/logo.tpl"}
{include file='snippets/title.tpl' assign=title} {include file='snippets/title.tpl' assign=title}
<p id="download_intro"> <p id="download_intro">
@ -103,6 +102,5 @@
{/if} {/if}
<input class="downloadBtn" type="submit" value="{t}Download{/t}"/><br/> <input class="downloadBtn" type="submit" value="{t}Download{/t}"/><br/>
</form> </form>
</main>
</div> </div>
{include file="inc/footer.tpl"} {/block}

18
templates/page.tpl Normal file
View file

@ -0,0 +1,18 @@
<!doctype html>
<html lang="{$locale->getLocale()->getBcp47()}">
{include file='inc/head.tpl'}
<body>
<div class="page {$class}">
{include file='inc/header.tpl'}
<div class="wrapper">
<main class="main">
{block name="main"}{/block}
</main>
</div>
{include file='inc/footer.tpl'}
</div>
{if isset($debug_render)}
{$debug_render->render()}
{/if}
</body>
</html>

View file

@ -1,6 +1,5 @@
{include file='inc/head.tpl'} {extends file='page.tpl'}
<div class="wrapper"> {block name='main'}
<main class="main">
{include file="inc/logo.tpl"} {include file="inc/logo.tpl"}
<h2>{t}This video is protected{/t}</h2> <h2>{t}This video is protected{/t}</h2>
<p>{t}You need a password in order to download this video.{/t}</p> <p>{t}You need a password in order to download this video.{/t}</p>
@ -10,5 +9,4 @@
<br/><br/> <br/><br/>
<input class="downloadBtn" type="submit" value="{t}Download{/t}"/> <input class="downloadBtn" type="submit" value="{t}Download{/t}"/>
</form> </form>
</main> {/block}
{include file='inc/footer.tpl'}

View file

@ -1,6 +1,5 @@
{include file="inc/head.tpl"} {extends file='page.tpl'}
<div class="wrapper"> {block name='main'}
<main class="main">
{include file="inc/logo.tpl"} {include file="inc/logo.tpl"}
{if isset($video->title)} {if isset($video->title)}
@ -15,7 +14,8 @@
{/if} {/if}
{foreach $video->entries as $entry} {foreach $video->entries as $entry}
<div class="playlist-entry"> <div class="playlist-entry">
<h3 class="playlist-entry-title"><a target="_blank" href="{strip} <h3 class="playlist-entry-title">
<a target="_blank" href="{strip}
{if isset($entry->ie_key) and $entry->ie_key == Youtube and !filter_var($entry->url, FILTER_VALIDATE_URL)} {if isset($entry->ie_key) and $entry->ie_key == Youtube and !filter_var($entry->url, FILTER_VALIDATE_URL)}
https://www.youtube.com/watch?v= https://www.youtube.com/watch?v=
{/if} {/if}
@ -30,12 +30,11 @@
{else} {else}
{$entry->title} {$entry->title}
{/if} {/if}
</a></h3> </a>
</h3>
<a target="_blank" class="downloadBtn" <a target="_blank" class="downloadBtn"
href="{path_for name="download"}?url={$entry->url}">{t}Download{/t}</a> href="{path_for name="download"}?url={$entry->url}">{t}Download{/t}</a>
<a target="_blank" href="{path_for name="info"}?url={$entry->url}">{t}More options{/t}</a> <a target="_blank" href="{path_for name="info"}?url={$entry->url}">{t}More options{/t}</a>
</div> </div>
{/foreach} {/foreach}
{/block}
</main>
{include file="inc/footer.tpl"}