How to Use Conditional Tag For Beginners - (Case Study)

Admin 17.19
How to Use Conditional Tag For Beginners - (Case Study) -
Have you want your blog loading wants to be lighter or attributes you want the look of your blog to appear different for each page?

For example? want to show the widget certain blogs only on article pages alone while on the home page is not displayed, or want to ask a specific design in certain pages while other pages are not, or want to show Adsense ads layout and different ad types between display on the homepage with a view in more articles and cases of other similar,

If you desire more or less like that, then as a solution you can involve the use of conditional tags in the code template blogspot.

What are tags conditional?
tag is conditional is actually not a foreign term in the world of programming languages, in the algorithm and the world of programming languages ​​the term is often referred to as "flow control", if you are a programmer or have ever studied algorithms and programming languages ​​you must be familiar with the term "Flow control", and you must know what it does and when to use.

Cara Menggunakan Tag Kondisional untuk pemula


But for those of you who happen to have no foundation and experience in the world programming language and you happen to be the beginner bloggers or just starting? in the blogging world, and incidentally not yet familiar with the use of the conditional tags, I'm sure will be a little confused by the use of conditional tags.

Through this article I will explain in full and at length about the conditional tags, and I hope you can understand and can apply it on your blog that you can use to customize the look of your blog to match what you want.

# KNOW WHAT IS CONDITIONAL TAG?


To blog berflatform blogspot conditional tags are code khsusus (code templates) that can be used on your blog template that serves to set the display at certain pages or specific parts on your blog so that zoom can be adjusted with the you want and can be distinguished by appearance the other pages on your blog, even a conditional tags advanced you can use to create a blog page becomes lighter.

Generally the types of writing format tag code conditional on blogspot is as follows:

One case (for the simplest case):
= 'condition'>
? ?? CODE
The series of code ditas have a sense, if the conditions are fulfilled then the process CODE, if not met CODE will not be processed

For the two cases:

?? ?? == " static_page " ">
???????? CODE
???
?
The code above can be interpreted:
If the page is the page static, the execution or the process CODE, meaning CODE you wrap with conditional tags above will be processed if the blog page that opens is a page static.

There are times when the operator types used are operator! = or <> (read: not the same as), his sense of course different from the conditional tag that uses the type of operator == (read: the same as)

Examples of conditional tags with operator ! = (read not equal to or not)
??? index " ">
???? CODE YOU
found the above code:
If the page is the page index (one homepage) then process the received code.

received code, you can fill with code any example code adsense ads, widget code, or any code.

by wrapping the code you with the code on the look you want for the code will appear on the main page of your blog.

b. Use of Tags Conditional on page article Postings

page article / post pages or also can be called with the item page is the page on your blog is a special display articles of your blog posts, blog berflatform blogspot a page can be classified into the item page when the page is created using the menu entry.

generally for berflatform blogspot blog post or page article page items have the following url format:
http: //namabloganda/2016/06/nama-halaman.html

to set a display (eg: a special widget, the code unit adsense ads, or display lainny a) that tempilan only appear on article pages only, the code for the view you have to wrap with conditional tags to page article as follows:
static_page " ">
???? CODE YOU
CODE YOU, can be filled with code to see whatever you want, so look for the code will appear on the page static of your blog, not on other pages.

c. Use of Tags Conditional on Page Error Page (page not found 404)

page error page is a special page that appears when the url in your blog posts can not be found.

For those of you who want a special display where the display only you want to appear in a 404 page not found it, then you have to wrap the display code with conditional tags to a page error page, as follows:

?????? YOUR CODE
Or use the format:
?
????? CODE YOU

found the above code:
If the page is the page with the url URL PAGE then process the received code.

URL PAGE, you can fill with url blog page for the view you want to appear.

for example, I want to put an ad but the ad would only want to appear on the page about which has the url http://strukturkode.blogspot.com/p/ about.html , then the conditional tag code that can be used is as follows:
you can choose one of the above conditional formatting tags, such as below:

???? YOUR CODE
found the above code:
If the page is a search results page then processes the received code.
?
YOUR CODE, please enter the code you use to display things such as advertisements, widgets or anything.

f. The use of tags Conditional on page Archive?

In blogspot also familiar archive page, this page will appear when the archive of your blog is accessed,
formatting the url for the page blog archives normally have the format of a url, as shown below:
http://strukturkode.blogspot.com/2016_01_archive.html
If you want to see on the page is different from other pages tapilan you must install the display code with conditional tags to archive pages as follows:

???? CODE YOU
found the above code:
If the page is an archive page then processes the received code.

received code, you can fill in the code you use to display something, using the conditional tag above the display will only appear in archive page only.

g. Use of Tags Conditional On Page Mobile

Maps mobile is each page, whether the page archive, front page (homepage), the search page, or a page not found 404 or more pages, but appear when the page is accessed using a mobile device.

you can use conditional tags to specific cases so that one page view will only appear when accessed using a mobile device such as a smartphone, tablet or other mobile device.

format conditional tags for mobile page is as follows:
?
??????? CODE YOU
found the above code:
If a page is accessed via a mobile device then processes the received code.

The above code is only valid if the template mobile devices blog you enabled
through the menu template> Save image gears for mobile template, then select "Yes show mobile template on mobile devices,

As shown in the figure below:

Mengaktifkan template seluler blogspot

# cASE sTUDY oF sOME uSE oF tAG cONDITIONAL

? Here are some case studies to use conditional tags on your blogspot:

Sample case # 1:

I RecentPost want to display widgets in the sidebar but only appear on the page Posts only, whereas if halalaman Front (homepage) the widgets do not appear.

To resolve the above cases, the steps are as follows:
a. Please create a widget using the menu layout / layout on your blogspot account, then click the add button gadget, select the widget HTML / Javascript, love the title name in the box provided, and then copy the widget code you and store.

b , Now go to your template editor.
Select menu template> Edit HTML, do a search with the title of the widget that you create. widget code format is usually like this
? please show the structure of the widget code as illustrated below:

pengaturan customisasi kode widget
Approximately will look like the image above, the content widget that I give a box usually wrapped with see the arrow, and closed with the code

in accordance with case studies in order widget only appear on article pages only, then the contents of the widget (see in the given box), should be wrapped with conditional tags to the item page or article posts ( see the red code below )

Please replace or modify the code marked box as shown in the image above, approximately diabawh code should look something like this:
? ??????
???????????
???????????
????????????????


? ? ? ? ??

??????????

?? ? ? ? ?
?????????
?????

??????
If the translated code above is as follows:
If the type of page is the page the article's posting, then display the widget
By way over the widget in question will only be appears on page article posting course, you can also modify the widgets more according to what you want.

Sample Case # 2:

I want to display a description of the blog title is different, when opened is homepage then title description should be appropriate that I set in the regulation setting blog, while if the open is the page of the article's posting, the title description should be the title of the article in question.

for such cases, the steps are as follows:

a. Login to your blogspot account

b. On the left side of the menu bar select menu templates> Edit HTML to display HTML editor

c. Do a search Click the HTML editor first time, then press CTRL + F to activate the search.
Please do a search ??
for my blog I found the structure of the html code for a description more or less like the image below:

Mengatur deskripsi blog

The above code will create a title description for each page the blog is always the same, so the blog description between the index page (homepage, search pages or label) is different from the article page posting then we must involve conditional tags in the above code.

in order to comply with the above case, if the accessed page homepage then comes out is a description of the blog, while if the accessed page article posting it to the title description we take the title of the article in question.

Please replace the code by box as shown in the picture above with the following code:





Code ditas translates as follows:
If the type of page is the page article (... == " item " '), then display the title of the article in question to the title description ( ), but if not ( ) then display a description of the blog ( ) to the title description.

CONCLUSION

the examples above just a small part of the use of the conditional tag for simple cases, and only use the operator == (equal to), can also use operators (! = not equal to) in accordance with the conditions that you want.
?
There are many cases that can be solved with conditional tags, essentially tag is very useful to show the design of the page, or view certain parts on certain pages that were not the same as the other pages, even use conditional tags advanced you can use to make your blog page becomes lighter.

tag is conditional is actually only a small part of the command template code on your blog, if you gain a better understanding of the use of conditional tags simple and advanced, then will be very easy to do customize the look of your blog page.

Similarly, articles about the use of the conditional tag on blogspot for beginners may be useful for you.
Previous
Next Post »
0 Komentar