I didn't forward the information, but I think it would be a possibility. My CALL() was a direct URI.
Announcement
Collapse
No announcement yet.
php and miva once again
Collapse
X
-
don't have time to test it, but can the url in the %call() statement be a variable...i see that the example shows it as a literal, but not enclosed...so from that, one would actually assume that the Call function cannot take a variable.Bruce Golub
Phosphor Media - "Your Success is our Business"
Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
phosphormedia.com
Comment
-
Sure. Here's a complete script:
Code://Set cookie function setCookie(name, value, expires, path, domain, secure) { var today = new Date(); today.setTime(today.getTime()); if (expires) expires = expires * 1000 * 60 * 60 * 24; var expires_date = new Date(today.getTime() + (expires)); document.cookie = name+"="+escape(value) + ((expires) ? ";expires="+expires_date.toGMTString() : "") + //expires.toGMTString() ((path) ? ";path=" + path : "") + ((domain) ? ";domain=" + domain : "") + ((secure) ? ";secure" : ""); } //Get cookie function getCookie(name) { var start = document.cookie.indexOf(name + "="); var len = start + name.length + 1; if ((!start) && (name != document.cookie.substring(0, name.length))) return null; if (start == -1) return null; var end = document.cookie.indexOf( ";", len); if (end == -1) end = document.cookie.length; return unescape(document.cookie.substring(len, end)); } //Delete cookie function deleteCookie(name, path, domain) { if (getCookie(name)) document.cookie = name + "=" + ((path) ? ";path=" + path : "") + ((domain) ? ";domain=" + domain : "") + ";expires=Thu, 01-Jan-1970 00:00:01 GMT"; }
Code://Create cookies shippingName = "%VAR(Customers.d.ship_fname)%"; billingName = "%VAR(Customers.d.bill_fname)%"; var expireDate = new Date((new Date()).getTime() + 24 * 3600 * 1000); if (shippingName != "") { custName = shippingName; } else { custName = billingName; } deleteCookie("custName", "/", ""); setCookie("custName", escape(custName), expireDate.toGMTString(), "/", "", "");
Code://read var strCustName = unescape(getCookie("custName", "/", ""));
Comment
-
Hi Brandon, thanks for the help and the code. I have a similar js file for getting and setting cookies. In the code you mentioned above:
"var strCustName = unescape(getCookie("..........."));
is that being placed inside your php file. I tried something similar to this but couldn't get it to work. Or are you passing the cookie value to your php script via a variable: In other words:
call(myscript.php?var = strCustomerName)
Once again thanks for the help as between miva, php, and javascript, I'm a little confused.
Eric
Comment
-
No, the script I gave you is only for javascript. It is unable to function with php because of the client-side/server-side conflict.
I have the call as simply %CALL("myscript.php")%
If you want to interact w/ the data on the server-side, you will need to read the cookies in php ($_COOKIES). Our theory so far in this thread is it can't be done because CALL() doesn't pass the HTTP header information. If you can get the %CALL("myscript.php?var=Customer Name")% to work, that may be the only way left for you.
Comment
Comment