Development

Changeset 3903

You must first sign up to be able to contribute.

Changeset 3903

Show
Ignore:
Timestamp:
05/02/07 19:15:10 (6 years ago)
Author:
promag
Message:

documentation updated

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfOpenOfficePlugin/README

    r3898 r3903  
    6363Then, just go to: 
    6464{{{ 
    65 http://servername/app_dev.php/sfOpenOffice 
     65http://localhost/app_dev.php/sfOpenOffice 
    6666}}} 
    6767 
     
    9999If the actions returns other value than sfView::SUCCESS then it won't generate the document. It will fall back to the regular template. For instance, if the return value is sfView::ERROR then it will result in the template reportError.php. 
    100100 
    101 Now we are ready to go. If you try http://servername/app_dev.php/mod/report it should open the PDF document. PDF is the default format but you can change to any format supported by !OpenOffice.org in the view class (explained later). 
     101Now we are ready to go. If you try http://localhost/app_dev.php/mod/report it should open the PDF document. PDF is the default format but you can change to any format supported by !OpenOffice.org. in the view class (explained later). 
     102 
     103== Document format == 
     104 
     105The action view is by default sfPHPView. However, Symfony provides a simple way to specify the view class depending on the action name and the action return value. Actually, sfOpenOffice plugin automatically creates a new view class {document name}SuccessView. 
     106 
     107{{{ 
     108app/ 
     109  modules/ 
     110    clients/ 
     111      actions/ 
     112        actions.class.php 
     113      views/ 
     114        listSuccessView.class.php 
     115}}} 
     116 
     117The class listSuccessView can have some methods like getFileExtension and getOutputExtension (note that this is an evolving API). You can override the latter to decide which output extention will be used. sfOpenOffice plugin will determine the correct filter to convert the document from getFileExtension value to getOutputExtension value. See config/app.yml shipped with the plugin. 
     118 
     119== One action, multiple outputs == 
     120 
     121The same action could result in different documents as regular symfony templates. As stated, the action return value decides which view is used. So if you want to have different outputs just return different values or specify the view class. 
     122 
     123For instance you could have: 
     124 
     125{{{ 
     126app/ 
     127  modules/ 
     128    clients/ 
     129      actions/ 
     130        actions.class.php 
     131      views/ 
     132        listDocumentView.class.php 
     133      templates/ 
     134        listSuccess.php 
     135        listError.php 
     136      documents/ 
     137        list.odt 
     138}}} 
     139 
     140The action executeList can return sfView::SUCCESS (by default), sfView::ERROR or sfOpenOfficeDocumentView::DOCUMENT. The latter causes Symfony to load the class listDocumentView which is the sfOpenOffice view. So depending on the return value the client will see diferent results. Much like Symfony templates right? 
    102141 
    103142== Issues ==