kalimati Posted July 16, 2019 Share Posted July 16, 2019 <?php /** * Program Listings * Included in Programs Template */ $out = "<div class='uk-grid-small uk-child-width-1-2@s uk-flex-center' uk-grid>"; foreach($page->children() as $program) { $out .= "<div>"; $out .= "<div class='uk-child-width-1-2@s' uk-grid>"; if (count($program->images)) { $firstImage = $program->images->first(); $firstImage->size(320, 240); $out .= "<div><img src='{$firstImage->url}' alt='{$firstImage->description}'></div>"; // Line 17 } else { $out .= "<div> </div>"; } $out .= "<div><p>$program->date</p><p>$program->headline</p><p>$program->body</p></div>"; $out .= "</div></div>"; } $out .= "</div>"; echo $out; ?> Can anyone please tell me why do I get syntax error, unexpected '' (T_STRING) on line 17? Thank you. Link to comment Share on other sites More sharing options...
dragan Posted July 16, 2019 Share Posted July 16, 2019 You have a lot of weird invisible characters in your code - this happens sometimes when you copy-and-paste from forums. Luckily, good text editors / IDEs spot such stuff and give warnings. I cleaned up your code and attached it here (together with two minor hints re: code) kalimati.zip 4 Link to comment Share on other sites More sharing options...
kalimati Posted July 17, 2019 Author Share Posted July 17, 2019 Thanks dragan. That must have been it. The cleaned code worked. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now