Welcome Guest, Not a member yet? Register   Sign In
Converting an old ASP application to a modular CI application
#1

[eluser]SitesByJoe[/eluser]
I'm intrigued to hear thoughts on this:

I made an online application years back (http://idx.sitesbyjoe.com) and on it are links to local real estate agents that use this old search engine.

This was built years ago and is strictly procedural in its design. If you view the different sites you can see that each agent using it has a series of files in their own directory, like:

http://idx.sitesbyjoe.com/agents/powerplay/
http://idx.sitesbyjoe.com/agents/jewell/
http://idx.sitesbyjoe.com/agents/new_purdy/
etc...

Each agent's directory contains their own HTML template (that matches their existing website), some CSS to customize the search's appearance. There are also the ASP files that do everything but (fortunately) they simply call files from a deeper "core_files" directory. This was my original ASP "framework" I was building without knowing it.

In the meantime, I slapped to together a quick and ugly CI engine (http://idx.sitesbyjoe.com) for testing and I want to eventually run the agent's site's searches from the same engine.

The confusing part is how visitors would get directed to the appropriate agent's site:

I thought about using an "agents" controller that used the next segment with the agent's name for the controller function - or put it into a _remap or something. Sounds overly complex I think.

I thought about using sessions - I can see that falling apart fast - especially since I'd like people to be free and search without being in one of the agent's sections.

I have other applications I had made this way way back.... I'm trying to get my head around that particular obstacle....

...your CI expert opinions?

THANKS!
#2

[eluser]Rick Jolly[/eluser]
You could route every agent through one method and use the agent name to get the view template and agent and listing data from the database.
Code:
$route['agents/(.+)'] = "agents/index/$1";
#3

[eluser]SitesByJoe[/eluser]
Nice! I've never used custom routing yet! That should do it.
#4

[eluser]SitesByJoe[/eluser]
I took your advice and it works great!

Code:
$route['agents/(.+)/search'] = "agents/search/$1";
$route['agents/(.+)/detail'] = "agents/detail/$1";

// etc, then a catch-all
$route['agents/(.+)'] = "agents/index/$1";

Is there a way to display the re-written route for further testing?
#5

[eluser]Colin Williams[/eluser]
$this->uri->uri_string() = what's in the address bar
$this->uri->ruri_string() = what CI interpreted it to be after routing




Theme © iAndrew 2016 - Forum software by © MyBB