Eric Barnes

Eric is co-founder of 68 Designs, LLC. He is currently in charge of 68 Classifieds development and handles technical support through the user forums. His hobbies are playing golf, sleeping, and mountain biking.

Below is a list of all the posts by this author.

Stepping into Smarty - Conditionals

Smarty Templates include a whole host of features and in the post I will go over some Smarty conditional statements. Conditionals are basically a way for you to selectively show certain things based on some value.

Lets say for instance that you only want to display advertising to people visiting your site that are not logged in. This way it would give people that take the extra time to register an incentive. So if we write this out it would look something like this: “If you are a guest then show ads”.

To convert this to a Smarty conditional then we could do this:

{if $smarty.session.userlevel == 5} put your ad code {/if} 

What this does is check the users session and if the userlevel is 5 (which by default is the guest user group) then show your add code.

Now that we have the basics lets get into a more complex conditional statement. For this one lets say: “If you are logged in then display a greeting. If not then display a generic welcome message”.

This would be written as:

{if $smarty.session.username<>” || $smarty.cookies.username<>“”}
Welcome {$smarty.session.username}
{else}
Welcome to our site.  Why not join?
{/if}

The first part says if they are logged in and the username is not blank then display “Welcome Name”. Next if that condition does not run then display the else. “Welcome to our site….”.

I hope this helps you better understand Smarty conditional statements.

References

May 5, 2008   No Comments

Administration Refferer Check

Inside the administration of v4 we added a new check to prevent people from making post requests to your administration unless it comes from your domain name. This check was added as a security feature to prevent trying to bypass any forms. Although this was added for safety you can by pass it by adding this to the connections/classifieds.php file:

define('NO_REFERRER_CHECK', TRUE); 

April 28, 2008   No Comments

Best practices when moving your site

Have you ever wanted to move your site to a new domain or to a new hosting provider? If so or if you plan to in the future then I recommend visiting this Google Blog Post that is a best practices guide to moving your site.

April 24, 2008   No Comments

Adding include templates with modules

Warning: Geek Coding Speak Ahead

New in v4 is the ability to have template hooks which integrate with the module system. This is great for adding new features without having to modify any of the template files themselves. One thing I came across today was wanting to include a template file in the location of the hook.

Inside your mod_user.php file you add a hook function just like normal except make $class_tpl global and return the fetched template. Here is an example:

function example_admin_tpl_userinfo()
{
	global $class_tpl;
	$include = $class_tpl->fetch('orders/customer_table.tpl');
	return $include;
}

Now when the module is installed and the user visits the page with the hook a new template file will be added.

April 21, 2008   No Comments

Site Showcase - MyDivorceSales.com

1. Tell us a little about you.

My Divorce SalesMy Name is David Anthony Schnoblen. I am 29 years old; I live outside of Metro Detroit Michigan. I received an Associates Degree in Vehicle Design and later went back to school to receive a Bachelors of Science in Computer Systems Management. I worked in the automotive design & engineering field for about 10 years. I am engaged to a beautiful girl that is very supportive and extremely patient, since I spent a lot of Friday nights home or at her house working the website. My parents and siblings were also supportive on the development of the site. Without them and my sister going through a divorce, MyDivorceSales.com would have been probably never created.

2. What made you choose 68 Classifieds?

I have chosen 68 Classifieds, due to the fact it was really everything I was looking for in a software bundle. Also, being open source helped a lot for the development of the site. I was looking for some custom features to integrate in to my site that I could not have done with other software that I thought of purchasing. I also like the fact, that there is an active forum, where people can collaborate to share ideas and get help from the support staff as well as other users.

3. Are you using any modules with your site?

Yes, I am using “Ad Reporting, Listing Status Reminder, phpbb UserShare, Ratings modules.”

4. Any additional details you would like to share?

My web site is called MyDivorceSales.com, it was primarily developed for my sister and everybody else that has gone through a divorce to sell their unwanted items. Although, it is a web site for divorced couples, everybody is welcome to divorce their unwanted items at MyDivorceSales.com. If somebody has advice or tips that they would like to share, they can sign up to chat in our forums or write a blog.

Would you like your site showcased? Click here to find out how

April 14, 2008   3 Comments