Tools pages not loading

Permalink
Hi guys

I have ran onto a problem that I just cant seem to solve, and hope you guys can help me. Would really appreciate your input.

The problem is this. When i try to point an url to, and load a php file in the root/tools directory, a blank page loads. None of the content of the page, just a blank white page.

I´ll give you a bit more background info.
In my site i have a single page with a form on it. This page works like a charm. The form posts to a PHP script in root/tools, and this script is to redirect to another page after it has done its business. To test that the form posts correctly, the script in the tools page currently only echoes "Hello world", and does not redirect or do anything else. This is to check if i actually manage to post the form to the tools page. However here is the issue. When i submit the form i seem t be redirected to the correct tools URLI, but the page loads as just a blank page. This is on my local MAMP testserver. When i upload the site to my live server, the tools page correctly echoes "Hello world".

The details are like this:
- The form is on a single page living at root/index.php/casting-basen/people_search/
- The tools file is located at root/index.php/tools/people_search_query/

In my form i post to the following URL (or generate the url with):
echo Loader::helper('concrete/urls')->getToolsURL('search_people_query')
This gives med this URL:
/index.php/tools/search_people_query

On my live site this works like a charm and echoes "Hello world", but on my testserver i only get a white page when posting the form. There are html tags on the page, but nothing else. I dont get a 404, so it seems to find the page, but the page is empty.

The only differense i know between the test server and the live one is that the site root ishttp://www.miriamlarsen.no on the live server, and localhost:8888 on the testserver.

One last thing i have figured out that might help you help me. On my testserver it works to post the form to the tools page by using a relative path like "../../tools/search_people_query.php. This loads the "Hello world", but does not seem to load any of the C5 wrapping elements so it does not work with actual content in the script file. On the live server however this way of relative path pointing to the tools script does not work . There i need to use the "echo Loader::helper('concrete/urls')->getToolsURL('search_people_query')", and everyting works as it should.

I have been digging around in forums both ere and other places for ever now, but i just cant find any post that really solves this, and i kind of need it solved to be able to continue developing on my testserver. I really hope you guys can help me. Please let me know if I can provide any more info or if you need anything else to figure this one out.

Best regards
Caspar

View Replies:
formigo replied on at Permalink Reply
formigo
You might be complicating things using tools in this context. Your single page can post back to itself, if you add in a controller for that single page, you can perform all you logic and redirects right there in the controller. I would do it this way, generally only using tools files for ajax calls.

This page might help if you wanted to go this route:-
http://www.concrete5.org/documentation/developers/pages/mvc-approac...

Best

Ollie
casparw replied on at Permalink Reply
Hi Ollie

Thanks! Thats actually a very good suggestion. Seems like a much smoother way to do it and i will avoid all the path trouble. Almost embarrassed i didn´t think of doing it that way. I´ll try setting it up like that tomorrow.

However i will still face the issue with the tools pages not loading from the correct path with the correct C5 wrapping on my local server when doing ajax calls to the tools dir so if anyone has a solution or experience with this issue please let me know.

Best regards
Caspar
RadiantWeb replied on at Permalink Reply
RadiantWeb
well, there's several ways to get your tools path. The API provides package and block path URL gens. I have found that even getting the package assets path and then completing the path with /tools/file works. I would check out the concrete/urls helper and try different ways. Context is everything.

ChadStrat
casparw replied on at Permalink Reply
Hi.

I tried fiddling around with the different paths, but it didnt seem to help. The weird thing is that the paths work fine on my live server, but only returns a white blank page (with html tags) on my local server. So the path seem to be right, but the local intall of C5 seems to be blocking the tools pages or something.

Caspar