Path

ez projects / paradoxpdf / forum / general / global variables lost?


global variables lost?

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

zurgutt -

Member since:
09 January 2008

Posts: 10

Monday 01 June 2009 8:11:46 pm

I have a number of variables set in node view full override and they are used in templates for custom ezxml tags (as global variables, $#var). It works fine in normal full view, but in pdf view these variables are not set in custom tag templates, although exact same templates are used. Also, $persistent_variable seems to lose value too. Do you have any ide what could be the problem? Im quite baffled..

Certified eZ developer looking for projects.
zurgutt at gg.ee

Up

Karnichi Mohamed

Member since:
09 October 2006

Posts: 78

Monday 01 June 2009 8:39:21 pm

If you make your own override you will get all this global variables.
As you are the second person (http://projects.ez.no/paradoxpdf/...using_googlepath_javascript_problem) who asked for this : i have updated the node/view/pdf.tpl so you can get variables set by content view. It is on the trunk I will make a new release that includes this modification.




{node_view_gui view=full content_node=$node


                        viewmode=$viewmode


                        language_code=$language_code


                        view_parameters=$view_parameters


                        collection_attributes=$collection_attributes


                        validation=$validation


                        persistent_variable=$persistent_variable}




On the next relase many enhancements will be added to make pdf generation and manipulation easier from php code

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

Up

zurgutt -

Member since:
09 January 2008

Posts: 10

Wednesday 03 June 2009 12:38:00 am

Thanks for your help! Did not work tho, global variables are still gone in tag templates.
Do i understand correctly, $module_result.content should return same thing to default ezwebin pagelayout and your pagelayout override? Because it does not.

If i change the match rule in paradoxpdf override.ini to:
Match[viewmode]=full

then it will suddenly start to work.

What i do, exactly:
In my override for node view full folder i am setting
{def $myvar='somestring'}

Then, in design/ezwebin/templates/content/datatype/view/ezxmltag/mycustomtag.tpl (which gets called if this custom tag is used in ezxml field)

i try to access it: {$#myvar}

Works in full layout, doesnt in pdf layout.

I am not sure if im misunderstanding some concept or if there is some bug at work here..

Certified eZ developer looking for projects.
zurgutt at gg.ee

Up

Karnichi Mohamed

Member since:
09 October 2006

Posts: 78

Wednesday 03 June 2009 1:12:40 am

It's hard to figure out what happens. Anyway, the folowing could be helpful :
you dont have to make any change to the default paradoxpdf override.ini. You can instead override it with template override mechanism.

When you call content/view/pdf/ <node_id> then the system loads the node/view/pdf.tpl and paradox_pdf_layout.tpl (for the layout)

By default, paradoxpdf overrides the node/view/pdf.tpl and loads node/view/full.tpl, just to make it working out of the box.

In most cases you will have to make a custom design for your pdf . So first you override the paradoxpdf_layout.tpl once. For example you can copy the default paradoxpdf_layout.tpl to a new file my_pdf_layout.tpl then in (for example) your siteaccess :override.ini.append.php




[my_custom_pdf_layout]


Source=paradoxpdf_layout.tpl


MatchFile=my_pdf_layout.tpl


Subdir=templates 



Then you override the node/view/pdf.tpl for each content type or specific node :

-For folder exapmple in your design extension create a template : override/templates/pdf/folder.tpl
then make a custom override rule :

add this rule :




[folder_pdf]


Source=node/view/pdf.tpl


MatchFile=pdf/folder.tpl


Subdir=templates 

Match[class_identifier]=folder





As explained in another topic, When make an override you will have all variables.
If you still have a problem just send me your code, i will check it.

do you use layout/set/pdf or node/view/pdf/ ?

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

Up

zurgutt -

Member since:
09 January 2008

Posts: 10

Wednesday 03 June 2009 9:44:25 am

I have also posted in developer forum
http://ez.no/developer/forum/deve...ut_kills_global_variables_in_content

Hopefully can figure it out, thanks for help :)

Certified eZ developer looking for projects.
zurgutt at gg.ee

Up

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