Merge pull request #83 from pikzen/loop-factor

Refactored the daily column generation (only one loop)
This commit is contained in:
nodiscc 2014-12-25 01:15:14 +01:00
commit 169512f0b8
2 changed files with 32 additions and 40 deletions

View file

@ -1173,10 +1173,7 @@ function showDaily()
$PAGE = new pageBuilder; $PAGE = new pageBuilder;
$PAGE->assign('linksToDisplay',$linksToDisplay); $PAGE->assign('linksToDisplay',$linksToDisplay);
$PAGE->assign('linkcount',count($LINKSDB)); $PAGE->assign('linkcount',count($LINKSDB));
$PAGE->assign('col1',$columns[0]); $PAGE->assign('cols', $columns);
$PAGE->assign('col1',$columns[0]);
$PAGE->assign('col2',$columns[1]);
$PAGE->assign('col3',$columns[2]);
$PAGE->assign('day',utf8_encode(strftime('%A %d, %B %Y',linkdate2timestamp($day.'_000000')))); $PAGE->assign('day',utf8_encode(strftime('%A %d, %B %Y',linkdate2timestamp($day.'_000000'))));
$PAGE->assign('previousday',$previousday); $PAGE->assign('previousday',$previousday);
$PAGE->assign('nextday',$nextday); $PAGE->assign('nextday',$nextday);

View file

@ -7,7 +7,7 @@
<div class="dailyAbout"> <div class="dailyAbout">
All links of one day<br>in a single page.<br> 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="$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} {if="$nextday"}<a href="?do=daily&day={$nextday}">Next day<b>&gt;</b></a>{else}Next day<b>&gt;</b>{/if}
<br><br> <br><br>
<a href="?do=dailyrss" title="1 RSS entry per day"><img src="images/feed-icon-14x14.png#">Daily RSS Feed</a> <a href="?do=dailyrss" title="1 RSS entry per day"><img src="images/feed-icon-14x14.png#">Daily RSS Feed</a>
@ -15,43 +15,38 @@
<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="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="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> <div class="clear"></div>
{if="$linksToDisplay"} {if="$linksToDisplay"}
<div id="daily_col1"> {loop="cols"}
{loop="col1"} {if="isset($value[0])"}
<div class="dailyEntry"> <div id="daily_col{$counter+1}">
<div class="dailyEntryPermalink"><a href="?{$value.linkdate|smallHash}"><img src="../images/squiggle2.png" width="25" height="26" title="permalink" alt="permalink"></a></div> {loop="value"}
{if="$value.tags"}<div class="dailyEntryTags">{loop="value.taglist"}{$value|htmlspecialchars} - {/loop}</div>{/if} {$link=$value}
<div class="dailyEntryTitle"><a href="{$value.url}">{$value.title|htmlspecialchars}</a></div> <div class="dailyEntry">
{if="$value.thumbnail"}<div class="dailyEntryThumbnail">{$value.thumbnail}</div>{/if} <div class="dailyEntryPermalink">
<div class="dailyEntryDescription">{$value.formatedDescription}</div> <a href="?{$link.linkdate|smallHash}">
</div> <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} {/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>
{/loop}
</div>
{else} {else}
<div class="dailyNoEntry">No articles on this day.</div> <div class="dailyNoEntry">No articles on this day.</div>
{/if} {/if}