CodeIgniter Forums

Full Version: url library/anchor function for content on database content
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

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
class Main extends CI_Controller {
function __construct() {

public function index() {
  $query = "SELECT id, recipe, instruc FROM main WHERE id='".$id."'";
  if ($recipe) {
   $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:
<?php echo $recipe_instruc?>

The section of text returned from the database is as follows:
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?