Welcome Guest, Not a member yet? Register   Sign In
How to redirect using $this-session-userdata(country_territory)
#7

(09-24-2019, 08:17 AM)Wouter60 Wrote: Why not simply one controller that takes the country as a parameter? If you have a controller for each country, you'll probably have to write a lot of code over and over again. That's bad practice.
I would create a controller, e.g. "Adverts" and in that controller a function which accepts the country as parameter:

PHP Code:
public function show_adverts($country NULL)
{
  if (! $country) {
      show_error('You must include the country in the url!');
      die();
  }
  else {
      //get files form a subfolder for the given country and perform the actions you want.
  }


The url to call this function is:
Code:
https://yourwebsite.com/adverts/show_adverts/Afghanistan

If a user would include another country, all you need to do is handle that in the show_adverts function.

Once I get Afghanistan working good I'll simply copy & paste that controller into the other countries controllers and use a text editor to change the name from Afghanistan to the name of the each country. I can't see my system working otherwise.

Thanks for the additional advice, I'll work on that in the next few days. I intend to download some program scripts from Hotscripts to see if I can get some other ideas.
Reply


Messages In This Thread
RE: How to redirect using $this-session-userdata(country_territory) - by christaliise - 09-24-2019, 09:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB