Converting legacy PHP app.

Permalink
I have a legacy PHP app that has its own db. Is it possible (somewhat easy programatically)to convert?

Here is what legacy is riddled with:

<FORM NAME = PSearch FORM METHOD = "POST" ACTION = "SearchResult.php?sname=$sname">

-->then that has post to details, all have custom sql.

pulls a list, loops a cursor and adds this to the link

$person2 = "<a href =\"Details.php?PID=$pid\">$person</a><BR>"
;
$pos = $r_srch['somevalue1'];
$frch = $r_srch['somevalue2'];

$row2 .="
<table Border = 0 Cellpadding=0 CellSpacing =0 Width = 100%>
<TR>
<TD Align=Left WIDTH=40%>$person2</TD>
<TD Align=Left WIDTH=10%>$pos</TD>

I easily added a php page that runs the search and pulls values and view within the block... but I dont know where to serve (view) these items link items. when I click on them I get a page not found. I modified it to not use the index.php controller. That allows data but does not server to a block or anywhere in concrete5. How do I serve to another page in concrete5?
Any help would be appreciated.
Thanks

teamdb
 
formigo replied on at Permalink Reply
formigo
I'd approach this with a single page and controller, your form would be the default view, your form post would route to a search method using:-

action="<?php echo  $this->action('mySearchMethod');?>"


Then for all your person links with querystring variables you can approach it in a similar way but you'd route using a path only i.e single_page/details/pid/123.

So you output urls of the above format in your search method, where 'single_page' is your single page (and controller which supports it), 'details' is your method in the controller and pid represents your $pid variable, which is followed by it's value, which in my example is 123.

This post by Andrew might help you get the hang the MVC routing in concrete5:-
http://andrewembler.com/posts/basic-mvc-in-concrete5/...

Hope that get's you started.
csebe replied on at Permalink Reply
I'm not sure if I understand your problem correctly but it seems to me you could use the PHP Code Block free addon from herehttp://www.concrete5.org/marketplace/addons/php-code-block... and pretty much just copy your custom code in there, and keep it "isolated" from C5's code (having obviously some downsides for this, like not using some good DB access classes and other potentially useful utilities, caching, searching, etc).

You can put this block on any page you want in the C5 "regular pages" (not "single pages") and the your code will get access to variables sent by GET/POST requests and you can reuse the same page to print out the tabular result if you want.

Hth,

Lian