• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/CPANInternal-140/Template-Toolkit/lib/Template/

Lines Matching defs:view

6 #   A custom view of a template processing context.  Can be used to 
20 # if you do this: [% view.print(hash1, hash2, hash3) %]. Current
21 # work-around is to do [% view.print(hash1); view.print(hash2);
22 # view.print(hash3) %] or [% view.print(hash1, hash2, hash3, { }) %]
75 # view is sealed by default preventing variable update after
76 # definition, however we don't actually seal a view until the
77 # END of the view definition
88 return $self->error('Invalid base specified for view')
91 # name of data item used by view()
102 # what about mapping foobar() to view('foobar')?
105 # the view is initially unsealed, allowing directives in the initial
106 # view template to create data items via the AUTOLOAD; once sealed via
124 # Seal or unseal the view to allow/prevent new datat items from being
230 # $item to have called error() on the view
251 $self->DEBUG("printing view '", $template || '', "', $item\n") if $DEBUG;
252 $output .= $self->view($template, $item)
260 # view($template, $item, \%vars)
270 # view expects the item to be called in the $vars hash.
273 sub view {
298 $vars->{ view } ||= $self;
320 "no view template specified")
335 # try asking the base view if not found
397 # '.') or presents a view if the method matches the view_prefix item,
398 # e.g. view_foo(...) => view('foo', ...). Similarly, the
403 # method name to a view() call, iff view_naked is set. Otherwise, a
404 # 'view' exception is raised reporting the error "no such view member:
416 "attempt to view private member: $item");
421 "cannot update config item in sealed view: $item")
430 "cannot update item in sealed view: $item")
446 $self->DEBUG("returning view($item)\n") if $DEBUG;
447 return $self->view($item, @_);
458 $self->DEBUG("returning naked view($item)\n") if $DEBUG;
459 return $self->view($item, @_);
463 "no such view member: $item");
475 Template::View - customised view of a template processing context
479 # define a view
480 [% VIEW view
503 # access data items for view
504 [% view.title %]
505 [% view.other_item %]
508 [% view.header %]
509 [% view.header(title => 'New Title') %]
512 [% view.footer %] # => [% INCLUDE my_footer.tt2 %]
515 [% view.include( 'header', title => 'The Header Title' ) %]
516 [% view.include_header( title => 'The Header Title' ) %]
519 [% view.header( title => 'The Header Title' ) %]
522 [% view.footer %] # => [% INCLUDE my_footer.tt2 %]
526 [% view.include('missing') %]
527 [% view.include_missing %]
528 [% view.missing %]
531 [% view.print("some text") %] # type=TEXT, template='text'
538 [% view.print(some_hash_ref) %] # type=HASH, template='hash'
545 [% view.print(my_list_ref) %] # type=ARRAY, template='list'
552 [% view.print(myobj) %]
559 [% view.map.ARRAY = 'my_list_template' %]
560 [% view.map.TEXT = 'my_text_block' %]
564 [% view.prefix = 'your_' %]
565 [% view.default = 'anyobj' %]
576 Creates a new Template::View presenting a custom view of the specified
588 [% USE view(prefix => 'my_') %]
589 [% view.view('foo', a => 20) %] # => my_foo
595 [% USE view(suffix => '.tt2') %]
596 [% view.view('foo', a => 20) %] # => foo.tt2
605 [% USE view(map => { ARRAY => 'my_list',
609 [% view.print(some_text) %] # => text
610 [% view.print(a_list) %] # => my_list
611 [% view.print(a_hash) %] # => your_hash
612 [% view.print(a_foo) %] # => my_foo
633 themselves to the view. If a specific map entry can't be found for an
635 the method will be called, passing the view as an argument. The object
636 can then make callbacks against the view to present itself.
641 my ($self, $view) = @_;
642 return "a regular view of a Foo\n";
646 my ($self, $view) = @_;
647 return "a debug view of a Foo\n";
652 [% USE view %]
653 [% view.print(my_foo_object) %] # a regular view of a Foo
655 [% USE view(method => 'debug') %]
656 [% view.print(my_foo_object) %] # a debug view of a Foo
662 [% USE view(default => 'my_object') %]
664 [% view.print(objref) %] # => my_object
666 If no map entry or default is provided then the view will attempt to
671 [% view.print(fubar) %] # => Foo_Bar
685 [% USE view %]
689 [% view.print(a_list) %]
691 [% USE view(item => 'thing') %]
695 [% view.print(a_list) %]
699 Prefix of methods which should be mapped to view() by AUTOLOAD. Defaults
702 [% USE view %]
703 [% view.view_header() %] # => view('header')
705 [% USE view(view_prefix => 'show_me_the_' %]
706 [% view.show_me_the_header() %] # => view('header')
713 [% USE view(view_naked => 1) %]
715 [% view.header() %] # => view('header')
723 =head2 view( $template, \%vars, \%config );