At my workplace, Smarty is used to divide the work between back-end and front-end engineers. I wanted to fiddle around with it on my free time, but there weren’t any concrete step-by-step instructions for installing Smarty in cPanel among the first few search result links on Google.
Here is what I did by following these basic instructions from Smarty’s Basic Installation page:
A typical shared host file structure looks like this in cPanel 11:
I downloaded the latest Smarty package which in my case is Smarty 3.0.7 and uploaded the compressed file into the etc folder. I decompressed the file using the handy extract feature in the cPanel menu. I ended up with this structure:
Next, I moved the content from demo to public_html so it can be accessible to the world. This left me with this structure:
At this point, you should change the permissions on the cache and templates_c folders to 777 for caching purposes.
Smarty also instructs its users to either define a constant for the path to the Smarty libraries or include the absolute path in php.ini. For those who are forgetful like myself, I chose to do the latter.
If you do not have access to the actual php.ini or your host is inflexible, you can just create one in your public_html directory. Add this line to the file:
include_path = ".:/usr/lib/php:/usr/local/lib/php:/home/username/etc/Smarty-3.0.7/libs/"
The path to your PHP libraries can either be found through the PHP Information menu item on cPanel’s main page or executing phpinfo() in a script.
To hide php.ini from prying eyes, edit your .htaccess file and drop this at the end:
The above will return a 403 Forbidden error to anyone who tries to access files ending in .ini.
Some of you may not see the .htaccess file in cPanel. To make it viewable, you would of had to check the See hidden files checkbox on the popup after clicking on File Manager. To make the popup appear again, go to your cPanel main menu and click on the reset all interface settings link in the footer. You can also gain access to the .htaccess file by navigating to your website through an FPT program.
Now edit the index.php that is in the public_html directory. Replace this line:
This can be done because the absolute path to the Smarty libraries had been established in the php.ini file earlier.
Navigate to your site in your browser and the example Smarty page should pop up. If you receive an error about a popup init in the header.tpl, just go to the file under the templates directory and remove the line. Supposedly, Smarty packages after 3.0.7 will have the line removed.
And there we go. Fun for the entire family.
I read an article today about Amazon threatening to cut all ties with their affiliates if California passes the law to have Amazon collect sales tax on purchases made by California residents.
Amazon does not want to include sales taxes in their prices because they do not want to act as a tax collector for a state they do not reside in, which is probably bullshit. Amazon is able to profit in California by not including sales tax in their prices. When a customer compares an Amazon price sans sales tax with a local store that includes sales tax, they will most likely purchase from Amazon.
California’s state government is flat out broke. They need money from any avenue they can find. This tax loophole has been open for the past decade. With the number of consumers going online to make their purchases, revenue from sales taxes has been shrinking. To remedy this loss, California wants all out-of-state retailers who sell to residents in this state to collect the state’s sale tax. They targeted Amazon because it’s the biggest fish in the pond.
For the state to collect on sales tax from an out-of-state company, the company must have a physical presence in this state. Amazon does not have a retail store in California, I am not sure if they even have a distribution center here. But they do have affiliates–webmasters who drive traffic to Amazon to collect on commissions from customer purchases. These affiliates reside in California, so in a roundabout way, Amazon does have a physical presence in the state.
Amazon stance is to sever ties with all California affiliates, thus removing their physical presence in the state. In this manner, they will continue to sell their products to California residents without applying sales tax. They will have to retroactively pay for the sales tax incurred from past purchases which would amount to a couple hundred million. California will lose out on the extra income taxes from resident affiliates. And the affiliates will lose a source of income.
Who is to blame for all this? Everyone who buys products online and don’t pay the Use Tax at the end of the year. Random guy remarks, “You’re crazy! What is this Use Tax? I’ve never heard of it in my life! Stop making shit up!”
No, my friend, the Use Tax is all too real. The law has been in the books since 1935 but it referred mostly to catalogs at the time. In 2003, a line for use tax was added to the state income tax form. California requires residents to pay a tax on purchases of taxable products from out-of-state companies that do not collect sales tax. The Use Tax rate is the same as our sales tax.
So, if you saw and bought that sweet 3D TV deal for ~$2000 from Amazon, when tax day rolls around, you need to pay ~$200 in Use Tax to California. This also applies to those few who cross state lines to buy products from Oregon tax-free and bring them back to California. You know who you are. Don’t try to cheat the system.
And on that note, go buy something from Amazon through this link which has an affiliate id attached. The affiliate is not mine but a friend who needs funds to satisfy his otaku needs. Otakus Unite!