![]() |
Parse error: syntax error, unexpected T_ECHO - 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: Parse error: syntax error, unexpected T_ECHO (/showthread.php?tid=43409) |
Parse error: syntax error, unexpected T_ECHO - El Forum - 07-10-2011 [eluser]Mainboard[/eluser] i have a little problem with codeigniter, in the view when i try to call some variables i have this problem, this is my code. My View. Code: <? php foreach ($menu_enc as $menue): ?> Code: <? '<a class="current">destino;'>' echo $menue->nombre_enc; '</a>' ?> Code: <?php endforeach; ?> i try with add echo at the start on the phrase like this Code: <? echo '<a class="current">destino;'>' echo $menue->nombre_enc; '</a>'; ?> but not works, and i don't know why in the preview doesn't appear the href="'echo $menue->link; so i what i can do? i know that is a some problem with the syntax but i can't find the correct syntax Parse error: syntax error, unexpected T_ECHO - El Forum - 07-10-2011 [eluser]jmadsen[/eluser] Thank you for moving your question over here. CodeIgniter syntax is php syntax; you need to do things in the same way. Code: <?php '<a class="current">destino;'>' echo $menue->nombre_enc; '</a>' ?> should read: Code: <?php echo '<a class="current">' . $menue->nombre_enc . '</a>'; ?> I don't understand "destino" - is this the href="" part, and does it come from your database? Grrr..the forum is making a mess of the html code!! If $menue->destino is your href, then use: Code: href=" " Code: '.$menue->destino.' ---- Here are some more resources for understanding "concatenation": An easy to read tutorial: http://phphowto.blogspot.com/2006/12/concatenate-strings.html The manual: http://php.net/manual/en/language.operators.string.php Parse error: syntax error, unexpected T_ECHO - El Forum - 07-11-2011 [eluser]Anonymous[/eluser] This should work Code: <?php |