S'identifier - S'inscrire - Contact

CommunityWiki
Jam session in wikilandia

New Pages

Source :

This is what I’m using to create new pages with tags at the moment. The latest revision handles multi-word tags correctly (use “double quotes”).$Action{new} = \&DoNew;

sub DoNew { if (GetParam('tags', '') and GetParam('id', '')) { my $tags = GetParam('tags', ''); $tags =~ s{"(.*?)"}{$_ = $1; s/ +/_/g; $_ }eg; my @tags = map { s/_/ /g; $_ } split(' ', $tags); DoEdit(GetParam('id', ''), "\n\n\nTags: " . join (' ', map { "" } @tags), 1); } else { print GetHeader('', T('New')), $q->start_div({-class=>'content categories'}), GetFormStart(undef, 'get', 'cat'); my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = gmtime(); my $today = sprintf("%d-%02d-%02d", $year + 1900, $mon + 1, $mday); my $go = T('Go!'); print $q->p(T('Title: '), qq{<input type="text" name="id" value="$today" tabindex="1" />}, GetHiddenValue('action', 'new')); print $q->p(T('Tags: '), qq{<input type="text" name="tags" tabindex="2" />}); print $q->p(qq{<input type="submit" value="$go" tabindex="3" />}); print $q->end_form, $q->end_div(); PrintFooter(); } } I have bookmarked the result: Self:action=new.Tags: Oddmuse

le 23.09.08 à 00:39 dans Mind - Version imprimable
Article précédent - Commenter - Article suivant -