Path

ez projects / paradoxpdf / forum / suggestions / some notes


Some notes

You need to be logged in to post messages in the forums. New users may register here.

Damien Pobel

Member since:
19 September 2005

Posts: 40

Thursday 23 April 2009 12:12:01 am

Hi Mohamed,

I haven't tested your extension yet but it seems very interesting. I look quickly at your code and I have some comments ("déformation professionnelle" ;-)) :

1. first you use a template operator to generate a file. I think it's not the purpose of a template operator, it would have been much nicer to create a module/view that calls internally the PDF view and then transforms its output to PDF.

2.you generate files in extension/paradoxpdf/tmp. After the install the extension directory is often (and should be) readonly for the web server. Dynamic files should go to the var directory.

3. You should not use eZFile::getContents(), it is deprecated in eZ Publish 4.1
http://pubsvn.ez.no/doxygen/trunk...tml#4d108a87d37b2d005f01157933358216

4. In pdf.tpl, why do you fetch the $node while you already have it ?

Cheers
Up

Karnichi Mohamed

Member since:
09 October 2006

Posts: 78

Thursday 23 April 2009 3:14:41 pm

Bonjour Damien,

First thank you for your feedbak

>1. first you use a template operator to generate a file. I think it's not the purpose of a
>template operator, it would have been much nicer to create a module/view that calls
>internally the PDF view and then transforms its output to PDF.

What makes a module/view nicer than a template operator ?

Well, First problem with this approach (module/view) is that we have to copy some the code from the content view (or reimplement the content view, reinvent the wheel ), witch make it dependent of ezpublish versions implementations (BC).
The second problem is that we have to forward the (view parameters), to the custom module to handle them witch make developing links to the module view a little bit painful for developpers. Another problem is that when we use module views , the module name is always present in the URL (example : paradoxpdf/pdf/<node_id>) so , in a professional context, I prefered to make it clean: content/view/pdf/<node_id>. And the last reason is that with module operator you can use Friendly urls to the pdf view by setting the pdf Layout example (layout/set/pdf/Title-of-your-content-page), thing that you can also make in module view but you have to manage your self the links to the custom module view and then checking the url, access policies, before fetching back the content. All of this is already handled by ezpublish by using template operator.



>2.you generate files in extension/paradoxpdf/tmp. After the install the extension
>directory is often (and should be) read-only for the web server. Dynamic files should go
>to the var directory.

:) I thined about this . Why i don't use the VarDir ? So the problem here is that to make the pdf views i have to convert relative resources links (images, css, js in extension + images in the storage) to make sure they are relative to ezpublish installation directory (rootDir) so they can be loaded by the render. But as you know developers can configure the varDir path per siteaccess so they can put (var/siteaccess1_name as well as var/intranet/siteaccessname) as well (tordu mais bon on ne sait jamais :p). But i will think about a solution for this.


>3. You should not use eZFile::getContents(), it is deprecated in eZ Publish 4.1
>http://pubsvn.ez.no/doxygen/trunk...tml#4d108a87d37b2d005f01157933358216

i know :) check the comment (line 109) in the trunk/paradoxpdf/classes/paradoxpdf.php rev 4.
I will include it in the next release (but note that this extension is 4.0 compatible not only for 4.1)

>4. In pdf.tpl, why do you fetch the $node while you already have it ?
This is definitely a white night effect :D I will change it in the next release


Merci de tes retours :).

Thanks!!

http://www.amiralweb.com Certified eZPublish Expert

Up

You need to be logged in to post messages in the forums. New users may register here.