I am building a simple system in CodeIgniter for a client of mine. I want to use str_replace
to replace a tag like {company_name} into a value but I seem to cannot get this to work.
My current code is:
<?php
$this->db->where('id', '1');
$data = $this->db->get('pages');
$output = array('row' => $data->row());
$this->template->load('frontend/template', 'frontend/page', $output);
My try was:
<?php
$this->db->where('id', '1');
$data = $this->db->get('pages');
$output = str_replace(
array("{company_name}"),
array("Sample company"),
$data->row()
);
$this->template->load('frontend/template', 'frontend/page', $output);
But I think I am currently on the wrong path as nothing displays anymore and I want some help or explanation on what I am doing wrong here. Thank you.