CodeIgniter Forums
anchor target - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: anchor target (/showthread.php?tid=44138)



anchor target - El Forum - 08-04-2011

[eluser]Mainboard[/eluser]
hey, i want to know how i can to add the target in the anchor function, i have this

Code:
$html_out .= "\t\t\t".'<li>'.'<a name='.$title.' id='.$id.' target='.$target.'><span>'.$title.'<span></a>';

and i want to add the attribute target in this line

Code:
$html_out .= "\t\t\t".'<li>'.anchor($url.' '. $this->class_parent, '<span>'.$title.'</span>');

a read the function and i know that i need to add the attributes at the end, but doesn't work, i think that is problem for the sintax that i have


anchor target - El Forum - 08-04-2011

[eluser]rwestergren[/eluser]
Attributes should be passed as the third parameter.

Code:
$html_out .= "\t\t\t".'<li>'.anchor($url.' '. $this->class_parent, '<span>'.$title.'</span>', 'target=\"_blank\"');



anchor target - El Forum - 08-04-2011

[eluser]Mainboard[/eluser]
thanks, but, i put to this way because $target is variable that i caching in my db
Code:
$html_out .= "\t\t\t".'<li>'.anchor($url,  '<span>'.$title.'</span>', $target);
but doesn't works because the target don't recognizes the string that i caching in the db, the target call me one main that i use in a iframe to reload one html page in other html page, but the first line that i put in the first post it works, so i need to use the anchor function for security reasons


anchor target - El Forum - 08-05-2011

[eluser]Aken[/eluser]
Code:
$html_out = "\t\t\t".'<li>'.anchor($url.' '. $this->class_parent, '<span>'.$title.'</span>', 'name="'.$title.'" id="'.$id.'" target="'.$target.'"');