tel8618217223380 / prado3

Automatically exported from code.google.com/p/prado3
Other
0 stars 0 forks source link

Unable to override default HTML writer / pointless THttpResponse::HtmlWriterType #234

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try to change the default HTML writer implementation by setting 
THttpResponse's HtmlWriterType to an own subclassed type (one derived from 
THTMLWriter)
2. Run the Prado application
3. Observe the results

What is the expected output? What do you see instead?
The subclassed HTML writer is not used consistently (if at all) across 
output generation, because even the some of base Prado classes aren't 
using THttpResponse::createHtmlWriter() to create new writers, but 
instantiate explicit THtmlWriter classes whenever needed. 

The most prominent example of this is TForm::render(), which also does 
that, and since all Prado pages are ultimately encapsulated into a TForm, 
this practically makes it impossible to hook into the output generation by 
using a subclassed THtmlWriter handler. The same holds true for 
TOutputCache too, besides less prominent controls like TSafeHtml or 
TActiveHyperLink (just search for 'new TTexWriter' amongst the Prado base 
sources).

What version of the product are you using? On what operating system?
Prado/3.1.7

Original issue reported on code.google.com by google...@pcforum.hu on 13 Mar 2010 at 8:17

GoogleCodeExporter commented 9 years ago

Original comment by rojaro@gmail.com on 28 Apr 2011 at 11:01

GoogleCodeExporter commented 9 years ago
You can hook into PRADO output generation. Every TControl::Render is called 
with a $writer parameter that is created using 
THttpResponse::createHtmlWriter(). This is by design. Child classes of TControl 
in order to render customized rendering creates a new TTextWriter and 
THtmlWriter, actually the child class may do anything it needed to render and 
that is unpredictable and this is really outside the scope of of hooking in the 
output generation, it is the same as call echo or print. However i believe it 
is very useful to hook in the output generation for every control and this is 
at least possible for the *official* controls.

Original comment by uaca...@gmail.com on 4 May 2011 at 8:49

GoogleCodeExporter commented 9 years ago
Fixed in r2899

Original comment by rojaro@gmail.com on 4 May 2011 at 9:28