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

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.
Reply


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



Theme © iAndrew 2016 - Forum software by © MyBB