Welcome Guest, Not a member yet? Register   Sign In
URI Segments and links
#1
Sad 

Hi,
I have a problem in redirecting my links after using links with 3 parameters. That is, controller , action and parameter . Ok using a link like this <a href="House/register/1">Edit the house</a>
I walk normally on the page and the right value ( 1). But my mistake is when I click a button on this page to return to the management page "House/index". This button there is this link <a href="House">Come back to the management Houses</a> , which would trigger a House controller and the index action. Ex.: www.web.com/House/index . But my URL is www.web.com/House/register/House, ie the link is becoming a parameter and not a redirect to the controller.


PHP Code:
<?php

if (!defined('BASEPATH'))
    exit(
'No direct script access allowed');

include_once(
APPPATH 'controllers/IdwellerController.php');

class 
House extends IdwellerController{

    public function 
__construct() {
        
parent::__construct();
        
$this->load->helper('url');
        
$this->load->model('houses');
    }

    public function 
index() {
        
$this->setTitle('House management');
        
        
$dataOfAllHouses$this->houses->returnAllHouses();
        
        
$rows = array();
        foreach(
$dataOfAllHousesas $arrayOfValues){
            
$rows[] = $arrayOfValues;
        }
        
$dataToView= array(
            
'bloco_lista_residencia' => $rows
            
);

        
$this->pushToScreen($dataToView);
    }


    public function 
register(){
        if(
$this->uri->segment(30)){
            
$this->setTitle('House Edit');
            
$idHouse$this->uri->segment(3,0);
            
$dataToView$this->houses->returnDataHouseOfId($idHouse);
        }
        
$this->pushToScreen($dataToView);
    }


Reply


Messages In This Thread
URI Segments and links - by ramon183 - 07-02-2015, 02:50 PM
RE: URI Segments and links - by Avenirer - 07-03-2015, 01:07 AM
RE: URI Segments and links - by ramon183 - 07-03-2015, 07:44 AM
RE: URI Segments and links - by CroNiX - 07-03-2015, 09:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB