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

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


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
$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