我有一个AMP日期选择器。呈现datepicer时,我想在datepicker的底部显示当前日期。
我正在尝试这样的事情。但不会显示当前日期。
<amp-date-picker
id="departure-date-pickerOW1"
media="(max-width: 52rem)"
date="P0D"
type="single"
mode="overlay"
layout="container"
class="flex flex1"
number-of-months="1"
day-size="36"
input-selector="[id=departure-dateOW1]"
on="activate:AMP.setState({curr_date: departure-date-
pickerOW1.today})">
<input type="text" title="departure date" id="departure-dateOW1"
class="date-field departure-date" placeholder="Departure date">
</input>
<span class="ico-sprites ico-calendar absolute"></span>
<template type="amp-mustache" info-template >
<span [text]="curr_date">current date</span>
</template>
</amp-date-picker>
答案 0 :(得分:0)
尝试这样的事情:
HTML:
<input type="text" title="departure date" id="departure-dateOW1"
class="date-field departure-date" placeholder="Departure date" value="{DATE_TODAY}>
PHP:
<?php
$date = date();
$template = file_get_contents('my_template.html'); // YOUR HTML
$output = str_replace('{DATE_TODAY}',$date, $template);
echo $output;