Movable Typeの条件文(if)

| | カテゴリ : Movable Type , サイト制作 | コメント(67) | トラックバック(0)
このエントリーをはてなブックマークに追加  
Movable Typeにも条件文がいくつかあります。

「もし?だったら」の「if」を紹介します。
Movable Typeのテンプレートを意図した表示を行うために、必要な条件文になります。「ブログ」や「サイト」構築に殆ど使用することになります。

CやPerlの言語なら以下になります。
if(条件式)
{
 条件一致(真)の処理;
}

Movable Typeの場合は以下になります。
<MTIf name="変数名" 条件式>
 条件一致(真)の処理
</MTIf>

まずは、値と値を代入するための変数名をセットします。
以下のMovable Typeタグを使用します。
<MTSetVarBlock name="変数名">値</MTSetVarBlock>

今回は、現在の記事のタイトルを値にセットし、変数「entry_title」に代入します。
記事のタイトルは、Movable Typeタグの「<$MTEntryTitle$>」で呼び出すことが出来ます。

変数名と値のセットは以下になります。
<MTSetVarBlock name="entry_title"><$MTEntryTitle$></MTSetVarBlock>

条件を行います。

今回の記事のタイトルは、「Movable Typeの条件文(if)」になるので、このタイトル比較対象にし一致(真)した場合の処理を行います。

比較するための演算子(比較演算子)を使う必要があります。これは他の言語でも同じです。
今回は、一致(真)の場合なので、eq=""を使います。

以下のようになります。
<MTSetVarBlock name="entry_title"><$MTEntryTitle$></MTSetVarBlock>
<MTIf name="entry_title" eq="Movable Typeの条件文(if)">
 記事のタイトルが一致しました。
</MTIf>

実際の処理の結果
 記事のタイトルが一致しました。

もちろん条件式に一致しなかった場合の、elseも使用することが出来ます。
<MTElse>?</MTElse>内に偽の処理を指定します。

今回は、現在の記事のタイトルと違う記事のタイトルを比較し、一致(偽)しなかった場合の処理を行います。
違う記事のタイトルは、「Movable Typeのメリット」とします。

以下のようになります。
<MTSetVarBlock name="entry_title"><$MTEntryTitle$></MTSetVarBlock>
<MTIf name="entry_title" eq="Movable Typeのメリット">
 記事のタイトルが一致しました。
<MTElse>
 記事のタイトルが一致しませんでした。
</MTElse>
</MTIf>

実際の処理の結果
 記事のタイトルが一致しませんでした。

<MTElseIf 条件式>を使用することで、さらに条件を繋げていくことも出来ます。
また、<MTIf>とは逆の条件文、<MTUnless>もあります。

比較演算子も他言語と同様あります。
  • like="" : 一部でも含まれれば真
  • eq="" : 一致すれば真
  • ne="" : 一致しなければ真
  • lt="" : 大きければ真
  • gt="" : 小さければ真
  • le="" : 以上であれば真
  • ge="" : 以下であれば真

トラックバック(0)

このブログ記事を参照しているブログ一覧: Movable Typeの条件文(if)

このブログ記事に対するトラックバックURL: http://takot.sakura.ne.jp/mt/mt-tb.cgi/631

コメント(67)

Hi, after reading this remarkable piece of writing i am
as well delighted to share my familiarity here with colleagues.

buy cbd oil evansville in buy cbd oil cape town buy cbd oil green roads buy
cbd oil copenhagen buy cbd oil buy cbd oil dischem buy cbd oil
brighton

Please let me know if you're looking for a writer for your blog.

You have some really great posts and I think I
would be a good asset. If you ever want to take
some of the load off, I'd really like to write some content for your blog in exchange for a link
back to mine. Please send me an e-mail if interested.
Cheers!

I enjoy what you guys tend to be up too. Such clever work and coverage!
Keep up the good works guys I've added you guys to our blogroll.

Oh my goodness! Impressive article dude! Thanks, However I am going through troubles with your RSS.
I don't understand why I cannot join it. Is
there anybody else having similar RSS problems? Anybody
who knows the answer will you kindly respond?
Thanx!!

Pretty nice post. I just stumbled upon your blog and wished to say that
I've really enjoyed surfing around your blog posts.
In any case I'll be subscribing on your feed and I'm
hoping you write again very soon!

It's amazing to pay a visit this site and reading the views of all friends concerning this piece of writing,
while I am also keen of getting know-how.

What's up to all, the contents existing at this website are
in fact amazing for people knowledge, well,
keep up the good work fellows.

What's up, I log on to your blog like every week.
Your humoristic style is awesome, keep up the good work!

First of all I want to say awesome blog! I had a quick question which
I'd like to ask if you do not mind. I was interested to know how you center yourself and
clear your head before writing. I have had a hard time clearing my thoughts in getting my ideas out.
I truly do enjoy writing but it just seems like the first 10 to 15 minutes
are usually lost simply just trying to figure
out how to begin. Any ideas or tips? Appreciate it!

Everything is very open with a really clear explanation of
the issues. It was definitely informative. Your site is useful.
Many thanks for sharing!

Good post but I was wanting to know if you could write a litte more on this topic?
I'd be very thankful if you could elaborate a little bit
further. Bless you!

Nice post. I learn someething new and challenging
on sites I stumbleupon everyday. It will always be helpful
to read trough articles from other authors and use a little something from their sites.

I think the admin of this web site is actually working hard in favor of his website, for the reason that here every material is
quality based information. http://www.melovers.com/users/MarilynnTo/info/

Thanks for sharing your thoughts on Movable Type. Regards

Most individuals have a good page rank, and they qualify to be a good inbound link to some site.
You will be amazed to comprehend that page rank 5 is way better
than page rank 3. https://www.viewnaija.com/user/RalfScurry

First of all I would likke to say wonderful blog! I had a quick question that I'd
like to ask if you don't mind. I was curious to know how you center yourself aand clear your
mind before writing. I've had a tough time clearing
my thoughts in getting my ideas ouut there. I do take pleasure in writing however
it just seeems like the first 10 tto 15 minutes are generally lost simply just tying to figure out how to begin. Anny suggestions or tips?
Kudos!

Does your blog have a contact page? I'm having problems
locating it but, I'd like to shoot you an email.
I've got some suggestions ffor your bloog you might be
interested in hearing. Either way, great site and I look forward to seeing
it exoand over time.

Hello there, just became alert to your blog through Google, and found that it's
truly informative. I am going to watch out for brussels.
I'll appreciate if you continue this in future.
Many people will be benefited from your writing. Cheers!

I think we have similar sounds might put on a crazy good show.
In April 1994, after returning to Seattle, Kurt discovered dead
into his home. More than 150,000 people come
to each location every 12 months. http://www.as-ilida.gr/UserProfile/tabid/43/UserID/1408120/Default.aspx

Good day! This is kind of off topic but I need some guidance from an established blog.
Is it hard to set up your own blog? I'm not very techincal but
I can figure things out pretty quick. I'm thinking about setting up my own but I'm not sure where to begin. Do
you have any tips or suggestions? Many thanks

These are actually fantastic ideas in concerning blogging.
You have touched some fastidious points here. Any way keep up wrinting. http://www.zerobyw4.com/home.php?mod=space&uid=727353&do=profile&from=space

So, so when you make your way through some fear, be filled with gratitude for your experience.
You have nott likely discovered the various benefits youu to have from usingg might not. https://geekpostware.com/Foro/index.php?action=profile

Nice post. I was checking constantly this blog and I'm impressed!
Extremely useful info particularly the last part :) I care for such information a lot.
I was looking for this particular info for a long time.
Thank you and good luck.

Excellent beat ! I wish to apprentice while you amend your site, how can i subscribe for a
blog site? The account helped me a acceptable deal.

I had been tiny bit acquainted of this your broadcast offered bright clear concept https://iwebl.ink/play8oygame174880

Good day! This is my first visit to your blog! We are a grouip of volunteers and starting a neww
initiative in a community in the same niche. Your blog provided us valuable information to work on. You have done a outstanding job!

Nice post. I learn something new and challenging
on websites I stumbleupon on a daily basis. It's always
useful to read content from other writers and use something from other sites.

After you post articles and updates on your website, notify the search
engines by utilizing a srvice like Ping-O-Matic. When creating a smoothie,
you should add your liquid ingredients to the blender first
and blend lightly.

These are truly great ideas in about blogging.
You have touched some fastidious points here.
Any way keep up wrinting.

Appreciating the persistence you put into your blog and detailed information you
present. It's good to come across a blog every once in a while
that isn't the same unwanted rehashed material.

Excellent read! I've saved your site and I'm adding your RSS feeds to
my Google account. http://tmjambitions.co.uk/?a%5B%5D=%3Ca+href%3Dhttp%3A%2F%2Fnewstrapon.com%2Fuser%2FTatianaMcG%3Eslot+mobile+Gionee%3C%2Fa%3E

It may sound like there is lots of new articles directories popping upp every shift.
To maximize my websitte rankings,I only submmit to sites have got ranked extremely well. http://wunderbarn.com/__media__/js/netsoltrademark.php?d=America.44.link%2Fhome.php%3Fmod%3Dspace%26uid%3D351261%26do%3Dprofile%26from%3Dspace

I think this is among the most vital info for me. And i am glad reading
your article. But want to remark on few general things, The web site style is perfect, the articles
is really nice : D. Good job, cheers http://www.hksibbs.com/home.php?mod=space&uid=874611&do=profile&from=space

My partner and I stumbled over here by a different website and thought I might as well check things
out. I like what I see so now i am following you. Look forward to exploring your web page for a second time.

I enjoy looking through a post that will make men and women think.
Also, thank you for allowing me to comment!

It's the best time to make some plans for the future and it's time to
be happy. I've read this post and if I could I want to suggest you some interesting things or advice.

Maybe you can write next articles referring to this article.
I desire to read more things about it!

Keep this going please, great job!

Hi there, its nice piece of writing concerning media print,
we all be aware of media is a great source of information.

Backlinks are links pointing back for one's website business sites.
If do not need to like the form and feel of the 'H' tags, use CSS to set it up to your
choice. They are in effect my colleagues on online. http://Tech21.live/profile/CorneliusB

Appreciation to my father who shared with me concerning this website, this weblog is truly awesome.

You really make it seem so easy with your presentation but I find this matter to be actually something
which I think I would never understand. It seems too complex and
extremely broad for me. I'm looking forward for your next post, I'll try
to get the hang of it! http://www.piresbr.com/bella/

It's wonderful that you are getting thoughts from this
paragraph as well as from our discussion made at this place.

It's hard to find well-informed people in this particular subject, however, you seem like
you know what you're talking about! Thanks https://medinsult.ru/forum/index.php?action=profile

Oh my goodness! Incredible article dude!
Thank you, However I am going through troubles with your
RSS. I don't understand why I am unable to
join it. Is there anybody getting identical RSS issues?
Anybody who knows the solution will you kindly respond?
Thanks!!

It was only meant for thhe elite few in the days. If you've
got good bbody language, you'll be getting no trouble in attracting him.

Mabe there won't be those exciting dinner rendezvous.

You can either get them as is or a person are put own persoal mark relating
to the product. As soon as the game staarts and the seller starts the overall game the wheel comes into action.

After looking over a handful of the blog posts on your website, I really appreciate your way
of blogging. I added it to my bookmark site list and will be checking back soon. Please visit my website too and tell me what you think.

Way cool! Some extremely valid points! I appreciate you penning this
article and also the rest of the website is also very good.

Great post. I was checking continuously this blog
and I am impressed! Very useful info particularly the last
part :) I care for such info much. I was looking for this particular info for a very long time.
Thank you and good luck.

I used to be able to find good advice from your content.

Both of your cards are visible whereas only one of the dealer's cards
is image. Several people are not aware of this one and essential
aspect around earth. This is the registration arena order play.

They had many more successful songs the actual 1980s.
Pacquiao have to have more cameo appearances on American Series as
properly. I love those guys no one will ever do that these people again!

I realize that I'm as smart and as willing in order to create money as anyone
else. You want to continue to top of most recent and greatest ideas that are being
presented daily. You must keep pace with video
marketing production.

Hello this is kinda of off topic but I was wondering if blogs use WYSIWYG editors or if you
have to manually code with HTML. I'm starting a blog soon but have no coding expertise so I wanted to get guidance from someone with
experience. Any help would be greatly appreciated!

I every time used to study piece of writing in news papers but now as
I am a user of web so from now I am using net for articles or reviews, thanks to
web.

Hello, I desire to subscribe for this weblog to get most recent updates,
therefore where can i do it please assist.

Link exchange is nothing else but it is just placing the
other person's website link on your page at suitable place and other person will
also do similar for you.

Hey there this is somewhat of off topic but I was wanting to know if blogs use WYSIWYG editors or if you have
to manually code with HTML. I'm starting a blog soon but have
no coding knowledge so I wanted to get advice
from someone with experience. Any help would be greatly appreciated!

Saved as a favorite, I love your blog!

Hello! Someone in my Myspace group shared this website with us so I came to give it a look.
I'm definitely enjoying the information. I'm bookmarking
and will be tweeting this to my followers! Wonderful blog and fantastic style and design.

When someone writes an piece of writing he/she maintains the thought of a user in his/her mind that how a user can know it.
So that's why this post is great. Thanks!

I pay a quick visit daily some web pages and information sites to read
articles or reviews, but this web site provides feature based articles.

I selected NOT to contain onto them. Parallels
you shouldn't rush to get back to what's going to proceed in itss time.
We draw the redader down the narrowing funnel to our
logical data.

Wow, amazing weblog layout! How long have you been blogging for?
you made blogging look easy. The overall look of your site
is great, let alone the content![X-N-E-W-L-I-N-S-P-I-N-X]I simply
could not leave your website prior to suggesting that I
extremely enjoyed the standard info an individual provide on your visitors?
Is gonna be back ceaselessly in order to check up on new posts.

Remember the reader wants good content. Separate good content with bad
ones just by scnning along with article. They will return for another enjoyable practice.
Thhe layout of your blog is also very important.

Internet readers usually stereotype tthe cost
by design and tinge of color. Thhis will help you to obtain loans faster and quicker compared for people who have bad finance.
Find an online-autoresponder products and services.

Hey There. I discovered your blog the usage of msn. This is a
really smartly written article. I will make sure to bookmark it and come back to learn extra of
your useful information. Thanks for the post. I'll definitely return.

Now you obtain a couple, but not nearly just how much that you're likely to getting.

Secondly it has to be vry aimed at the item you want to advertise.
Thee original bookk was really published in 1944.

コメントする

Insert Emoddy tag

画像の中に見える文字を入力してください。

プロフィール

Kamitani79
ニックネーム : Kamitani79
映画鑑賞、音楽、写真、ゲーム。地元・横浜をこよなく愛する( `・∀・´)ノヨロシク
自己紹介 :
このエントリーをはてなブックマークに追加

携帯サイト

つながり

  • ブロガー(ブログ)交流空間 エディタコミュニティ
  • あわせて読みたいブログパーツ
  • フィードメーター - Kamitani79-メロンとバナナとブログ
  • SEO
    loading
Creative Commons License
このブログのライセンスは クリエイティブ・コモンズライセンス.
Powered by Movable Type 6.2.4

最近のアクション

人気のエントリー

最近の写真・画像

空の写真

www.flickr.com
This is a Flickr badge showing public photos and videos from Kamitani79. Make your own badge here.

このブログ記事について

このページは、Kamitani79が2008年5月 2日 23:44に書いたブログ記事です。

ひとつ前のブログ記事は「携帯業界 ラストバトル」です。

次のブログ記事は「ロシア語のサイト制作とSEO」です。

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。