Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-01-26 04:53:50

fungi
Member
Registered: 2008-11-09
Posts: 16
Website

Calling PHP scripts on subpages...

Hello everyone. I’ve made a PHP script that I’ve tested and works perfectly when it is being called from my index page. When I create a new section however, and therefore a subpage of my site the same call to “textpattern/myfile.php” does not work. The issue I’m experiencing probably has something to do with my poor understanding of how a subpage works and where it is stored within textpattern, but if anyone could offer up an explanation or a fix for this I would greatly appreciate it. Thank You.

Offline

#2 2009-01-26 04:58:37

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Calling PHP scripts on subpages...

I assume you mean that a link on your page to textpattern/myfile.php doesn’t work? Just use a root relative URL.

e.g:

If Txp is installed at http://yoursite.com/, then link to /textpattern/myfile.php. Or if it is installed http://yoursite.com/folder/, link to /folder/textpattern/myfile.php.

Offline

#3 2009-01-27 00:08:41

fungi
Member
Registered: 2008-11-09
Posts: 16
Website

Re: Calling PHP scripts on subpages...

Sorry, allow me to be more specific. I’ve tried the usual things including /subpagename/textpattern/myfile.php in the file call… Basically I have a form set to action=“textpattern/myfile.php” Now.. all that works fine for the form on my index page(mysite.com) but when I created a new section and the user clicks through to the subpage(mysite.com/subpagename/) the form no longer works even though it is set up exactly the same way I set it up for the index page. So now I don’t understand what it is about the path to the file would be different. It’s still located in the same place so why can’t it find the .php file? The error I’m see is a 404 not found page and a URL that looks something like this.. “http://mysite.com/subpagename/textpattern/myfile.php/?formrequest=formdata”<—last part is whatever data was entered into the form. Does that paint a clearer picture? Thank you to anyone that can help.

Offline

#4 2009-01-27 00:11:41

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Calling PHP scripts on subpages...

fungi wrote:

Basically I have a form set to action=“textpattern/myfile.php”

Change that to action="/textpattern/myfile.php", like Mary said.

Offline

#5 2009-01-27 00:51:24

fungi
Member
Registered: 2008-11-09
Posts: 16
Website

Re: Calling PHP scripts on subpages...

Els, you are right once again as were you Mary, Sorry for not catching the additional “/” the first time. I guess I was fooled by the fact that it would work off of the index page without it. Doh, thank you folks, this forum is the best.

Offline

Board footer

Powered by FluxBB