diff options
| author | 2013-06-14 20:45:00 +0200 | |
|---|---|---|
| committer | 2013-06-14 20:45:00 +0200 | |
| commit | 1d459af0464eb2cdbdaaaf1122e1681210fdffea (patch) | |
| tree | a803a6f2fbad70fbbf2bfd6c2a1b33daedbfacca /app/views/index/index.phtml | |
| parent | 746ae4b33a2e7a83d2623291c02d7b4292247103 (diff) | |
Fix issue #75 : chargement des images en lazyload, reste à le rendre optionnel
Diffstat (limited to 'app/views/index/index.phtml')
| -rw-r--r-- | app/views/index/index.phtml | 10 |
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"> |
