Import_templates version 1.04

Description

Use this class to import template data from templatermonster.com (webapi) into your MySQL database

Requirements

I wrote/tested this class with PHP 4.3 and MySQL 3.23 on Windows and Linux while using a Apache webserver. A user need some moderate knowledge in PHP (OOP). Use this class as base for your own extensions to get the best result. If you download all thumbnails you need ca 250MB webspace.

Installation

How does it work?

Please support me while using this link to register your account at www.templateMonster.com.

Variables

SS_TABLE, KEYWORDS_TABLE, AUTHORS_TABLE, CATEGORIES_TABLE & CAT_LINKS_TABLE
The names for the tables used by this class, If you want to change these values don't forget to update the names in your database

DELIMITER, CURRENCY, LIST_BEGIN, LIST_DELIM & LIST_END
These standard parameters are used for some remote actions. Visit the webapi site for further information: http://www.templatemonster.com/webapi/

$all_data
The array with all records retrieved by the webapi system.

$settings
This array is used to obtain all parameters to request the right template data

$del_categ
Use this array to remove single categories from the standard list.

$messages
The message string with only warnings and notes.

Important methods

get_records($url)
retrieve the data from remote server, $url is the remote location including the options (query string)

build_options($param)
builds the querystring, $param are the settings created by the different handling methodes

copy_thumbs($id, $zero_tumbs = false)
copy images from remote to local location, $id is the number of the template. Tip! use this method inside a loop to copy several thumbs.The option $zero_thumbs is used to switch between on directory (if you copy only the files for the zero thumbs) or copy files to the TM directory structure.

import_data($into_table, $remote_file)
this method is used to handle some functions to process the data for one table. $into_table = the table where the data will be inserted, $remote_file the remote (webapi) location to process

get_zero_thumbs($count = 4)
a function to get record data and images for featured zero download templates. $count the number of images will be processed.

daily_update()
This method will execute a group of functions: update all database tabels and receving all thumbnails since last update. (check the example daily_update.php)

handle_screenshots($from = 1, $last_added = "", $sold = "", $full_path = "false"),
handle_categories($from = 1),
handle_categorie_list($lang = "en", $use_filter = "yes"),
get_zero_thumbs($count = 4),
handle_authors(),
handle_keywords($from = 1)

Check the example file how I use these methods.