Welcome Guest, Not a member yet? Register   Sign In
How can I use the function in view of using segments?
#2

[eluser]TWP Marketing[/eluser]
[quote author="Guner ARIK" date="1304048569"]code here
//------------
switch($this->uri->segment(2))
{
case 'login' : return login(); break;
case 'contact' : return contact(); break;
case 'products' : return products(); break;
case 'lang_change' : return lang_change(); break;
}
function login() {
echo "initializing login procedure";
}
function contact() {
echo "initializing cntact form";
}
.............[/quote]

This should be in your CONTROLLER. for instance:
Code:
...
$segment = $this->uri->segment(2);
switch($segment)
  {
    case 'login':       $str = "initializing login procedure"; break;
    case 'contact':     $str = "initializing contact form"; break;
    case 'products':    $str = "initializing products form"; break;
    case 'lang_change': $str = "initializing language change"; break;
    default:            $str = "Error, Invalid segment: '".$segment."' passed."; break
}
// now pass the var $str to the view for display
...


Messages In This Thread
How can I use the function in view of using segments? - by El Forum - 04-28-2011, 04:42 PM
How can I use the function in view of using segments? - by El Forum - 04-29-2011, 01:00 PM
How can I use the function in view of using segments? - by El Forum - 04-29-2011, 09:31 PM
How can I use the function in view of using segments? - by El Forum - 04-30-2011, 01:46 PM
How can I use the function in view of using segments? - by El Forum - 04-30-2011, 01:54 PM



Theme © iAndrew 2016 - Forum software by © MyBB