Changeset 855

Show
Ignore:
Timestamp:
12/07/06 10:29:26 (2 years ago)
Author:
fumiakiy
Message:

Calculate and embed the date when the atom index template is associated to a weblog. BugId: 42891

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/wheeljack/default_templates/atom_index.tmpl

    r741 r855  
    44   <link rel="alternate" type="text/html" href="<$MTBlogURL encode_xml="1"$>" /> 
    55   <link rel="self" type="application/atom+xml" href="<$MTBlogURL$>atom.xml" /> 
    6    <id>tag:<$MTBlogHost exclude_port="1" encode_xml="1"$>,<$MTDate format="%Y"$>:<$MTBlogRelativeURL encode_xml="1"$>/<$MTBlogID$></id> 
     6   <id>tag:<$MTBlogHost exclude_port="1" encode_xml="1"$>,<$MTDate format="%Y-%m-%d"$>:<$MTBlogRelativeURL encode_xml="1"$>/<$MTBlogID$></id> 
    77   <updated><MTEntries lastn="1"><$MTEntryModifiedDate utc="1" format="%Y-%m-%dT%H:%M:%SZ"$></MTEntries></updated> 
    88   <MTIfNonEmpty tag="MTBlogDescription"><subtitle><$MTBlogDescription remove_html="1" encode_xml="1"$></subtitle></MTIfNonEmpty> 
  • branches/wheeljack/lib/MT/DefaultTemplates.pm

    r717 r855  
    114114        ]; 
    115115 
     116use MT::Util qw(format_ts); 
     117 
    116118sub templates { 
    117119    if (!$loaded) { 
     
    126128            if ((-e $file) && (-r $file)) { 
    127129                open FIN, "<$file"; my $data = <FIN>; close FIN; 
     130                if ('Atom Index' eq $tmpl->{name}) { 
     131                    if ($data =~ m!<\$MTDate format="([\S]+)"\$>!) { 
     132                        my @ts = gmtime(time); 
     133                        my $ts = sprintf '%04d%02d%02d%02d%02d%02d', 
     134                                $ts[5]+1900, $ts[4]+1, @ts[3,2,1,0]; 
     135                        my $date = format_ts($1, $ts); 
     136                        $data =~ s!<\$MTDate format="([\S]+)"\$>!$date!; 
     137                    } 
     138                } 
    128139                $tmpl->{text} = $data; 
    129140            } else {