annotate Lib/IMPL/Web/View/TTDocument.pm @ 191:78a18a2b6266

IMPL::Web::View improvements (unstable)
author cin
date Thu, 05 Apr 2012 17:51:51 +0400
parents cd1ff7029a63
children a9faf883cdce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
1 package IMPL::Web::View::TTDocument;
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
2 use strict;
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
3
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
4 use IMPL::lang qw(:declare :constants);
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
5 use IMPL::DOM::Property qw(_dom);
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
6 use IMPL::Web::View::TTFactory();
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
7 use IMPL::Web::View::TTControl();
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
8
190
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
9 use Scalar::Util qw(weaken);
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
10
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
11
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
12 use parent qw(
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
13 IMPL::DOM::Document
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
14 IMPL::Web::View::TTControl
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
15 );
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
16
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
17 BEGIN {
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
18 public _dom property layout => PROP_ALL;
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
19 public property opts => PROP_GET | PROP_OWNERSET;
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
20 public property loader => PROP_GET | PROP_OWNERSET;
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
21 public property controls => PROP_GET | PROP_OWNERSET;
189
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
22
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
23 # store the stash separately to make require() method to work correctly
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
24 # even when a stash of the context is modified during the processing
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
25 public property stash => PROP_GET | PROP_OWNERSET;
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
26 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
27
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
28 sub CTOR {
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
29 my ($this,$template,$refOpts,%args) = @_;
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
30
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
31 $this->controls({});
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
32 $this->loader($args{loader}) if $args{loader};
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
33
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
34 $this->layout( $template->layout ) unless $this->layout;
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
35
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
36 $this->opts($refOpts);
189
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
37 $this->stash($this->context->stash);
190
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
38
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
39 my $self = $this;
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
40 weaken($self);
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
41
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
42 $this->templateVars('require', sub {
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
43 my $doc = $self;
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
44 die new IMPL::Exception("A document is destroyed or invalid") unless $doc;
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
45 $doc->require(@_);
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
46 });
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
47
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
48 $this->templateVars('document', sub { $self } );
191
78a18a2b6266 IMPL::Web::View improvements (unstable)
cin
parents: 190
diff changeset
49 $this->InitInstance();
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
50 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
51
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
52 our %CTOR = (
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
53 'IMPL::Web::View::TTControl' => sub {
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
54 'document',
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
55 $_[0], # template
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
56 new Template::Context($_[1]) # context
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
57 },
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
58 'IMPL::DOM::Document' => sub {
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
59 nodeName => 'document'
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
60 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
61 );
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
62
189
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
63 sub templateVars {
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
64 my $this = shift;
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
65 my $name = shift;
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
66
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
67 if (@_) {
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
68 return $this->stash->set($name, shift);
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
69 } else {
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
70 return $this->stash->get($name);
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
71 }
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
72 }
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
73
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
74 sub require {
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
75 my ($this, $control) = @_;
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
76
186
6c0fee769b0c IMPL::Web::View::TTControl tests, fixes
cin
parents: 185
diff changeset
77 if (my $factory = $this->controls->{$control}) {
6c0fee769b0c IMPL::Web::View::TTControl tests, fixes
cin
parents: 185
diff changeset
78 return $factory;
6c0fee769b0c IMPL::Web::View::TTControl tests, fixes
cin
parents: 185
diff changeset
79 } else {
189
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
80
186
6c0fee769b0c IMPL::Web::View::TTControl tests, fixes
cin
parents: 185
diff changeset
81 my $path = $control;
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
82 if ( my $template = $this->loader->template($path) ) {
189
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
83
191
78a18a2b6266 IMPL::Web::View improvements (unstable)
cin
parents: 190
diff changeset
84 my $opts = { %{$this->loader->options} };
78a18a2b6266 IMPL::Web::View improvements (unstable)
cin
parents: 190
diff changeset
85 $opts->{STASH} = $this->loader->context->stash->clone();
188
029c9610528c Memory leak tests in IMPL::Web::View
cin
parents: 187
diff changeset
86
189
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
87 my $ctx = new Template::Context($opts);
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
88
186
6c0fee769b0c IMPL::Web::View::TTControl tests, fixes
cin
parents: 185
diff changeset
89 $factory = new IMPL::Web::View::TTFactory(
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
90 typeof IMPL::Web::View::TTControl,
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
91 $template,
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
92 $ctx,
189
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
93 $opts
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
94 );
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
95
186
6c0fee769b0c IMPL::Web::View::TTControl tests, fixes
cin
parents: 185
diff changeset
96 my @parts = split(/\/+/,$control);
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
97
186
6c0fee769b0c IMPL::Web::View::TTControl tests, fixes
cin
parents: 185
diff changeset
98 $this->controls->{$control} = $factory;
6c0fee769b0c IMPL::Web::View::TTControl tests, fixes
cin
parents: 185
diff changeset
99
6c0fee769b0c IMPL::Web::View::TTControl tests, fixes
cin
parents: 185
diff changeset
100 return $factory;
188
029c9610528c Memory leak tests in IMPL::Web::View
cin
parents: 187
diff changeset
101
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
102 } else {
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
103 die new IMPL::KeyNotFoundException($control);
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
104 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
105 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
106 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
107
187
927653d01f4f TTControl::AUTOLOAD now accesses nodeProperties
sergey
parents: 186
diff changeset
108 sub renderBlock {
927653d01f4f TTControl::AUTOLOAD now accesses nodeProperties
sergey
parents: 186
diff changeset
109 $_[0]->template;
927653d01f4f TTControl::AUTOLOAD now accesses nodeProperties
sergey
parents: 186
diff changeset
110 }
927653d01f4f TTControl::AUTOLOAD now accesses nodeProperties
sergey
parents: 186
diff changeset
111
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
112 sub Render {
187
927653d01f4f TTControl::AUTOLOAD now accesses nodeProperties
sergey
parents: 186
diff changeset
113 my ($this,$args) = @_;
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
114
190
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
115 my $output;
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
116
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
117 if ($this->layout) {
190
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
118 $output = $this->context->include(
191
78a18a2b6266 IMPL::Web::View improvements (unstable)
cin
parents: 190
diff changeset
119 $this->loader->template($this->layout),
190
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
120 {
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
121 content => sub { $output ||= $this->RenderContent($args); }
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
122 }
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
123 );
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
124 } else {
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
125 return $this->RenderContent($args);
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
126 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
127
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
128 return $output;
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
129 }
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
130
190
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
131 sub RenderContent {
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
132 my $this = shift;
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
133 return $this->SUPER::Render(@_);
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
134 }
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
135
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
136
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
137 1;
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
138
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
139 __END__
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
140
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
141 =pod
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
142
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
143 =head1 NAME
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
144
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
145 C<IMPL::Web::View::TTDocument> - документ для построения HTML страницы на основе шаблонов TT.
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
146
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
147 =head1 SYNOPSIS
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
148
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
149 =begin code
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
150
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
151 use IMPL::Web::View::TTDocument();
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
152
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
153 my $doc = new IMPL::Wbe::View::TTDocument($template,$ttOptions);
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
154
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
155 return $doc->Render();
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
156
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
157 =end code
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
158
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
159 Однако, более предпочтительный способ использовать C<IMPL::Web::View::TTLoader>.
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
160
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
161 =head1 DESCRIPTION
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
162
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
163 Документ для представления данных. Документы представляют собой иерархически организованные данные,
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
164 элементами данного документа являются данные для отображения, такие как
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
165
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
166 =over
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
167
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
168 =item * Объекты из БД
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
169
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
170 =item * Навигационные цепочки
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
171
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
172 =item * Меню и т.п.
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
173
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
174 =back
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
175
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
176 Скприт шаблона формирует структуру документа, затем сформированная структура форматируется в готовый документ.
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
177 Процесс преобразования объектной модели в готовый документ может быть выполнена как вручную, так и при помощи
189
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
178 вспомогательного шаблона - обертки. Если у шаблона документа указан C<layout> в метаданных, то он будет
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
179 использован как шаблон для форматирования объектной модели, вывод самого шаблона будет проигнорирован. Если
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
180 обертка не задана, то результатом будет вывод самого скрипта шаблона.
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
181
190
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
182
185
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
183 =head2 Порядок обработки документа
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
184
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
185 =over
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
186
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
187 =item 1 Создается документ при помощи метода C<TTLoader::document()>
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
188
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
189 =item 1 При создании документа (в конструкторе), происходит выполнение блока C<CTOR>
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
190
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
191 =item 1 При вызове метода C<TTDocument::Render()> устанавливаются переменные C<this>, C<document>
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
192 и шаблон обрабатывается при помощи метода C<process()> контекста документа.
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
193
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
194 =back
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
195
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
196 =head2 Загрузка элемента управления
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
197
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
198 =over
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
199
190
cd1ff7029a63 IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
cin
parents: 189
diff changeset
200 =item 1 C<require('my/org/input')>
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
201
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
202 =item 1 Загружает шаблон C<my/org/input.tt>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
203
189
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
204 =item 1 Создает фабрику элементов управления с собственным контекстом, унаследованным от контекст документа.
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
205
189
08015e2803f1 IMPL::Vew::Web - fixed memory leaks, more tests
cin
parents: 188
diff changeset
206 =item 1 Выполняет шаблон в пространстве имен фабрики
181
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
207
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
208 =back
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
209
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
210 =head2 Создание элемента управления
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
211
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
212 =over
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
213
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
214 =item 1 C<< my.org.input.new('login') >>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
215
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
216 =item 1 Если это первый элемент управления, то выполняетя статический конструктор в контексте фабрики
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
217
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
218 =item 1 Создается новый дочерний контекст к контексту фабрики
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
219
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
220 =item 1 Создается экземпляр элемента управления
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
221
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
222 =item 1 Выполняется блок конструктора в контексте элемента управления, параметр C<this> имеет значение
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
223 нового экземпляра элемента управления
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
224
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
225 =back
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
226
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
227 =head1 MEMBERS
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
228
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
229 =over
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
230
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
231 =item C<CTOR($template, %options)>
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
232
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
233 Создает экземпляр документа с указанным шаблоном и параметрами, параметры
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
234
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
235 =back
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
236
47dac58691ee New templating system, small fixes
sourcer
parents:
diff changeset
237 =cut