Utilizing an If Statement
September 02nd, 2007
Using a simple if statement can really save you time.
An if statement is basically a statement to see if it's true or not.
The basic thing is that I am thinking of a number, if you get it right, I'll say great! The number is 1.
{if $number == '1'}
Great! {/if}
Now let's apply that simple logic to Freelancer Panel. An if statement can be used virtually in any template file. I find it most useful in the front-end site. Let's use /templates/portfolio.tpl as an example.
Let's say only a few portfolio entries have a description, but the name is showing up in all of the entries. Makes your portfolio look unfinished, right? But we can add a simple if statement to hide "Description", if there is not one.
Find: <legend style="color: black">Description</legend></p>
Now let's check to see if it's empty, before we display that:
{if !empty($item.description)} <legend style="color: black">Description</legend></p> {/if}
All that says is that if the description isn't empty, then display the description heading.
Pretty simple huh? This can be applied virtually anywhere. Just remember to change the variable to the one you're using, and not using $item.description each time.
If you have any questions or issues, feel free to leave a comment or use the helpdesk for help.
Comments
There are 0 responses to Utilizing an If Statement so far.There are no comments associated with this article. Be the first to comment!
Leave Your Thoughts
Commenting is currently disabled.
Blog Categories
Beta Testing Form
If you are interested in beta testing Freelancer Panel, please complete this form.
Useful Links
If you wish to be notified via email when a new entry is posted, use the form below.