I have the following code in my view, but it’s pretty hard to read. I have read about the Codeigniter url helper and anchor(), but I can’t seem to make it much cleaner in there either.
<a href="<?php echo base_url() ?>games/<?php echo $row['slug']; ?>" title="<?php echo $row['title']; ?>"> <?php echo $row['title']; ?></a>
How can I clean this up?
You can pass the segments you require to the base_url() method, like this:
This is cleaner and would give you the same result, however this might be a better option:
One tag, no need to declare PHP tags for each part that is dynamic and it takes care of the HTML output for you.