Problem with showtemplate param

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
User avatar
airelibre
Dev Team Member
Dev Team Member
Posts: 99
Joined: Tue Dec 01, 2009 3:42 pm
Location: Alsace // France

Problem with showtemplate param

Post by airelibre »

Hi Guys,

I'm coding a module on a CMSMS 1.11.2, and I have a strange problem.

My module has to export PDF files, so I wanted to use the "showtemplate=false" param on the "generate pdf" action link in order to not load all the page elements (as they are useless in this case).

I have a "download" action, which makes an addition in the DB with a simple "INSERT INTO" query.

In CMSMS 1.11, when I call my module action, like :
"http://www.mywebsite.com/index.php?mact ... late=false[/b]&cntnt01returnid=47

my module code seems to be executed twice ! I mean: I have two new lines in my DB table

When I remove the "showtemplate" param, it's ok

I made the same test with an Audit function, and the Audit script saves the same thing two times too!

Is this a 1.11 bug? I have the latest version (1.11.2). If I remember clearly, it was working on 1.10

Thank you very much for your help :)
Last edited by Dr.CSS on Tue Jan 29, 2013 9:22 pm, edited 1 time in total.
Reason: Please use double quotes on fake links so they aren't clickable...
caciavar
Forum Members
Forum Members
Posts: 64
Joined: Wed Feb 11, 2009 6:30 pm
Location: Toronto, Canada

Re: Problem with showtemplate param

Post by caciavar »

I noticed this exact same behavior after 1.10.

I am using an ajax form, and it sends me two copies of the e-mail instead of just one, which makes me believe that the code is executed twice.
nervino
Power Poster
Power Poster
Posts: 448
Joined: Sun Dec 28, 2008 12:15 pm
Location: Roma, Italy

Re: Problem with showtemplate param

Post by nervino »

I'm quite sure the code is executed two times.
(see http://forum.cmsmadesimple.org/viewtopi ... =6&t=64119).

I had a php page, with several "IF and ELSEIF" statements: when the last elseif was executed, in the page I had the output of the first IF statement too. I tried to debug logging in the db, and I had 2 logs recorded.
For me, I guess this issue happens when you use a cmsms generated url (create_url()) inside an ajax script or another jquery script, for example using a fancybox iframe.

I couldn't find a solution, and I removed the fancybox iframe and I sent the mail form without ajax (As I also didn't want all the queries present in the page being executed 2 times).
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Problem with showtemplate param

Post by calguy1000 »

I can confirm that the &showtemplate=false stuff DOES NOT occur multiple times. I use ajax alot, and have no difficulties.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
nervino
Power Poster
Power Poster
Posts: 448
Joined: Sun Dec 28, 2008 12:15 pm
Location: Roma, Italy

Re: Problem with showtemplate param

Post by nervino »

I also agree with calguy1000, in many cases I have no problem using ajax &showtemplate=false. It only occurs in some circumstances.
Unfortunatly, I was not able to identify the causes and reproduce the issue.
Post Reply

Return to “Developers Discussion”