Freelancer Panel

Freelancing just got easier.



Utilizing an If Statement

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.

 

About Tyler

Product Manager, Xyche Web Solutions LLC
This entry was posted in Tips & Tricks. Bookmark the permalink.

Comments are closed.