commit
081432fe4e
@ -0,0 +1,4 @@
|
|||||||
|
The 'Hello World' plugin displays the words "Hello World!" on the
|
||||||
|
plugin page hello.cgi.
|
||||||
|
|
||||||
|
Url: hello.cgi
|
@ -0,0 +1,37 @@
|
|||||||
|
package Thruk::Controller::hello;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
Thruk::Controller::hello - Hello World!
|
||||||
|
|
||||||
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
|
Hello World!.
|
||||||
|
|
||||||
|
=head1 METHODS
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
|
||||||
|
=head2 index
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub index {
|
||||||
|
my ( $c ) = @_;
|
||||||
|
$c->stash->{title} = 'Hello World!';
|
||||||
|
$c->stash->{template} = 'hello.tt';
|
||||||
|
$c->stash->{hello_var} = 'Hello World!'; # This is our magic variable
|
||||||
|
}
|
||||||
|
|
||||||
|
=head1 LICENSE
|
||||||
|
|
||||||
|
This library is free software, you can redistribute it and/or modify
|
||||||
|
it under the same terms as Perl itself.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
1;
|
After Width: | Height: | Size: 7.4 KiB |
@ -0,0 +1,15 @@
|
|||||||
|
##########################################################
|
||||||
|
|
||||||
|
=head2 add_routes
|
||||||
|
|
||||||
|
page: /thruk/cgi-bin/hello.cgi
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
$routes->{'/thruk/cgi-bin/hello.cgi'} = 'Thruk::Controller::hello::index';
|
||||||
|
|
||||||
|
# add new menu item
|
||||||
|
Thruk::Utils::Menu::insert_item('System', {
|
||||||
|
'href' => '/thruk/cgi-bin/hello.cgi',
|
||||||
|
'name' => 'Hello World!',
|
||||||
|
});
|
@ -0,0 +1,12 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>[% title_prefix %][% title %]</title>
|
||||||
|
<link rel="shortcut icon" href="[% url_prefix %]themes/[% theme %]/images/favicon.ico" type="image/ico" />
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>[% hello_var %]</h1> <!-- This is where we access our variable -->
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in new issue