New version adds a PHP ScriptManager

Since I put the Atlas PHP sample out a week ago, I've been receiving some great feedback about it.

In particular, Christian Wenz, who literally wrote the book on Atlas, has been invaluable in helping me clean up the sample and make it conform to good PHP practices. He has actually been editing my files and sending them back to me with his recommended changes. Many, many thanks to Christian for his help. Christian was here in Redmond this week for a Technology Summit, and it was great to meet up with him in person and discuss Atlas and PHP. I also want to use this opportunity to plug his Atlas book, currently available in online form - it's absolutely awesome!

In addition, many readers pointed out that the sample doesn't work on Firefox. When I put it together, I forgot that one of the key things the Atlas ASP.NET ScriptManager control does is detect the source browser, and automatically send down the right set of compat scripts. I've created a new PHP version of the ScriptManager to do the same.

Others were confused by the weird naming of the files - unfortunately, that came from the original MIX demo, where I arranged the demo files so they would show up in the right order in the VS Solution Explorer. I've gone and cleaned up the filenames to be more understandable. Just drop all the files in a subdirectory off your site root called 'Examples', add the Atlas script libraries (in the Program Files directory of your Atlas installation) into a ScriptLibrary subdirectory, then hit http://server/examples.

The most unusual catch was from luca, who found an .aspx reference lurking in the main page. In fact, to make sure my stack was 100% compatible on the wire with ASP.NET, I literally viewed the source of my ASP.NET output, saved it as a .php file, and changed all the .asmx references to .php. In doing so, I left the .aspx reference and even a viewstate hidden field in there. The new version cleans this up to avoid confusion.

Got any other ideas for what to do with this sample? Interested in using it to enable yet another "AJAX for PHP" solution on the server? Drop me a line!

The updated samples work with either the March CTP or the new April CTP of Atlas. Download the update to the Atlas PHP sample here.

Feedback

Posted on 5/7/2006 9:09:01 AM

THis is awesome stuff Shanku! I can't wait to demo some of this to some other developers using AJAX! Thanks for making the code available!

Posted on 5/7/2006 12:06:30 PM

Re Firefox:
I have Firefox 1.5.0.3 (the latest) and I get a window.attachEvent is not a function (in Atlas.js) errors with the latest version. It runs awesome in IE using VS2005 and VS.PHP's embedded Apache server, I just needed to adjust some path vars. I tried 'tricking' it to thinking Firefox was IE, but still the same errors. Just FYI.
-Atlas.js Code and Error Line Below--
if (_isBrowser){if (navigator.userAgent.indexOf('MSIE')!=-1){_hostType =Sys.HostType.InternetExplorer;}
else if (navigator.userAgent.indexOf('Firefox')!=-1){_hostType =Sys.HostType.Firefox;}
window.attachEvent('onload',onWindowLoad);window.attachEvent <<<<<<('onunload',onWindowUnload);}
this.get_hostName =function(){if (_isBrowser){return navigator.userAgent;}

Posted on 5/11/2006 2:45:31 PM

Thanks, Eric - I'll look into it and post a response.

Posted on 5/18/2006 8:11:07 AM

Is it just me or is getting this to work on IIS like twisting arms and trying to pull them out of the sockets? :P

I'm excited for this stuff and am trying to evaluate it for future use in our PHP/.NET project; however, if *anyone* has been able to gte this working on IIS, let me know.

So far, I've tried it on Windows XP and Windows 2k3, both with no luck.

Posted on 5/18/2006 10:47:30 PM

Hi Shanku, this stuff is great!
I wonder if there is a version available for PHP 4.

Thanks!

Posted on 5/18/2006 11:03:19 PM

Hi again!
Just debugged the code and found only one PHP5 exclusive script :

AtlasPHP/AtlasScriptManager.php - line 60: "if (stripos($userAgent, $search) !== FALSE)".
stripos function belongs to PHP5, so I changed "stripos($userAgent, $search)" to "strpos(strtolower($userAgent),strtolower($search))" and that´s it :)

Thanks again! Ariel

Posted on 5/18/2006 11:28:56 PM

Ryan, I'll take a look at running it on IIS, and let you know if there are any gotchas.

Ariel, thanks for the tip.

Posted on 5/26/2006 12:24:54 PM

>>Hi again!
>>Just debugged the code and found only one PHP5 exclusive script :

>>AtlasPHP/AtlasScriptManager.php - line 60: "if (stripos($userAgent, $search) !== FALSE)".
>>stripos function belongs to PHP5, so I changed "stripos($userAgent, $search)" to >>"strpos(strtolower($userAgent),strtolower($search))" and that´s it :)

>>Thanks again! Ariel

Actually it isn't the line of code using PHP 5 specific code:

$method->getDeclaringClass()->getName()

which is used a few times in AtlasProxyGenerator.php and AtlasService.php

Posted on 8/1/2006 7:36:23 PM

I am trying to make your Atlas/PHP examples work on my Windows 2003 Server with PHP on IIS 6.0. I read a post that said in the PHPO ext. I have to turn off check to see if script exists. I have done this and I have since restarted my webserver. It doesn;t seem to work. In firefox, I use the script debugger and I get the following javascript error:

Error: _data.get_length is not a function
Source File: http://justincouto.com/Examples/ScriptLibrary/Debug/Atlas.js
Line: 9622

The above line is this:
var newLength = _data ? _data.get_length() : 0;

I have tried it using the April release of ATLAS and the JULY Release. I would appreciate any help. I would love to use ATLAS with my PHP development.

Thanks!
Justin

Posted on 8/2/2006 10:38:33 AM

Hi Again,

I messaged you yesterday to ask some questions about the Atlas PHP implementation. I have found out that is does work with the JULY release of ATLAS. However, I can't get it to run on IIS 6.0 with PHP5. Do you know if anyone else has had any luck with this? If so, I would love to know the solution. Thanks in advanced!

Please post your comments:
Name:  
Email (optional): Your email address will not be posted.
URL (optional):
Comments: HTML will be ignored, URLs will be converted to hyperlinks  
Enter the text you see in the box:
 
Copyright © 2006 Shanku Niyogi