我試圖創建一個if-else語句,它會返回不同的div。我相信這是失敗的,因爲else語句中有太多'
。如何php if else聲明並返回不同的div?
<?php $blogentryid = get_the_ID();
if ($blogentryid=="1572") {
echo '<div>Hello</div>'
}
else {
echo '<div class="socialnews2"><!-- start div social-->
<div class="twitternews2">
<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-text="<?php the_title(); ?>" d
ata-url="<?php the_permalink() ?>" data-via="giantmangocom">Tweet</a>
<script type="text/javascript">
//async script, twitter button fashiolista.com style
(function() {
var s = document.createElement('SCRIPT');
var c = document.getElementsByTagName('script')[0];
s.type = 'text/javascript';
s.async = true;
s.src = 'http://platform.twitter.com/widgets.js';
c.parentNode.insertBefore(s, c);
})();
</script>
</div>
</div>
<div class="facebooknews2">
<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&layout=button_count&
amp;show_faces=false&width=80&action=like&colorscheme=light;height=21"" scrolling="no" frameborder="0" style="border:none; overflow:hidden; wid
th:80px; height:21px;" allowTransparency="true"></iframe>
</div>'
}
?>