demo update
All checks were successful
Build and push / Pulling repo on server (push) Successful in 2s

This commit is contained in:
Chris 2023-10-26 16:41:33 +02:00
parent 12c11b65ba
commit c3fbb0fc67
10 changed files with 38 additions and 24 deletions

View File

@ -238,3 +238,19 @@ function pictshareUploadImage($path,$hash=false)
return $json;
}
function partial($name,$variables=[])
{
$templatefile = ROOT.DS.'templates'.DS.'partials'.DS.$name;
//render template by running include
ob_start();
if(is_array($variables))
extract($variables);
if(file_exists($templatefile))
include($templatefile);
$pagecontent = ob_get_contents();
ob_end_clean();
return $pagecontent;
}

View File

@ -1,3 +1,7 @@
<?php include(ROOT.'/templates/partials/success.html') ?>
<?= partial('success.html',['successTitle'=>'Dies ist ein Titel','successMessage'=>'Erfolgreich']); ?>
<?php include(ROOT.'/templates/partials/error.html') ?>
<?= partial('error.html',['errorMessage'=>'Fehlernacricht ohne titel']); ?>
<?= partial('info.html',['infoTitle'=>'Dies ist ein Info titel','infoMessage'=>'InfoNachricht ist so']); ?>
<?= partial('notice.html',['noticeTitle'=>'Dies ist ein notice titel','noticeMessage'=>'noticeNachricht ist so']); ?>

View File

@ -105,23 +105,17 @@ class Dogs extends Page {
}
else
{
$this->set('errorMessage', 'Die Datei ist zu groß. Bitte eine kleinere Datei hochladen');
$this->set('template', '/templates/partials/error.html');
return;
return partial('error.html', ['errorTitle' => 'Error', 'errorMessage' => 'Die Datei ist zu groß. Bitte eine kleinere Datei hochladen']);
}
}
else
{
$this->set('errorMessage', 'Beim Upload der Datei ist ein Fehler aufgetreten');
$this->set('template', '/templates/partials/error.html');
return;
return partial('error.html', ['errorTitle' => 'Error', 'errorMessage' => 'Beim Upload der Datei ist ein Fehler aufgetreten']);
}
}
else
{
$this->set('errorMessage', 'Dieser Dateityp ist nicht erlaubt. Bitte nur jpg, jpeg oder png Dateien hochladen');
$this->set('template', '/templates/partials/error.html');
return;
return partial('error.html', ['errorTitle' => 'Error', 'errorMessage' => 'Dieser Dateityp ist nicht erlaubt. Bitte nur jpg, jpeg oder png Dateien hochladen']);
}
}

View File

@ -10,12 +10,11 @@
<p class="card-text">
<ul>
<li>Rasse: <?= escape($dogdata['breed'])?:'Nicht eingetragen'; ?></li>
<li>Alter: <?= date_diff(date_create($dogdata['birthday']), date_create('now'))->y ?></li>
<?php if($dogdata['kennel_name']): ?><li>Zuchtname: <?= escape($dogdata['kennel_name']); ?></li> <?php endif; ?>
<?php if($dogdata['size']): ?><li>Größe: <?= escape($dogdata['size']); ?> cm</li> <?php endif; ?>
<?php if($dogdata['agility_size']): ?><li>Agility Größe: <?= escape($dogdata['agility_size']); ?></li> <?php endif; ?>
<li>Rasse: <?= escape($dogdata['breed'])?:'Nicht eingetragen'; ?></li>
<li>Alter: <?= date_diff(date_create($dogdata['birthday']), date_create('now'))->y ?></li>
<?php if($dogdata['kennel_name']): ?><li>Zuchtname: <?= escape($dogdata['kennel_name']); ?></li> <?php endif; ?>
<?php if($dogdata['size']): ?><li>Größe: <?= escape($dogdata['size']); ?> cm</li> <?php endif; ?>
<?php if($dogdata['agility_size']): ?><li>Agility Größe: <?= escape($dogdata['agility_size']); ?></li> <?php endif; ?>
</ul>
<div class="d-flex justify-content-end">

View File

@ -34,7 +34,7 @@
</div>
<div>
<label for="photo" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Photo</label>
<input type="file" id="photo" name="photo" class="" placeholder="Max" required>
<input type="file" accept="image/png, image/jpeg, image/gif" id="photo" name="photo">
</div>
<button type="submit" name="submit" value="true" class="btn btn-primary">Submit</button>
</form>

View File

@ -19,13 +19,13 @@
</main>
<footer class="footer mt-auto py-3 bg-body-tertiary ">
<ul class="nav justify-content-center border-bottom pb-3 mb-3">
<!-- <ul class="nav justify-content-center border-bottom pb-3 mb-3">
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">Home</a></li>
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">Features</a></li>
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">Pricing</a></li>
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">FAQs</a></li>
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">About</a></li>
</ul>
</ul> -->
<p class="text-center text-muted">
© 2023 Crispi
<br/>
@ -35,6 +35,7 @@
<script src="/js/htmx.min.js"></script>
<script src="/js/bootstrap.bundle.min.js"></script>
<script src="/js/color-modes.js"></script>
</body>
</html>

View File

@ -1,4 +1,4 @@
<div class="alert alert-danger" role="alert">
<div class="alert alert-danger animate__animated animate__headShake" role="alert">
<?php if($errorTitle) : ?>
<h4 class="alert-heading"><?= $errorTitle ?></h4>
<?php endif; ?>

View File

@ -1,4 +1,4 @@
<div class="alert alert-info" role="alert">
<div class="alert alert-info animate__animated animate__flash" role="alert">
<?php if($infoTitle) : ?>
<h4 class="alert-heading"><?= $infoTitle ?></h4>
<?php endif; ?>

View File

@ -1,4 +1,4 @@
<div class="alert alert-warning" role="alert">
<div class="alert alert-warning animate__animated animate__jello" role="alert">
<?php if($noticeTitle) : ?>
<h4 class="alert-heading"><?= $noticeTitle ?></h4>
<?php endif; ?>

View File

@ -1,4 +1,4 @@
<div class="alert alert-success" role="alert">
<div class="alert alert-success animate__animated animate__fadeInDown" role="alert">
<?php if($successTitle) : ?>
<h4 class="alert-heading"><?= $successTitle ?></h4>
<?php endif; ?>