Page 1 of 1

ANOMALY : UDT runs after Template save

Posted: Thu Feb 28, 2013 9:48 pm
by atz6975
Hi,
I'm a little bit puzzled by the fact that everytime I save one specific template (default one) , it triggers the execution of one specific UDT.
This UDT does only one thing : error_log (some values from $POST and user IP)....
If I tail the file written by error_log ($mymessage,3,$mypath) I can clearly see that every time I "save" the template it executes the UDT....

Furthermore, ,this UDT is otherwise called within a global content inside an ajax page and every time I call that ajax pag the UDT code gets executed twice...

I'd be very grateful if someone could point me to my mistake or anything that could help.

Thank you very much for any thought or hint.
CMSMS version 1.11.4

Re: ANOMALY : UDT runs after Template save

Posted: Thu Feb 28, 2013 10:18 pm
by calguy1000
UDT's are smarty plugins.... if they are included in a page template (even via a GCB) then they are called.

That includes when editing templates, and editing content.

Re: ANOMALY : UDT runs after Template save

Posted: Fri Mar 01, 2013 5:58 am
by atz6975
I understand now....
And I'm going to sort out the double execution...unless you can help me without knowing my code ::)

Edited : because it is two different issues and I don't want to make anybody angry...

Re: ANOMALY : UDT runs after Template save

Posted: Fri Mar 01, 2013 12:15 pm
by atz6975
Here is some fun info....
I used Postman Chrome extension and I built a page with only UDT call.
UDT simple logic is : delay( 1s), error_log( time())
Template of page is : {process_pagedata}{content}
Page content is : {UDT}

If I post
Url : /page
I get one write in file

If I post
Url : /page?showtemplate=false
I get two writes in log file with 1s different unix timestamp

So I have some questions:
Can anybody reproduce with 1.11.4? (thanks for your patience...)
How can I set the content header to 'application/json' if I return some json info?
I believe showtemplate=false is NOT necessary if my template doesn't return any nice layout, am I wrong?


Thank you x3

Re: ANOMALY : UDT runs after Template save

Posted: Fri Mar 01, 2013 2:33 pm
by calguy1000
The running twice issue is a bug that has been solved in the upcoming version 1.11.5.

[SOLVED] : UDT runs after Template save

Posted: Fri Mar 01, 2013 3:29 pm
by atz6975
YES!
I had a feeling it was odd...and thanks for the fix.

Is cmsms()->set_variable('content-type', 'application/json'); a good idea to set the content to json?