FireFox! The PHP Forum Loans and Credit
Panama Web Design for Hire Free Insurance Quotes!
Web Hosting Advertise Here $10 a Month Designer Children
Never Pay Taxes Again HGH Domain name registration
Web Hosting and Dedicated Servers Insurance Affordable web-hosting


HomeWatched TopicsRegisterSearchDirectory
FAQMemberlistUsergroupsLog inStoresItemsBank
Google

Reply to topic Page 1 of 1
Javascript Module - JS, PHP, MySQL
Message  

Reply with quote
Post Javascript Module - JS, PHP, MySQL 
Hi,

I have an event calendar on my website that is built/populated with javascript, php, and mySQL.  

It all works great as is.   I want to now be able to offer it as a JS module for other websites to use and was wondering if anyone had some ideas/tips/tricks/thoughts on it.  here are the issues that I see need to be looked at:

1) It will use the database on my server, but the new website may not be on the same server
2) how to run the PHP portion on my server and used on the second server, assuming the second site may not have PHP abilities.

has anyone done anything like this before?  

Thanks for any help.

View user's profile Send private message MSN Messenger

Reply with quote
Post  
You can make a php script that output javascript and import it in other website. That way, all the php is processed on your host


<script src="calendar_js.php" language="javascript" type="text/javascript"></script>

View user's profile Send private message

Reply with quote
Post Awesome! one more question... 
Thanks Maloid,

That is working out well.   (now just the task of converting all outputs to JS).

A followup question, which might be more suited for the PHP coding forum,

I am trying to pass queries to the page to allow users to change months/years and to track what site the calendar is being viewed from.   Thats all fine,  but how do I retrieve the query string from the PHP servers end.  if I use $_server['php_self'], I get the server location where the PHP is hosted.  In essence, I need to be able to pull down whatever is showing in the address bar at that time..  Can't seem to find that anywhere...


Thanks again.

View user's profile Send private message MSN Messenger

Reply with quote
Post Got it figured 
used the following function to do what I needed.

Have the initial file called be a true .js file, which in turn calls the PHP file.

function GetParam(name)
{
  var start=location.search.indexOf("?"+name+"=");
  if (start<0) start=location.search.indexOf("&"+name+"=");
  if (start<0) return '';
  start += name.length+2;
  var end=location.search.indexOf("&",start)-1;
  if (end<0) end=location.search.length;
  var result=location.search.substring(start,end);
  var result='';
  for(var i=start;i<=end;i++) {
    var c=location.search.charAt(i);
    result=result+(c=='+'?' ':c);
  }
  return unescape(result);
}

View user's profile Send private message MSN Messenger
Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
  



Google

FireFox! The PHP Forum Loans and Credit
Panama Web Design for Hire Free Insurance Quotes!
Web Hosting Advertise Here $10 a Month Designer Children
Never Pay Taxes Again HGH Domain name registration
Web Hosting and Dedicated Servers Insurance Affordable web-hosting


Web Design by PlatinumShore.com & Web Hosting by TradeWebHosting.com