summaryrefslogtreecommitdiff
path: root/app/views/index
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-06-14 20:45:00 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-06-14 20:45:00 +0200
commit1d459af0464eb2cdbdaaaf1122e1681210fdffea (patch)
treea803a6f2fbad70fbbf2bfd6c2a1b33daedbfacca /app/views/index
parent746ae4b33a2e7a83d2623291c02d7b4292247103 (diff)
Fix issue #75 : chargement des images en lazyload, reste à le rendre optionnel
Diffstat (limited to 'app/views/index')
-rw-r--r--app/views/index/index.phtml10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/views/index/index.phtml b/app/views/index/index.phtml
index 9974a9b0b..7037b2405 100644
--- a/app/views/index/index.phtml
+++ b/app/views/index/index.phtml
@@ -1,4 +1,12 @@
<?php
+function lazyimg($content) {
+ return preg_replace(
+ '/<img([^<]+)src=([\'"])([^"\']*)([\'"])([^<]*)>/i',
+ '<img$1src="' . Url::display('/data/grey.gif') . '" data-original="$3"$5>',
+ $content
+ );
+}
+
$output = Request::param ('output', 'normal');
if ($output == 'rss') {
@@ -58,7 +66,7 @@ if ($output == 'rss') {
<h1 class="title"><?php echo $item->title (); ?></h1>
<?php $author = $item->author (); ?>
<?php echo $author != '' ? '<div class="author">' . Translate::t ('by_author', $author) . '</div>' : ''; ?>
- <?php echo $item->content (); ?>
+ <?php echo lazyimg($item->content ()); ?>
</div>
<ul class="horizontal-list bottom">