Reputation: 556
I need to put some cobinated HTML PHP code in the second parameter of the str_replace
function in CodeIgniter.
<a href="<?=base_url();?>pages/articles/<?=str_replace($replace_simbols, '-', $category);?>.html" ></a>
<dt><?=character_limiter($categoryEntry1[2],110).'<a href="NEED TO PUT HERE ATRIBUTE FROM FIRST a href" >'.'<img class="read_more" src="/img/read_more.png" alt="read more" title="Read more..." /></a>'?></dt>
$replace_symbols , var contain (some symbols).
How can I do this?
Upvotes: 1
Views: 107
Reputation: 792
Try:
$href = base_url() . "pages/articles/" . str_replace($replace_simbols, '-', $category) . ".html";
<a href="<?php echo $href;?>"></a>
<dt><?=character_limiter($categoryEntry1[2],110).'<a href="' . $href . '" >'.'<img class="read_more" src="/img/read_more.png" alt="read more" title="Read more..." /></a>'?></dt>
Upvotes: 2
Reputation: 5363
Why not just put everything in a variable? Btw since when does codeigniter have .html extension
$href_link = base_url() . "pages/articles/" . str_replace($replace_simbols, '-', $category);
<a href="<?=$href_link;?>.html" ></a>
<dt><?=character_limiter($categoryEntry1[2],110).'<a href="<?=$href_link;?>.html">'.'<img class="read_more" src="/img/read_more.png" alt="read more" title="Read more..." /></a>'?></dt>
Upvotes: 3