$response['test10.03'] = $m->calendar(); // tomorrow $m = new \Moment\Moment($date, 'CET'); $response['test10.04'] = $m->addDays(1)->calendar(); $m = new \Moment\Moment($date, 'CET'); $response['test10.05'] = $m->addDays(3)->calendar(); // everything else $m = new \Moment\Moment($date, 'CET'); $response['test10.06'] = $m->addDays(10)->calendar(); // ------------------------------------------ $date = '20140515T10:15:23'; $m = new \Moment\Moment($date, 'CET'); $response['test11.00'] = $m->format(); foreach (array('minute', 'hour', 'day', 'week', 'month', 'quarter', 'year') as $k => $period) { $index = $k + 1; $response['test11.0' . $index] = $m->startOf($period)->format(); } // ------------------------------------------ $date = '20140515T10:15:23'; $m = new \Moment\Moment($date, 'CET'); $response['test12.00'] = $m->format(); foreach (array('minute', 'hour', 'day', 'week', 'month', 'quarter', 'year') as $k => $period) { $index = $k + 1; $response['test12.0' . $index] = $m->endOf($period)->format(); } // ############################################ $tmpl = join('', file('test.html')); foreach ($response as $key => $value) { $tmpl = str_replace('{{' . $key . '}}', $value, $tmpl); } echo $tmpl;
<li> <ul class="md-list"> <?php for ($i = 0; $i < 20; $i++) { ?> <li> <div class="md-list-content"> <span class="md-list-heading"><a href="#"><?php echo $faker->sentence(6); ?> </a></span> <div class="uk-margin-small-top"> <span class="uk-margin-right"> <i class="material-icons"></i> <span class="uk-text-muted uk-text-small"><?php $moment = new Moment\Moment(); echo $moment->startOf('month')->addDays(rand(1, 28))->format('d M Y'); ?> </span> </span> <span class="uk-margin-right"> <i class="material-icons"></i> <span class="uk-text-muted uk-text-small"><?php echo rand(1, 28); ?> </span> </span> <span class="uk-margin-right"> <i class="material-icons"></i> <span class="uk-text-muted uk-text-small"><?php echo rand(100, 1000); ?> </span> </span>
<div class="timeline_content_addon"> <blockquote> <?php echo $faker->sentence(10); ?> … </blockquote> </div> </div> </div> <div class="timeline_item"> <div class="timeline_icon timeline_icon_warning"><i class="material-icons"></i></div> <div class="timeline_date"> <?php $moment = new Moment\Moment(); echo $moment->startOf('month')->addDays(28)->format('d'); ?> <span><?php $moment = new Moment\Moment(); echo $moment->format('M'); ?> </span> </div> <div class="timeline_content"> Added to Friends <div class="timeline_content_addon"> <ul class="md-list md-list-addon"> <li> <div class="md-list-addon-element"> <img class="md-user-image md-list-addon-avatar" src="assets/img/avatars/avatar_02_tn.png" alt=""/> </div>