• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
url library/anchor function for content on database content

#1
[eluser]dwlamb[/eluser]
I have need for an anchor tag embedded within content drawn from the database for the application I am working on. Yet, for some reason CI is not executing the anchor function.

These are relevant sections within my controller for this app
Code:
class Main extends CI_Controller {
function __construct() {
  parent::__construct();

  $this->load->helper('url');
....
}
public function index() {
.....
  $query = "SELECT id, recipe, instruc FROM main WHERE id='".$id."'";
  $recipe=$this->db->query($query)->result_array();
  if ($recipe) {
   $recipe=$recipe[0];
   $data['recipe_title'] = $recipe['recipe'];
   $data['recipe_instruc'] = $recipe['instruc'];
   $data['navigation'] = $this->main_model->buildMenu();
  }
.....

In my View, url helper is also loaded and the value from the $data array echoed with appropriate syntax:
Code:
<?php echo $recipe_instruc?>


The section of text returned from the database is as follows:
Code:
Serve over ice cream or <?php echo anchor('main/index/7', 'profiteroles');?>

The above quoted text is a snippet of the overall block of text returned from the database. All the rest of the text echos properly to the view. The section of text that should echo as a coded anchor tag does not.

I can understand the anchor function not being executed at the Controller level but it should execute at the View level, no?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.