]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Refactored the daily column generation (only one loop) 83/head
authorFlorian Eula <eula.florian@gmail.com>
Mon, 22 Dec 2014 16:11:53 +0000 (17:11 +0100)
committerFlorian Eula <eula.florian@gmail.com>
Thu, 25 Dec 2014 00:10:58 +0000 (01:10 +0100)
index.php
tpl/daily.html

index 02a6725f918767b8164e91f2d5aa5a877d35a0c5..b280ee9b4d54d2df4511ebea2bad234635d7cce3 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1173,10 +1173,7 @@ function showDaily()
     $PAGE = new pageBuilder;
     $PAGE->assign('linksToDisplay',$linksToDisplay);
     $PAGE->assign('linkcount',count($LINKSDB));
-    $PAGE->assign('col1',$columns[0]);
-    $PAGE->assign('col1',$columns[0]);
-    $PAGE->assign('col2',$columns[1]);
-    $PAGE->assign('col3',$columns[2]);
+    $PAGE->assign('cols', $columns);
     $PAGE->assign('day',utf8_encode(strftime('%A %d, %B %Y',linkdate2timestamp($day.'_000000'))));
     $PAGE->assign('previousday',$previousday);
     $PAGE->assign('nextday',$nextday);
index c15a70629662d0b146c4f8f90ff993766a173a5a..b92425b558b2ea076696cf5262e3156fed5800b1 100644 (file)
@@ -7,7 +7,7 @@
     <div class="dailyAbout">
       All links of one day<br>in a single page.<br>
          {if="$previousday"} <a href="?do=daily&day={$previousday}"><b>&lt;</b>Previous day</a>{else}<b>&lt;</b>Previous day{/if}
-         - 
+         -
          {if="$nextday"}<a href="?do=daily&day={$nextday}">Next day<b>&gt;</b></a>{else}Next day<b>&gt;</b>{/if}
       <br><br>
          <a href="?do=dailyrss" title="1 RSS entry per day"><img src="images/feed-icon-14x14.png#">Daily RSS Feed</a>
     <div class="dailyTitle"><img src="../images/floral_left.png" width="51" height="50" class="nomobile"> The Daily Shaarli <img src="../images/floral_right.png" width="51" height="50" class="nomobile"></div>
     <div class="dailyDate"><span class="nomobile">&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;</span> {$day} <span class="nomobile">&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;</span></div>
     <div class="clear"></div>
-    
-    {if="$linksToDisplay"}
-        <div id="daily_col1">
-        {loop="col1"}
-        <div class="dailyEntry">
-            <div class="dailyEntryPermalink"><a href="?{$value.linkdate|smallHash}"><img src="../images/squiggle2.png" width="25" height="26" title="permalink" alt="permalink"></a></div>
-            {if="$value.tags"}<div class="dailyEntryTags">{loop="value.taglist"}{$value|htmlspecialchars} - {/loop}</div>{/if}
-            <div class="dailyEntryTitle"><a href="{$value.url}">{$value.title|htmlspecialchars}</a></div>
-            {if="$value.thumbnail"}<div class="dailyEntryThumbnail">{$value.thumbnail}</div>{/if}
-            <div class="dailyEntryDescription">{$value.formatedDescription}</div>
-        </div>
-        {/loop}
-        </div>
 
-        <div id="daily_col2">
-        {loop="col2"}
-        <div class="dailyEntry">
-            <div class="dailyEntryPermalink"><a href="?{$value.linkdate|smallHash}"><img src="../images/squiggle2.png" width="25" height="26" title="permalink" alt="permalink"></a></div>
-            {if="$value.tags"}<div class="dailyEntryTags">{loop="value.taglist"}{$value|htmlspecialchars} - {/loop}</div>{/if}
-            <div class="dailyEntryTitle"><a href="{$value.url}">{$value.title|htmlspecialchars}</a></div>
-            {if="$value.thumbnail"}<div class="dailyEntryThumbnail">{$value.thumbnail}</div>{/if}
-            <div class="dailyEntryDescription">{$value.formatedDescription}</div>
-        </div>
-        {/loop}
-        </div>    
-
-        <div id="daily_col3">
-        {loop="col3"}
-        <div class="dailyEntry">
-            <div class="dailyEntryPermalink"><a href="?{$value.linkdate|smallHash}"><img src="../images/squiggle2.png" width="25" height="26" title="permalink" alt="permalink"></a></div>
-            {if="$value.tags"}<div class="dailyEntryTags">{loop="value.taglist"}{$value|htmlspecialchars} - {/loop}</div>{/if}
-            <div class="dailyEntryTitle"><a href="{$value.url}">{$value.title|htmlspecialchars}</a></div>
-            {if="$value.thumbnail"}<div class="dailyEntryThumbnail">{$value.thumbnail}</div>{/if}
-            <div class="dailyEntryDescription">{$value.formatedDescription}</div>
-        </div>
+    {if="$linksToDisplay"}
+        {loop="cols"}
+            {if="isset($value[0])"}
+            <div id="daily_col{$counter+1}">
+                {loop="value"}
+                    {$link=$value}
+                    <div class="dailyEntry">
+                        <div class="dailyEntryPermalink">
+                            <a href="?{$link.linkdate|smallHash}">
+                                <img src="../images/squiggle2.png" width="25" height="26" title="permalink" alt="permalink">
+                            </a>
+                        </div>
+                        {if="$link.tags"}
+                            <div class="dailyEntryTags">
+                                {loop="link.taglist"}
+                                    {$value|htmlspecialchars} -
+                                {/loop}
+                            </div>
+                        {/if}
+                        <div class="dailyEntryTitle">
+                            <a href="{$link.url}">{$link.title|htmlspecialchars}</a>
+                        </div>
+                        {if="$link.thumbnail"}
+                            <div class="dailyEntryThumbnail">{$link.thumbnail}</div>
+                        {/if}
+                        <div class="dailyEntryDescription">{$link.formatedDescription}</div>
+                    </div>
+                {/loop}
+            </div>
+            {/if}
         {/loop}
-        </div>        
     {else}
          <div class="dailyNoEntry">No articles on this day.</div>
     {/if}