Parse error: syntax error [closed]
I keep getting "Parse error: syntax error, unexpected '.', expecting ')'" on the first line, I've tried breaking the string up, but then it doesn't embed properly. 开发者_高级运维Anybody know how to sort this?
protected $_embedHTML = array('youtube' => '<object width="425" height="350"
type="application/x-shockwave-flash" '.
'data="http://www.youtube.com/'.$value.'">'.
'<param name="movie" value="http://www.youtube.com/'.$value.'">
</param>'.
'<!--[if IE]>'.
'<embed src="http://www.youtube.com/'.$value.'"'.
'type="application/x-shockwave-flash"'.
'wmode="transparent" width="425" height="350" />'.
'<![endif]-->'.
'</object>');
You can't concatenate data in a class variable definition that way. The initialization value has to be a constant.
Try this:
protected $_embedHTML;
function __construct() {
$this->_embedHTML = array('youtube' => '<object width="425" height="350"
type="application/x-shockwave-flash" '.
data="http://www.youtube.com/'.$value.'">'.
'<param name="movie" value="http://www.youtube.com/'.$value.'">
</param>'.
'<!--[if IE]>'.
'<embed src="http://www.youtube.com/'.$value.'"'.
'type="application/x-shockwave-flash"'.
'wmode="transparent" width="425" height="350" />'.
'<![endif]-->'.
'</object>');
}
Or, strip the concatenation and simply make it a multiline string. I'm not sure why you're not doing this, as it is already composed of multiline strings.
精彩评论