このMTタグの利用は、現在、推奨されていません。このMTタグを利用するのに必要なJavaScriptを実行すると、Webページの表示速度が著しく低下する恐れがあります。
記事、または、トピックに投票 (お気に入り登録) がある場合に ture (真) を返し、囲んだ内容を処理します。
使い方
この記事は <mt:IfEntryRecommended> お気に入り登録されています。 <mt:Else> お気に入り登録されていません。 </mt:IfEntryRecommended>
上記のMTタグは、以下のHTMLとJavaScriptを出力します。
この記事は
<script type="text/javascript">
function scoredby_script_vote(id) {
var xh = getXmlHttp();
if (!xh) return false;
xh.open('POST', 'http://example.com/cgi-bin/mt-cp.cgi', true);
xh.onreadystatechange = function() {
if ( xh.readyState == 4 ) {
if (xh.status && ( xh.status != 200 ) ) {
// error - ignore
} else {
eval( xh.responseText );
}
}
};
xh.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' );
xh.send( '__mode=vote&id=' + id + '&blog_id=9&f=scored,sum&jsonp=scoredby_script_callback' );
}
function scoredby_script_callback(scores_hash) {
var true_block = getByID('scored_' + 2062);
var false_block = getByID('scored_' + 2062 + '_else');
var span;
if (scores_hash['2062'] && scores_hash['2062'].scored) {
span = getByID('cp_total_' + 2062);
if (true_block)
true_block.style.display = '';
if (false_block)
false_block.style.display = 'none';
}
else {
span = getByID('cp_total_' + 2062 + '_else');
if (true_block)
true_block.style.display = 'none';
if (false_block)
false_block.style.display = '';
}
if (span) {
if (scores_hash['2062'] && scores_hash['2062'].sum)
span.innerHTML = scores_hash['2062'].sum;
else
span.innerHTML = 0;
}
}
</script>
<div id="scored_2062" class="scored" style="display:none">
お気に入り登録されています。
</div>
<div id="scored_2062_else" class="scored-else" style="display:none">
お気に入り登録されていません。
</div>
<script type="text/javascript" src="http://example.com/cgi-bin/mt-cp.cgi?__mode=score&blog_id=9&id=2062&f=scored,sum&jsonp=scoredby_script_callback"></script>
mt:IfEntryRecommended タグを正しく動作させるためには、以下のJavaScriptコードを、出力されるページに記述する必要があります。
function getByID(n, d) {
if (!d) d = document;
if (d.getElementById)
return d.getElementById(n);
else if (d.all)
return d.all[n];
}
MTIfEntryRecommended と関連のあるテンプレートタグ (70)
- MTAssetIfTagged
- MTAuthorHasEntry
- MTAuthorHasPage
- MTBlogIfCCLicense
- MTBlogIfCommentsOpen
- MTCalendarIfBlank
- MTCalendarIfEntries
- MTCalendarIfNoEntries
- MTCalendarIfToday
- MTCategoryIfAllowPings
- MTCommenterIfTrusted
- MTCommentIfModerated
- MTElse
- MTElseIf
- MTEntryIfAllowComments
- MTEntryIfAllowPings
- MTEntryIfCategory
- MTEntryIfCommentsOpen
- MTEntryIfExtended
- MTEntryIfTagged
- MTHasNoParentCategory
- MTHasNoSubCategories
- MTHasParentCategory
- MTHasParentFolder
- MTHasSubCategories
- MTHasSubFolders
- MTIf
- MTIfAllowCommentHTML
- MTIfAnonymousRecommendAllowed
- MTIfArchiveType
- MTIfArchiveTypeEnabled
- MTIfBlogDynamicMTML
- MTIfCategory
- MTIfCommenterIsAuthor
- MTIfCommenterIsEntryAuthor
- MTIfCommenterTrusted
- MTIfCommentParent
- MTIfCommentReplies
- MTIfCommentsAccepted
- MTIfCommentsActive
- MTIfCommentsAllowed
- MTIfCommentsModerated
- MTIfDynamic
- MTIfEntryRecommended
- MTIfFolder
- MTIfIsAncestor
- MTIfIsDescendant
- MTIfLoggedIn
- MTIfMaxResultsCutoff
- MTIfNeedEmail
- MTIfNonEmpty
- MTIfNonZero
- MTIfPingsAccepted
- MTIfPingsActive
- MTIfPingsAllowed
- MTIfPingsModerated
- MTIfRegistrationAllowed
- MTIfRegistrationNotRequired
- MTIfRegistrationRequired
- MTIfRequireCommentEmails
- MTIfStatic
- MTIfStraightSearch
- MTIfTagSearch
- MTIfTypeKeyToken
- MTMultiBlogIfLocalBlog
- MTPageIfTagged
- MTSubCatIsFirst
- MTSubCatIsLast
- MTUnless
- MTWebsiteHasBlog


