Use template includes

This commit is contained in:
Pierre Rudloff 2016-08-01 01:01:10 +02:00
parent 37c223638d
commit fc73459731
9 changed files with 24 additions and 47 deletions

View file

@ -50,24 +50,13 @@ class FrontController
{ {
$this->container->view->render( $this->container->view->render(
$response, $response,
'head.tpl', 'index.tpl',
array( array(
'convert'=>$this->config->convert,
'class'=>'index', 'class'=>'index',
'description'=>'Easily download videos from Youtube, Dailymotion, Vimeo and other websites.' 'description'=>'Easily download videos from Youtube, Dailymotion, Vimeo and other websites.'
) )
); );
$this->container->view->render(
$response,
'header.tpl'
);
$this->container->view->render(
$response,
'index.tpl',
array(
'convert'=>$this->config->convert
)
);
$this->container->view->render($response, 'footer.tpl');
} }
/** /**
@ -82,24 +71,15 @@ class FrontController
{ {
$this->container->view->render( $this->container->view->render(
$response, $response,
'head.tpl', 'extractors.tpl',
array( array(
'extractors'=>$this->download->listExtractors(),
'class'=>'extractors', 'class'=>'extractors',
'title'=>'Supported websites', 'title'=>'Supported websites',
'description' 'description'
=>'List of all supported websites from which Alltube Download can extract video or audio files' =>'List of all supported websites from which Alltube Download can extract video or audio files'
) )
); );
$this->container->view->render($response, 'header.tpl');
$this->container->view->render($response, 'logo.tpl');
$this->container->view->render(
$response,
'extractors.tpl',
array(
'extractors'=>$this->download->listExtractors()
)
);
$this->container->view->render($response, 'footer.tpl');
} }
/** /**
@ -137,21 +117,14 @@ class FrontController
$video = $this->download->getJSON($params["url"]); $video = $this->download->getJSON($params["url"]);
$this->container->view->render( $this->container->view->render(
$response, $response,
'head.tpl', 'video.tpl',
array( array(
'video'=>$video,
'class'=>'video', 'class'=>'video',
'title'=>$video->title, 'title'=>$video->title,
'description'=>'Download "'.$video->title.'" from '.$video->extractor_key 'description'=>'Download "'.$video->title.'" from '.$video->extractor_key
) )
); );
$this->container->view->render(
$response,
'video.tpl',
array(
'video'=>$video
)
);
$this->container->view->render($response, 'footer.tpl');
} }
} else { } else {
return $response->withRedirect($this->container->get('router')->pathFor('index')); return $response->withRedirect($this->container->get('router')->pathFor('index'));
@ -162,20 +135,13 @@ class FrontController
{ {
$this->container->view->render( $this->container->view->render(
$response, $response,
'head.tpl', 'error.tpl',
array( array(
'errors'=>$exception->getMessage(),
'class'=>'video', 'class'=>'video',
'title'=>'Error' 'title'=>'Error'
) )
); );
$this->container->view->render(
$response,
'error.tpl',
array(
'errors'=>$exception->getMessage()
)
);
$this->container->view->render($response, 'footer.tpl');
return $response->withStatus(500); return $response->withStatus(500);
} }

View file

@ -1,6 +1,7 @@
{include file='inc/head.tpl'}
<div class="wrapper"> <div class="wrapper">
<div class="main error"> <div class="main error">
{include file="logo.tpl"} {include file="inc/logo.tpl"}
<h2>An error occured</h2> <h2>An error occured</h2>
Please check the URL of your video. Please check the URL of your video.
<p><i> <p><i>
@ -10,3 +11,4 @@
{/foreach} {/foreach}
</i></p> </i></p>
</div> </div>
{include file='inc/footer.tpl'}

View file

@ -1,3 +1,6 @@
{include file='inc/head.tpl'}
{include file='inc/header.tpl'}
{include file='inc/logo.tpl'}
<h2 class="titre">Supported websites</h2> <h2 class="titre">Supported websites</h2>
<div class="tripleliste"> <div class="tripleliste">
<ul> <ul>
@ -6,3 +9,4 @@
{/foreach} {/foreach}
</ul> </ul>
</div> </div>
{include file='inc/footer.tpl'}

View file

@ -1,3 +1,5 @@
{include file='inc/head.tpl'}
{include file='inc/header.tpl'}
<div class="main"> <div class="main">
<div><img class="logo" src="{base_url|noscheme}/img/logo.png" <div><img class="logo" src="{base_url|noscheme}/img/logo.png"
alt="AllTube Download" width="328" height="284"></div> alt="AllTube Download" width="328" height="284"></div>
@ -27,3 +29,4 @@
</div> </div>
</div> </div>
{include file='inc/footer.tpl'}

View file

@ -1,7 +1,8 @@
{include file="inc/head.tpl"}
<div class="wrapper"> <div class="wrapper">
<div itemscope itemtype="http://schema.org/VideoObject"> <div itemscope itemtype="http://schema.org/VideoObject">
<div class="main"> <div class="main">
{include file="logo.tpl"} {include file="inc/logo.tpl"}
<p id="download_intro">You are going to download<i itemprop="name"> <p id="download_intro">You are going to download<i itemprop="name">
<a itemprop="url" id="video_link" <a itemprop="url" id="video_link"
data-ext="{$video->ext}" data-ext="{$video->ext}"
@ -86,3 +87,4 @@
{/if} {/if}
</div> </div>
</div> </div>
{include file="inc/footer.tpl"}