Jump to content

syntax error, unexpected '' (T_STRING)


kalimati
 Share

Recommended Posts

<?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

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

  • Like 4
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...