I have some forms for my site that require some php includes as part of the process. Everything works great when included in a page template, where the php is processed serverside like normal.
So, naturally I presume I can get any of the good PHP widget plugins, and put my includes into those, and things will work fine.
But they don’t. What happens is that if I put all my includes and variables into the PHP widget, it will run. But if I need to include another PHP widget that uses some of the same includes, it halts and won’t run.
And also, if I put the includes in the header of the site, and then just pull what I need into the other includes in the php widget, it won’t run either. It is almost as if the php widgets run at a different time of the page loading that the rest of the php on the page, and it’s either all in one widget, or nothing.
What I had intended to do was have an include up in the header with a bunch of global variables, and then a php form in the php-widget that had calls to those variables. But when the variable include is in the header, and the call-to include is in the php-widget, it doesn’t run and just halts the page. But if I put the same includes just into the page template, not in the php-wiget and not in the “entry content” of the loop, it runs fine.
So something tells me that the order of how a php-widget doesn’t play well with having to reference includes and variables loaded into the DOM from header includes, and then being referenced in the php-widget.
Does anyone have any experience with anything like this, and know of any limitations of using php-widgets? It seems that right now, unless all my php is encapsulated within the php-widget, I can’t get it to interact with other elements on the page.
Essentially, what I have are 2 forms I want on a page, one is a full contact information form, the other is an email only form, in 2 seperate widgets. They both need to get variables from an include that stores all their google analtyics ID’s and domain variables, since we’re using the same forms on different sites, and wanted the analytics variables to be loaded into the php form dynamically so we only have 1 copy of the form, and the include handles the variables.
This won’t work, I can load the variables include, and the form include, into a php-widget and it works, but if I then try to add another widget with the 2nd form (which uses the same variable reference file included in the previous form), it just halts the page and crashes out.
Is there a secret to getting php-widgets to interact with elements outside the widget, or is this a kludge solution and I need to start thinking of something else?
- The topic ‘PHP Widgets – Not working for what I need, am I out of luck?’ is closed to new replies.