I modified my question because I was able to solve the session problem. But now I have another doubt. I have this code in the Controller to capture the data passed by parameter and save them in Session:
public function SetImageAndColor($client_id) {
if(isset($_GET['color']) AND isset($_GET['image'])) {
$dados[$client_id]['image'] = $this->input->get('image');
$dados[$client_id]['color'] = $this->input->get('color');
$this->session->set_userdata('click2call', $dados);
}
}
The url with the passing of the parameters that I'm using for testing is this:
http://localhost/crm/trunk/click2call?color=4444&image=img.jpg
.
<?php $result = $this->session->userdata('click2call');
foreach ($result as $row) {
print_r($row);
} ?>
And I had as a result:
Array ( [image] => img.jpg [color] => 4444 )
. Right?
Now I want to know how I can use these values within View
. For example, I have this default html:
<header data-color="<?php echo $client->click2call_color; ?>">
<h1>
<?php if($client->click2call_image != ''): ?>
<img src="<?php echo $client->click2call_image; ?>" alt="<?php echo $client->name; ?>"/>
<?php else: ?>
<?php echo lang('click2call_title'); ?></h1>
<?php endif; ?>
Where, if these values are saved in the session:
Color will replace header color - > <header data-color="<?php echo $client->click2call_color; ?>">
and image will replace the image - > img src="<?php echo $client->click2call_image; ?>" alt="<?php echo $client->name; ?>"/>
How can I do this check and assign these values?