Welcome Guest, Not a member yet? Register   Sign In
Is there a function in the URL helper that I can use to create a link that is not based on the site url? (Like Anchor an
#1

[eluser]Unknown[/eluser]
Hi!

Okay, so I have this form where a user inputs a document name, and its path. Here's the main function in my controller:
Code:
public function main(){
  (!isset($_SESSION['uid'])) ? session_start() : false;
  
  $this->load->helper(array('date','url','html','form'));
  $this->load->library('table');
  $this->table->set_template($this->tmpl);
  
  $space = array('src' => 'images/spacer.png');
  
  $this->data['uname'] = $_SESSION['uid'];
  $this->data['fullname'] = $_SESSION['name'];
  $this->data['email'] = $_SESSION['email'];
  $this->data['date'] = date('l, F j, o',now());
  $this->data['title'] = project_name;
  $this->data['label'] = "My Documents";
  
  $this->user = $_SESSION['uid'];
  $this->load->model('Document','doc');
  $this->load->model('Utilities','util');
  
  $where = array('UPLOADED_BY'=>$this->user);
  
  $rs = $this->doc->get($where);
  
  $users = $this->util->dropdrown_data('users', false, 'userid','fullname');
  $this->table->set_heading('Document Name', 'Path (eLib)', 'Project Ref. #', 'Uploaded By','');
  
  $count = 0;
  for($i=0; $i<count($rs); $i++){
   $action = array('data'=> anchor('/documents/edit_document/'.$rs[$i]['doc_id'],'Edit').' | '.
          anchor('/documents/delete_document/'.$rs[$i]['doc_id'],'Delete'),
       'align' => 'center');
  
   $this->table->add_row(
    anchor($rs[$i]['path'],$rs[$i]['doc_name']),
    anchor($rs[$i]['path'],$rs[$i]['path']),
    anchor('/projects/projectmain/'.$rs[$i]['project_reference'],$rs[$i]['project_reference']),
    $users[$rs[$i]['uploaded_by']],
    $action
    );
   $count++;
  }
  
  if($count == 0)
   $this->table->add_row('No record found for');
  $this->data['disp'] = $this->table->generate();
  $this->load->view($this->view, $this->data);
}

When the form loads, it should show the details of the saved documents, including the path which is inside the anchor() function to link it to the document. So I have tried to do this to try if it's working:

I inputted nicx.doc as the doc_name, and 10.xxx.xxx.xxx/nicx.doc as my path. It is inside an anchor, so a link is made. When this link is clicked, it should go to 10.xxx.xxx.xxx/nicx.doc which automatically saves the file. But it doesn't. Instead, it includes my site url, eg. 10.xxx.xxx.xxx/project/index.php/10.xxx.xxx.xxx/nicx.doc. I wanted to put out the 10.xxx.xxx.xxx/project/index.php.

In my URL helper, I found the anchor function. I tried to make a function there, putting out the site_url on the anchor functions and renaming it to anc. But, it gives me no success. Is there any way for this?




Theme © iAndrew 2016 - Forum software by © MyBB