Thread HTML Seite mit Links mittels Perl-Module erstellen (53 answers)
Opened by rooky at 2007-10-25 01:56

renee
 2007-10-25 10:23
#101301 #101301
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Im Prinzip sollte es ungefähr so gehen:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl

use strict;
use warnings;
use HTML::Template::Compiled; # musst du wahrscheinlich noch installieren

my @files = qw(file1 file2); # wird bei Dir durch File::Find gefuellt

my $content = do{ local $/; <DATA> };
my $tmpl = HTML::Template::Compiled->new( scalarref => \$content );
my @links = map{ {HREF => $_, TITLE => $_ } }@files;
$tmpl->param( LINKS => \@links );
print $tmpl->output;


__DATA__
<html>
 <body>
    <ul>
    <%LOOP LINKS %><li><a href="<%= HREF ESCAPE=URL %>"><%= TITLE ESCAPE=HTML %></a></li>    
    <%/LOOP %>
    </ul>
  </body>
</html>


Anschauen solltest Du Dir die Doku zu CPAN:HTML::Template::Compiled
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread HTML Seite mit Links mittels Perl-Module erstellen