Jifty

 view release on metacpan or  search on metacpan

lib/Jifty/Plugin/ViewDeclarePage/Page.pm  view on Meta::CPAN

=item C<page_title is ...>

You can define dynamic title using the following:

    template some => page {
        my $page_title = ...;
        ...
        page_title is $page_title;
        ...
    };

Don't want to define dynamic title then as well you can use syntax
described in L</init> above.

When 'page_title is' is used in the content code, L</render_title_inpage>
is called, read more in L</instrument_content>.

L</render_title_inhead> is called during rendering of the head tag,
so you can change title there as well by subclassing that method.

=item tag <link>, C<add rel ...> and C<add rev ...>

You can add <link> tags right from the content using the following syntax:

    add rel "alternate",
        type => "application/atom+xml",
        title => _('Updated this week'),
        href => '/feeds/atom/recent',
    ;

When these constructions are used, L</render_link_inpage> is called
so you can add something right in the page content, for example
RSS image with link to the feed. See also L</instrument_content>.

L</render_links_inhead> is called during rendering of the head tag.

=item css and js

Links to CSS and JS files are rendered for you using
L<Jifty::Web/include_css> and L<Jifty::Web/include_js> functions.

Read docs around those methods and L<Jifty::Manual> on adding your
own styles and scripts.

=item meta

Not implemented, but will be as soon as syntax will be defined.

=back

=cut

sub render_header {
    my $self = shift;

    $self->render_doctype;

    head {
        Jifty->web->response->content_type('text/html; charset=utf-8');
        with(
            'http-equiv' => "content-type",
            content      => "text/html; charset=utf-8"
        ), meta {};
        $self->render_title_inhead( $self->_title );
        $self->render_links_inhead( @{ $self->_links || [] } );
        Jifty->web->include_css;
        Jifty->web->include_javascript;
    };
    return '';
};

=head3 render_body

Renders body tag, declares that we're in body and calls L</render_page>
that actually defines layout of the body. L</render_page> method is better
target for subclassing instead of this.

=cut

sub render_body {
    my $self = shift;
    body {
        Jifty::View->call_trigger('body_start');
        $self->render_page;
        Jifty::View->call_trigger('body_end');
    };
    return '';
}

=head3 render_footer

Renders the page footer - </html> tag :)

=cut

sub render_footer {
    my $self = shift;
    outs_raw('</html>');
    return '';
}

=head2 Body layout

=head3 render_page

Renders the skeleton of the page and then calls L</instrument_content>
to prepare and finally render L</content_code> using L</render_content>.

Default layout of the page is the following:

    <div>
      <div>
        this->render_salutation
        this->render_navigation
      </div>
      <div id="content"><div>
        this->instrument_content
        this->render_jifty_page_detritus
      </div></div>
    </div>



( run in 0.400 second using v1.01-cache-2.11-cpan-d7f47b0818f )