03/10/11

Installing Smarty in Cpanel

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:

/home/username
--/access_logs
--/etc
--/mail
--/public_ftp
--/public_html
--/temp
--/www

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:

/home/username
--/access_logs
--/etc
----/Smarty-3.0.7
------/demo
--------/cache
--------/configs
--------/templates
--------/templates_c
--------/index.php
--------/index_php_template.php
------/libs
--------/plugins
--------/sysplugins
--/mail
--/public_ftp
--/public_html
--/temp
--/www

Next, I moved the content from demo to public_html so it can be accessible to the world. This left me with this structure:

/home/username
--/access_logs
--/etc
----/Smarty-3.0.7
------/demo
------/libs
--------/plugins
--------/sysplugins
--/mail
--/public_ftp
--/public_html
----/cache
----/configs
----/templates
----/templates_c
----/index.php
----/index_php_template.php
--/temp
--/www

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:

<FilesMatch "(\.ini)$">
Order allow,deny
</FilesMatch>

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:

require_once('../libs/Smarty.class.php');

with:

require_once('Smarty.class.php');

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.

02/7/11

PHPLD Template Tutorial – Part 4

In Part 3, we familiarized ourselves with the variables passed from the code side to the templates. Today, we learn the specific variables passed from the PHP files to their respective templates.

init.php => all templates
$core_templates, VERSION, $MetaRobots, $MetaKeywords, $MetaDescription, $MetaAuthor, $MetaCopyright, $load_Javascript, $regular_user_details, $stats, $mainCategs, $latest_art, $featuredlinks, $regularlinks, $random_link, $scriptname, $maincontent, $pages
Note: The variables above are available for all templates.

index.php => header.tpl
$tdescription, $TITLE, $ADDRESS, $search, $in_page_title, $links, $category, $scriptname

index.php => top_nav.tpl
$cat, $category, $current_path, $list, $p, $path, $search

index.php => footer.tpl
$MainPaging

index.php => main.tpl
$sort, $list, $have_search_results, $uid, $search, $search_terms, $list_cat, $search_category, $list_articles, $search_article, $title_prefix, $feat_links, $category, $path, $count, $links, $articles, $categs, $p, $StopLinkHits, $MetaKeywords, $MetaDescription

login.php => login.tpl
$no_permission, $failed, $path

page.php => page.tpl
$data, $path, $MetaKeywords, $MetaDescription, $error

add_reciprocal.php => add_reciprocal.tpl
$link_id_error, $posted, $sql_error, $path, $data

article.php => article.tpl
$imagehash, $COMMENT, $img_verification_error, $commentError, $ratingError, $error, $comments, $rating_disabled, $logged_comment, $logged_rating, $captcha_length, $path, $data, $MetaKeywords, $MetaDescription, $ratings_on, $comments_on, $SITE_NAME

author.php => author.tpl
$error, $path, $data, $SITE_NAME, $MetaKeywords, $MetaDescription

categ_tree.php => category_tree.tpl
$CategoryTitle, $parentID, $categoryList, $categID, $action, $error_cat_tree

contact.php => contact.tpl
$imagehash, $path, $contactSent, $_POST, $captcha_length, $data, $error, $errorMsg

detail.php => detail.tpl
$error, $path, $data, $MetaKeywords, $MetaDescription

payment.php => payment.tpl
payment.php => paypal.tpl
$Subscription, $SubLength, $PAYMENT, $error, $quantity, $subscribe, $price, $action, $path, $SubscribeOptions, $data, $payment_um, $SubscriptionEnabled, $SubscriptionPeriod, $SubscriptionUm

profile.php => profile.tpl
$thank_you, $confirm, $password_recovered, $imagehash, $send_password, $email_sent, $email_error_msg, $email_status, $wrong_user_details, $_POST, $data, $agreement_terms, $user_registration, $user_edit, $imagehash, $languages, $user_info, $error, $errorMsg, $profileUpdate, $InfoLimit, $yesno, $captcha_length, $registration_errors, $path, $SITE_NAME, $ALLOW_AUTHOR_INFO

rss.php => rss2.tpl
$title, $lart, $description, $url, $links

rules.php => rules.tpl
$data, $path, $SITE_NAME, $rules

search.php => article_search.tpl
search.php => category_search.tpl
search.php => search.tpl
$printSearchPage, $have_search_results, $MetaRobots, $error, $errorMsg, $path, $searchquery, $list_cat, $search_category, $list_articles, $search_article, $links, $printSearchPage, $path, $titleonlyOptions, $locationOptions, $hitlessOptions, $sortbyOptions, $sortorderOptions, $data

submit.php => submit.tpl
$imagehash, $path, $useRTE, $SubscriptionF, $SubscriptionN, $SubscriptionR, $price, $recpr_required, $ShowReciprField, $double_review, $AllowedFeat, $secondBanCheck, $posted, $error, $_POST, $DescriptionLimit, $MetaDescriptionLimit, $disablereason, $allowedTags, $allowedAttr, $captcha_length, $remove_link, $review_link, $categs, $SubscriptionEnabled, $payment_um, $load_Javascript, $CategoryTitle, $data, $LINK_TYPE

submit_article.php => submit_article.tpl
$imagehash, $path, $useRTE, $double_review, $posted, $error, $_POST, $allowedTags, $allowedAttr, $DescriptionLimit, $ArticleLimit, $MetaDescriptionLimit, $disablearticlereason, $captcha_length, $remove_article, $review_article, $categs, $load_Javascript, $prurl, $CategoryID, $CategoryTitle, $data, $SITE_NAME

unauthorized.php => unauthorized.tpl
$unauthorizedReason

02/6/11

PHPLD Template Tutorial – Part 3

Now that we know the smarty tags from Part 2, we can learn about the variables passed to the templates for Smarty to manipulate:

$_POST – array; data returned from a form
$data – array; data returned from a query; different for each page
$stats – array; tally of various stats; fields:
   statActiveLinks – integer; tally of active links in directory
   statPendingLinks – integer; tally of pending links waiting for validation
   statTodaysLinks – integer; tally of links validated during the current day
   statArticles – integer; tally of active articles in directory
   statCategories – integer; tally of active categories in directory
   statsSubCategories – integer; tally of active subcategories in directory
$user_info – array; user info; fields:
   ID – integer; user unique identification number
   LOGIN – integer; user’s login name
   NAME – integer; user’s real name
   PASSWORD – integer; user’s password
   LEVEL – integer; user’s group level
   RANK – integer;
   ACTIVE – integer; whether the user is active
   LAST_LOGIN – date; last time the user logged in
   REGISTRATION_DATE – date; when the user registered
   SUBMIT_NOTIF – integer;
   PAYMENT_NOTIF – integer;
   ADDRESS – string; user’s address
   EMAIL – string; user’s email address
   WEBSITE – string; link to user’s website
   WEBSITE_NAME – string; user’s website’s name
   INFO – string
   ANONYMOUS – integer; whether the user submits articles anonymously
   LANGUAGE – string; language the user uses
   AVATAR – string;
   ICQ – string; user’s ICQ number
   AIM – string; user’s AIM name
   YIM – string; user’s Yahoo IM name
   MSN – string; user’s MSN name
   CONFIRM – string;
   NEW_PASSWORD – string; user’s new password
$agreement_terms – integer; whether or not the user agreed to the terms during registration
ALLOW_AUTHOR_INFO – const; set in admin to determine if author’s info shows up in articles
$allowedAttr – string; allowed attributes during article/link submission; default: none
$AllowedFeat – boolean; determines if categories have featured links
$allowedTags – string; allowed html tags during article/link submission; default: b, strong, i, u, strike, span
$ArticleLimit – integer; difference between the max article length and actual article length or the max article length if the actual article length is greater
$articles -2D array; list of articles; fields:
   ID – integer; unique id number for article
   TITLE – string; article title
   DESCRIPTION – string; article blurb seen in the listings
   ARTICLE – string; article content
   CATEGORY_ID – integer; category id the article belongs to
   STATUS – integer;
   VALID – integer;
   RATING – integer; article average rating by the users
   VOTES – integer; tally of user ratings
   COMMENT_COUNT – integer; tally of user comments
   OWNER_ID – integer; the author’s id
   OWNER_NAME – integer; the author’s name
   OWNER_EMAIL – string; the author’s email address
   OWNER_NOTIF – integer;
   DATE_MODIFIED – date; last time article was edited
   DATE_ADDED – date; when the article was submitted
   FEATURED_MAIN – integer; whether the article should appear on the main page
   FEATURED – integer; whether the article should appear first in its category
   EXPIRY_DATE – date; when the article should become hidden from view
   PAYED – integer; whether the author paid to post article
   ARTICLE_TYPE – integer;
   IPADDRESS – string; author’s ip address
   DOMAIN – string;
   OTHER_INFO – string;
   MAIN_KEYWORDS – string; keywords used in meta tag for article page
   MAIN_DESCRIPTION – string; description used in meta tag for article page
$captcha_length – integer; length of captcha phrase set in admin; default: 5
$categID – integer; category ID
$category – string;
$CategoryID – integer; category ID or 0 if invalid category
$categoryList – 2D array; list of categories; fields:
   ID – integer; category ID
   TITLE – string; category name
   SUBCATEGS – integer; 1=has sub categories, 0=does not have sub categories
$CategoryTitle – string; category name
$categs – 2D array; category info–could contain the same fields as $categoryList or it could contain the fields below:
   ID – integer; category id
   TITLE – string; category’s name
   CACHE_TITLE – string; category’s name preceded by its parent category’s name
   TITLE_URL – string; stub representing category to be used in determining it’s URL
   CACHE_URL – string; current category’s stub preceded by its parent stub
   DESCRIPTION – string; description of the category
   TDESCRIPTION – string; browser title
   CATCONTENT – string;
   PARENT_ID – integer; current category’s parent category’s id
   STATUS – integer;
   DATE_ADDED – date; date category was added to the directory
   HITS – integer; count of clicks on category
   SYMBOLIC – integer;
   SYMBOLIC_ID – integer;
   META_KEYWORDS – string; category’s meta keywords
   META_DESCRIPTIONS – string; category’s meta descriptions
   SUBCATS – optional 2D array; same data as above but for the sub categories
   COUNT – integer; tally of categories and links associated with the current category
$COMMENT – string; user’s comment for an article
$commentError – integer; 1=issue with comment
$comments – 2D array; list of comments for an article; fields:
   ID – integer; comment unique id
   ARTICLE_ID – integer; article id being commented on
   USER_ID – integer; id of user who made comment
   USER_NAME – string; name of user who made comment
   COMMENT – string; user’s comment
   DATE_ADDED – date; when user made comment
   IDADDRESS – string; ip address of user who made comment
   STATUS – integer; whether to show comment
$comments_on – integer; whether to allow comments; 0=no, 1=yes
$confirm – integer; determines if user logged in correctly
$contactSent – integer; determines if email was sent; 0=no, 1=yes
$core_templates – string; name of templates to be used for admin
$count – integer; tally of links
$description – string; search result message or category description
$DescriptionLimit – integer; difference between the max meta description length and actual meta description length or the max meta description length if the actual meta description length is greater
$disablearticlereason – string; message for why article submission is disabled
$disablereason – string; message for why directory is disabled
$double_review – string; message to inform user the link/article has not been reviewed yet
$email_error_msg – string; message for why email failed to be sent
$email_sent – string; confirmation message for when email has been sent; fail=error, success=sent
$email_status – integer; status code for when the send email script has completed
$error – string; error message
$error_cat_tree – integer; issue with category tree; 0=no issue, 1=issue
$errorMsg – string; email error message or search error message
$failed – boolean; true=login failure
$feat_links – 2D array; list of featured links; fields:
   ID – integer; link unique id
   TITLE – string; link title
   DESCRIPTION – string; link description
   URL – string; link url
   ADDRESS – string;
   CITY – string;
   STATE – string;
   ZIP – string;
   PHONE_NUMBER – string;
   CATEGORY_ID – integer; category id the link belongs to
   RECPR_URL – string; reciprocal url
   RECPR_REQUIRED – integer; whether or not a reciprocal url is required during link submission
   STATUS – integer;
   VALID – integer; whether link is valid
   RECPR_VALID – string; whether reciprocal link is valid
   OWNER_ID – integer; user id of link submitter
   OWNER_NAME – string user name of link submitter
   OWNER_EMAIL – string; user email of link submitter
   OWNER_NOTIF – integer;
   DATE_MODIFIED – date; when the link was updated
   DATE_ADDED – date; when the link was submitted
   HITS – integer; tally of clicks the link has
   LAST_CHECKED – date; last time link was checked for validity
   RECPR_LAST_CHECKED – date; last time reciprocal link was checked for validity
   PAGERANK – integer; google page rank of link
   RECPR_PAGERANK – integer; google page rank of reciprocal link
   FEATURED_MAIN – integer; whether or not link should appear on main page
   FEATURED – integer; whether or not link should be featured in category page
   EXPIRY_DATE – date; when the link will no longer be featured
   NOFOLLOW – integer; whether or not search engines should give juice to the link
   PAYED – integer; whether or not the featured link is paid for
   LINK_TYPE – integer;
   IPADDRESS – integer; ip address of link submitter
   DOMAIN – string;
   OTHER_INFO – string;
   META_KEYWORDS – string; meta keywords for link detail page
   META_DESCRIPTION – string; meta description for link detail page
   RECPR_EXPIRED – date; when the reciprocal link is no longer valid
$featuredlinks – 2D array; same as $feat_links
$have_search_results – integer; 0=no search results, 1=found search results
$hitlessOptions – array; used in advanced search; fields:
   0 – string; At Least
   1 – string; At Most
$imagehash – string; captcha hash; used for comparison purposes
$img_verification_error – boolean; true=captcha did not match, false=captcha matched
$InfoLimit – integer; remaining character limit on author’s info field
$languages – array; list of accepted languages; look in your /lang directory
$lart – integer; 1=latest articles available
$latest_art – 2D array; list of latest articles; same fields as $articles with additional field:
   DAT – date; DATE_ADDED in the format of abbreviated month followed by zero-filled date (e.g. Jan 01 through Dec 31)
$link_id_error – string; error message for invalid reciprocal or regular link
LINK_TYPE – integer;
$links – 2D array; list of links; same fields as $featuredlinks
$list – string; list filter name: latestlinks, latest, toplinks, top, latestarticles
$list_articles – 2D array; list of articles found in search results; same fields as $articles
$list_cat – 2D array; list of categories found in search results; same fields as $categs
$load_Javascript – integer; 0=do not load javascript, 1=load javascript
$locationOptions – array; looks like page headings; fields:
   links – string; Links
   articles – string; Articles
   categories – string; Categories
$logged_comment – integer; 1=user is logged in
$logged_rating – integer; 1=user is logged in
$mainCategs – 2D array; list of categories seen on front page; same fields as $categs
$maincontent – string; main page text, may be the tagline
$MetaAuthor – string; content for the meta author tag
$MetaCopyright – string; content for the meta copyright tag
$MetaDescription – string; content for the meta description tag
$MetaDescriptionLimit – integer; difference between the max meta description length and actual meta description length or the max meta description length if the actual meta description length is greater
$MetaKeywords – string; content for the meta keywords tag
$MetaRobots – string; content for the meta robots tag
$no_permission – boolean; true=user does not have access
$p – integer; current page number plus 1
$pages – 2D array; list of pages created in admin; fields
   ID – integer; unique page id
   NAME – string; page name
   SEO_NAME – string; page seo name
   CONTENT – string; page content
   STATUS – integer; page visibility
   PRIVACY – integer;
   PLACEMENT – integer; where in the main menu the page link should appear
   SHOW_IN_MENU – integer; whether the link should appear in the main menu
   DATE_ADDED – date; when page was added
   DATE_MODIFIED – date; when page was last modified
   META_KEYWORDS – string; meta keywords for page
   META_DESCRIPTION – string; meta description for page
$parentID – integer; a category’s parent ID
$password_recovered – integer; 1=password update successful, 0=password update unsuccessful
$path – array; administrative data for current page; fields:
   ID – integer;
   TITLE – string; page heading
   TITLE_URL – string;
   DESCRIPTION – string; short page description
$PAYMENT – array; payment data; fields:
   ID – integer; payment id
   LINK_ID – integer; id for link to be paid for
   IPADDRESS – string; ip address of payer
   QUANTITY – integer; tally of months(?)
   AMOUNT – float; cost per month(?)
   TOTAL – float; total cost
   UM – integer;
   PAY_DATE – date; current date and time
   CONFIRMED – integer;
   SUBSCRIBED – integer; subscription to newsletter?
$payment_um – ?
$posted – boolean;
$price – array; prices for each link; fields:
   featured – integer; price of featured link
   normal – integer; price of normal link
   free – integer; 0
   reciprocal – integer; price of reciprocal link
$printSearchPage – string; results=search results, form=advanced search form
$profileUpdate – string; yes=profile updated, no=profile not updated
$prurl – string; current url
$quantity – integer; number of months(?) the payment is for
$random_link – array; info for random link; same fields as $feat_links
$rating_disabled – string; disabled=rating disabled
$ratingError – string; error message for invalid rating
$ratings_on – integer; 0=ratings disabled for articles, 1=ratings enabled for articles
$recpr_required – integer; determines if reciprocal link is required for link submission
$registration_errors
$regular_user_details – array; info about the logged in user; fields:
   ID – integer; user id
   LOGIN – string; user login
   NAME – string; user name
   EMAIL – string; user email
$regularlinks – 2D array; list of non-featured links; same fields as $feat_links
$remove_article – integer;
$remove_link – integer;
$review_article – integer;
$review_link – integer;
$rules – string; submission guidelines
$scriptname – string; current php file
$search – 2D array; list of search results for either category or articles
$search_article – string; content from search_article.tpl
$search_category – string; content from search_category.tpl
$search_terms – 2D array; same as $search
$searchquery – array; search parameters
$secondBanCheck – integer; 0=listed in ban table, 1=not listed in ban table
$send_password – integer; 1=on send password page
$ShowReciprField – integer; 0=hide reciprocal field, 1=show reciprocal field
SITE_NAME – string; web site name
$sort – string; sort parameter abbreviation
$sortbyOptions – array; names of sort options; fields:
   relevancy – string; Relevancy
   title – string; Title
   hits – string; Hits
   category – string; Category
$sortorderOptions – array; names of sort directions; fields:
   desc – string; Descending Order
   asc – string; Ascending Order
$sql_error – string; database error message
$StopLinkHits – integer; 0=enable link hit talley, 1=disable link hit tally
$SubLength – integer; length of subscription
$subscribe – integer; 0=did not subscribe, 1=subscribed
$SubscribeOptions – array; subscribe options; fields:
   0 – string; No
   1 – string; Yes
$Subscription – array; subscription info; fields:
   UM – string; Month, Year, Lifetime
   PERIOD – integer;
$SubscriptionEnabled – 0=user subscription disabled, 1=user subscription enabled
$SubscriptionF – array; fields same as $Subscrition
$SubscriptionN – array; fields same as $Subscrition
$SubscriptionPeriod – integer; length of subscription time
$SubscriptionR – array; fields same as $Subscrition
$SubscriptionUm – string; name of subscription time
$thank_you – integer; 1=display thank you message
$title – string; path title
$title_prefix – string; path title
$titleonlyOptions – array; title search options; fields:
   0 – string; Search All Fields
   1 – string; Search Titles Only
$uid – integer; user id
$url – string; a url
$user_edit – integer; 1=on the edit page
$user_registration – integer; 1=on the register page
$useRTE – integer; 1=use rich text editor
VERSION – PHPLinkDirectory version number
$wrong_user_details – integer; 1=wrong details for user profile
$yesno – array; yes/no options; fields:
   0 – string; No
   1 – string; Yes

01/31/11

PHPLD Template Tutorial – Part 2

The template files from Part 1 are written in a combination of HTML and Smarty. The Smarty engine takes variables assigned in the PHP code, interprets the data and spits out the web page; makes web development easier when the layout is separated from the coding.

I am working with PHPld v3.3 and it uses Smarty v2.6. The documentation can be found on Smarty’s website.

Here is a quick rundown of things you would see in the PHPld templates. All Smarty syntax begin and end with curly brackets. Content passed in from the PHP code to Smarty begin with a dollar sign.

{* *}
comments; does not appear in the source once the site is live

{if conditional} {/if}
{if conditional} {else} {/if}
{if conditional} {elseif conditional} {else} {/if}
a conditional statement; the ultimate philosophical question in code form: if something is true then you do this else if something else is true you do this else you do this if everything is false

{$smarty.const.PHPCONSTANT}
to use constants defined in the PHP code, you need to prepend it with ‘$smarty.const.’

{include file="path/to/template.tpl" link="$variable"}
takes another template and drops it into the current template; optional link used to send variables in to be used by the included template

{$variable|modifier1|modifier2|etc}
variable modifiers; modifies the format of the variable, make it upper case, make it lower case, trim off whitespace, etc

{php} {/php}
in some rare cases you may need to put PHP code in the template itself; but it’s frowned upon because the design and code should be kept separate

{literal} {/literal}
anything between the literal tags will not be interpreted by the smarty engine; mainly used for javascript such as google analytics or google adsense

{foreach from=$array key=$k item=$v} {/foreach}
loops through an array; example array in PHP would be $array = array("first"=>"John", "last"=>"Doe");; you would assign the PHP array to a Smarty variable and use foreach to loop through the array; on the first pass, $k = “first” and $v = “John”, on the second pass, $k = “last” and $v = “Doe”; used to display lists like the categories, links or articles

{assign var="variable name" value="variable value"}
assigns a value to a variable to be used later in the template

Example of Conditionals
{if condition1 and condition2} {/if}
if both condition1 and condition2 evaluate to true then execute the lines in-between

{if condition1 or condition2} {/if}
if one of the conditions evaluate to true then execute the lines in-between

{if value1 gt value2} {/if}
if value1 is greater than value2 then execute the lines in-between

{if value1 lt value2} {/if}
if value1 is less than value2 then execute the lines in-between

{if value1 eq value2} {/if}
if value1 is equal to value2 then execute the lines in-between

Example of Variable Modifiers

{$variable|strip}
{$variable|strip:'replace'}
Strips double spaces, newlines and tabs with a single space by default or with a string entered after the colon

{$variable|escape}
Encodes non-alphanumeric characters; defaults to HTML

{$variable|trim}
You might see this in the code; trim is not a Smarty thing though, it’s a PHP function; it removes the white space before and after the variable

These are just a few of the ones I spotted doing a quick once over of the template files. There are many other commands available to review at Smarty’s website and probably a couple obscure ones I’ve missed in the templates. But, the above are the basics needed to get you where you want to go.

01/30/11

PHPLD Template Tutorial – Part 1

First, we look at the directory structure of a template and what each template file do. Each PHPld template generally contains the same files. I am not sure what some of the template files do though; they are probably for the pay-for-links version.

TemplateName/ – name of your template

images/ – store images
style/ – store css scripts
add_reciprocal.tpl –
article.tpl – article content page
article_search.tpl – article listing on search pages
articlelink.tpl – individual link block on browse pages
author.tpl – author profile page
banned_submit.tpl – user banned from submitting links message
category_search.tpl – category listing on search pages
category_select.tpl –
category_select_article.tpl –
category_tree.tpl –
contact.tpl – contact us page
detail.tpl – link detail page
footer.tpl – footer module
header.tpl – header module
index.html – unauthorized access page
left_side.tpl – left column content
link.tpl – listing of links in search pages
login.tpl – login form module
main.tpl – main layout of browse pages
page.tpl – not sure
pagerank.tpl – not sure
payment.tpl – not sure
paypal.tpl – not sure
profile.tpl – registration and account pages
readme.txt – template info
right_side.tpl – right column content
rss2.tpl – rss page
rules.tpl – article submission rules
screenshot.png – screenshot seen in admin
search.tpl – advanced search page
submit.tpl – link submit form
submit_article.tpl – article submit form
top_bar.tpl – menu
unauthorized.tpl – error messages

10/13/09

Setting up IP-to-Country database

Webhosting.info updates a csv file that matches IPs to countries and offers it to the public free of charge. The latest csv file has over 96k records.

Here is how to load the csv into the database on your webhost for those who do not have unix access:

Assumptions:

  • You have PHP 4.3 or later
  • You have FTP access into your account.
  • You know the database login information.
  • You’ve created the table in the database to hold the data.

Steps:

  • Download the csv file from this page.
  • Unzip the file and open the resulting csv file in a text editor.
  • Find and replace ‘ with \’ and save.
  • Download BigDump (created by Alexey Ozerov).
  • Unzip the file and open the resulting php file in a text editor.
  • Fill in the database info, the filename (ip-to-country.cvs) and the csv_insert_table (iptocountry).
  • Upload the bigdump file and the csv file to a temporary directory in your account that is web accessible.
  • Navigate to the bigdump file in your browser and click the start link.
  • Watch the progress bar.
  • Profit.
09/26/09

mod rewrites broke my POST forms

I had set up a site nice and proper with an CM admin subdirectory. Added the requisite mod rewrites to make the URLs pretty. But, for some some reason, it broke all the forms in the admin subdirectory that used POST as its method. The forms would redirect to the 404 page.

The solution to this problem after much searching was to add Option +FollowSymLinks to the head of the .htaccess file. Everything worked perfectly afterwords.

04/23/09

Writers’ Block and the Awesomeness of Skid Steers

Can you believe it? My stream of consciousness practice has ended after one day. The second day, I was sitting at the computer and drew a complete blank. I blinked and 10 minutes had passed on by. I am probably not cut out to be a writer; although it was an interesting path when I was younger.

I am going back to what I am best at which is building random websites for kicks and giggles.
Continue reading

04/9/09

CA Bill 178 – A lesson in not seeing the big picture

I was reading the backlog of news the other day and I stumbled on a surprisingly short-sighted bill which is equivalent to the Warriors signing Maggette in a panic move after Baron skipped town.

CA Bill 178 is authored by Assembly Members Nancy Skinner (D) and Charles Calderon (D). The bill adds this paragraph into the Revenue and Taxation Code:

(5) Any retailer entering into an agreement with a resident of this state under which the resident, for a commission or other consideration, directly or indirectly refers potential customers of tangible personal property, whether by a link or an Internet Web site or otherwise, to the retailer, if the cumulative gross receipts or sales price from sales by the retailer to customers in this state who are referred pursuant to these agreements is in excess of ten thousand dollars ($10,000) during the preceding four calendar quarterly periods. This paragraph shall not apply if the retailer can demonstrate that the resident with whom the retailer has an agreement did not engage in referrals in the state on behalf of the retailer that would satisfy the requirements of the commerce clause of the United States Constitution during the four quarterly periods in question.

After a quick skim, it looks like the state wants to apply sales tax to transactions made between online retailers and the local populace on the condition that the retailer has made more than $10,000 in sales in California in the past year. These retailers currently do not charge sales taxes in California because they do not have a physical presence in the state. That sounds reasonable, right? They do business here, we tax them. It’s the American way.

But, if you were to read the bill more carefully, you would see a major blunder on the part of Assembly members Skinner and Calderon. There is a loophole in the text which allows retailers to sell to California tax-free and those that get burned again are the residents of California.
Continue reading

03/11/09

Another move to a new server

Moved Frobie to a new server. I had trouble getting WordPress working correctly and ended up having to change my theme. Unfortunately with the change, I lost all the images in my posts. This theme is decent. I noticed it’s missing the links section though.

I blame Facebook for the long delay between posts. With their one line status updates feature, I no longer have the inclination to write longer posts.

Pages:  1 2 3