views:

32

answers:

2
<img src = "<?= $link ?>"></img>

Short tags is enabled in php.ini and in config.php of codeigniter. Also tried

<img src = "<?php echo $link; ?>"></img>

but doesn't work. In the HTML output its just "", although a simple <?php echo $link; ?> does work.

A: 

Are you actually passing the variable to the view via the load call? See the "Adding Dynamic Data to a View" section of this page in the user guide.

Amber
no, i am using an array to pass the link. like `$data['link'] = $link;` and then `$this->load->view('photo', $data);`
Angad Singh
A: 

Seems like the var isn't getting passed to the view.

Try:

<?php
$link="http://www.google.com/images/srpr/nav_logo13.png";
?>

<img src = "<?php echo $link; ?>"></img>

just to be certain there isn't something else going on. If you can see the image, something is preventing the var from getting to the view.

Can you edit your question to add the controller code that is sending the variable to the view?

stormdrain