NuSphere Forums Forum Index
NuSphere Forums
Reply to topic


Joined: 03 Mar 2007
Posts: 72
Reply with quote
Dmitri,

I'm going to e-mail you two solutions. These are complete PhpDock applications. I don't know how else to demonstrate this. A simple code block is a little insufficient.

Perhaps there is a way you could share with everyone then?

It's up to you.

Randy
View user's profileFind all posts by randySend private messageVisit poster's website


Joined: 03 Mar 2007
Posts: 72
Reply with quote
If you're following this thread....


Basically what this came down to is using the PhpDock error handler for your 404 errors redirect everything back to your index.php.

As Dmitri pointed out, almost everything you need is already in the $_SERVER array. All you need to do is pull from that.

The trick with these URLs, especially when we use mod_rewrite and .htaccess with Apache, is that we remove index.php or we place a '/' directly after index.php. That creates a problem for any web server because it obscures the MIME type and the web server (PhpDock in this case) from discovering it. Apache has the same problem...that's why mod_rewrite and .htaccess exists.

If PhpDock has trouble determining what document to load up, it puts the entire string after the host.tld:port into $_SERVER['ERROR_DOCUMENT']. So you can test for this array element. If it exists, you have a link without a MIME type or a real 404. If it doesn't exist, then you should load up your 'real' index file.

So all you have to do is redirect every error page to your index.php file. Then, like Dmitri said (he get's all the credit here), trap that $_SERVER array element.

I've provided Dmitri two full examples. One example is a straight example without any type of fancy framework footwork. The other example uses the CodeIgniter Framework to show how this technique can be used with frameworks as well. I should point out that I trimmed CodeIgniter down to the bear essentials to make this as small as possible. If you intend on using this, you should go get a full copy of CI.

Hope this is helpful,

Randy
View user's profileFind all posts by randySend private messageVisit poster's website


Joined: 03 Mar 2007
Posts: 72
Reply with quote
randy wrote:
Dmitri,

I'm going to e-mail you two solutions. These are complete PhpDock applications. I don't know how else to demonstrate this. A simple code block is a little insufficient.

Perhaps there is a way you could share with everyone then?

It's up to you.

Randy


Dmitri,

You must have changed your e-mail address or the attachments we're rejected. My e-mail got bounced. I'll try to PM them to you.

Randy
View user's profileFind all posts by randySend private messageVisit poster's website


Joined: 03 Mar 2007
Posts: 72
Reply with quote
randy wrote:
Dmitri,

I'm going to e-mail you two solutions. These are complete PhpDock applications. I don't know how else to demonstrate this. A simple code block is a little insufficient.

Perhaps there is a way you could share with everyone then?

It's up to you.

Randy


Um....

Never mind. Is there anyway for me to get these files to you?
View user's profileFind all posts by randySend private messageVisit poster's website


Joined: 14 Jan 2009
Posts: 5
Reply with quote
hi randy,

could you mail me the examples because i can't seem to get it to work. Address is tim[removeme]@twixel.be

grtz
View user's profileFind all posts by TimBroddinSend private message


Joined: 03 Mar 2007
Posts: 72
Reply with quote
TimBroddin wrote:
hi randy,

could you mail me the examples because i can't seem to get it to work. Address is tim[removeme]@twixel.be

grtz


On the way...
View user's profileFind all posts by randySend private messageVisit poster's website


Joined: 14 Jan 2009
Posts: 5
Reply with quote
thanks a lot!

i seem to get it to work by pointing the 404 to the index.php

however, on some pages the webserver tries to send me (download dialog) the index.php file instead of parsing it

any ideas?
View user's profileFind all posts by TimBroddinSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8342
Reply with quote
you may want to check if your script outputs Content-Type header.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 03 Mar 2007
Posts: 72
Reply with quote
TimBroddin wrote:
thanks a lot!

i seem to get it to work by pointing the 404 to the index.php

however, on some pages the webserver tries to send me (download dialog) the index.php file instead of parsing it

any ideas?


I'm sure you've already verified this...but...

This is likely because you have your URL constructed incorrectly or it is being constructed by ZF incorrectly.

Your URL must be in the form: scheme :// hostname . tld / controller / method / var / var / var / etc ... (with no spaces)

Please ensure ZF is not putting index.php and or /? and or ?/ and or ? back into the URL witout you realizing it. All these things will break your app just as the test page says in the CodeIgniter test says.
View user's profileFind all posts by randySend private messageVisit poster's website


Joined: 14 Jan 2009
Posts: 5
Reply with quote
I configured the ZF-Rewriter to skip the index.php . However the url's that PHPDock wants to load are of this type: http://localhost:8100/e:/phpdock/web/entry/add

My documentroot is set to the 'public' folder, all my other ZF folders (which should not be public) are in the PHPDock root dir.

This is the HTTPClient section

[HTTPClient]
InitialUrl=http://localhost:${HTTPServer:Listen}/index.php
BlockPopups=0
DefaultDocument=.\public\index.php
;
View user's profileFind all posts by TimBroddinSend private message


Joined: 14 Jan 2009
Posts: 5
Reply with quote
Found it, the code ran into a "catchable fatal error" which did nothing on Linux (because it was catched Smile) but gave problems with PHPDock. Fixed it and now it works Smile
View user's profileFind all posts by TimBroddinSend private message


Joined: 03 Mar 2007
Posts: 72
Reply with quote
TimBroddin wrote:
Found it, the code ran into a "catchable fatal error" which did nothing on Linux (because it was catched Smile) but gave problems with PHPDock. Fixed it and now it works Smile


Glad you got it sorted out. So we now have a ZF and CodeIgniter SEO friendly method of using PhpDock. I think that is awsome.

For anyone following this thread, the reason, once again, is so I don't have to write two apps. This allows me to write one app one way and use SEO friendly URLs on the web and then move that app to the desktop using PhpDock with little modification.

Thanks for the validating with ZF Tim.

Regards,

Randy
View user's profileFind all posts by randySend private messageVisit poster's website
SEO friendly URLs in the form of http://HOST/index.php/yada/
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
All times are GMT - 5 Hours  
Page 2 of 3  

  
  
 Reply to topic