Skip to content
Snippets Groups Projects
Verified Commit f76f1ff1 authored by David Beniamine's avatar David Beniamine
Browse files

meilleur présentation des articles

parent 05d9a839
No related branches found
No related tags found
No related merge requests found
<?php theme_include('header'); ?>
<section class="content wrap" id="article-<?php echo article_id(); ?>">
<h1><?php echo article_title(); ?></h1>
<h1><?php echo article_img(article_slug());?><?php echo article_title(); ?></h1>
<article>
<?php echo article_markdown(); ?>
<?php echo article_html(); ?>
</article>
<section class="footnote">
<!-- Unfortunately, CSS means everything's got to be inline. -->
<p>Article num&eacute;ro: <?php echo article_number(article_id()); ?>, <?php echo count_words(article_markdown()); ?> mots <?php if(comments_open()): ?>,
<?php echo total_comments();?> <?php echo pluralise(total_comments(), "commentaire", "s") ?> pour le moment.<?php endif; ?> <?php echo article_custom_field('attribution'); ?></p>
<?php echo total_comments();?> <?php echo pluralise(total_comments(), "commentaire", "s") ?>.<?php endif; ?> <?php echo article_custom_field('attribution'); ?></p>
</section>
</section>
......
......@@ -159,12 +159,12 @@ img.picture{
.odd{
float:left;
margin: 0% 2% 0% 0%;
margin: 0% 10% 0% 0%;
}
.even{
float:right;
margin: 0% 0% 0% 2%;
margin: 0% 0% 0% 10%;
}
......
......@@ -11,7 +11,7 @@ function numeral($number, $hideIfOne = false) {
return '';
}
$ext = ((abs($number) % 100 < 21 and abs($number) % 100 > 4) ? 'th' : (($test < 4) ? ($test < 3) ? ($test < 2) ? ($test < 1) ? 'th' : 'st' : 'nd' : 'rd' : 'th'));
$ext = $number == 1 ? 'er' : 'ème';
return $number . $ext;
}
......@@ -97,3 +97,17 @@ function social_list($properties) {
function total_articles() {
return Post::where(Base::table('posts.status'), '=', 'published')->count();
}
function article_img_url($slug){
return '/img/blog/'.$slug.'.png';
}
function article_has_img($slug){
return file_exists('.'.article_img_url($slug));
}
function article_img($slug){
if(article_has_img($slug)){
echo '<img class="picture odd" src="'.article_img_url($slug).'" />';
}
}
......@@ -6,28 +6,14 @@
<ul class="items">
<?php posts(); ?>
<li>
<article class="wrap">
<h1>
<a href="<?php echo article_url(); ?>" title="<?php echo article_title(); ?>"><?php echo article_title(); ?></a>
</h1>
<div class="content">
<?php echo article_html(); ?>
</div>
<footer>
Posté <time datetime="<?php echo date(DATE_W3C, article_time()); ?>"><?php echo relative_time(article_time()); ?></time> par <?php echo article_author('real_name'); ?>.
</footer>
</article>
<h1> Dernier article </h1>
<?php include("single_article.php"); ?>
</li>
<h1> Articles précédents </h1>
<?php $i = 0; while(posts()): ?>
<?php $bg = sprintf('background: hsl(215, 28%%, %d%%);', round(((++$i / posts_per_page()) * 20) + 20)); ?>
<?php $bg = sprintf('background: hsl(132, 22%%, %d%%);', round(((++$i / posts_per_page()) * 20) + 20)); ?>
<li style="<?php echo $bg; ?>">
<article class="wrap">
<h2>
<a href="<?php echo article_url(); ?>" title="<?php echo article_title(); ?>"><?php echo article_title(); ?></a>
</h2>
</article>
<?php include("single_article.php"); ?>
</li>
<?php endwhile; ?>
</ul>
......
<article class="wrap">
<h2>
<a href="<?php echo article_url(); ?>" title="<?php echo article_title(); ?>"><?php echo article_img(article_slug());?><?php echo article_title(); ?></a>
</h2>
<div class="contents">
<?php echo article_description(); ?>
</div>
<footer>
<p>Article num&eacute;ro: <?php echo article_number(article_id()); ?>, <?php echo count_words(article_markdown()); ?> mots <?php if(comments_open()): ?>,
<?php echo total_comments();?> <?php echo pluralise(total_comments(), "commentaire", "s") ?>.<?php endif; ?> <?php echo article_custom_field('attribution'); ?></p>
Posté <time datetime="<?php echo date(DATE_W3C, article_time()); ?>"><?php echo relative_time(article_time()); ?></time> par <?php echo article_author('real_name'); ?>.
</footer>
</article>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment