Archive for February, 2008

532 Part III: Developing E-mail Solutions . If (Web hosting mysql)

Friday, February 29th, 2008

532 Part III: Developing E-mail Solutions . If the list is successfully added, the takeMap() method is called to display the map interface. . If the list is not added due to database failure, an appropriate failure message is displayed. addDatabaseFieldMap() This method adds database fields to standard personalization field mapping to the database using a list object s addMapping() method. Creating a URL Manager Application The URL manager allows you to add, delete, and modify trackable URLs. Figure 15-4 shows how URLs are added to the database using a simple user interface, how it s used in a message template using the {URLx} tag and replaced with a redirection URL in the message received by end-users, and how the redirection URL is finally resolved in the final target URL being tracked. The ecampaign_url_mngr.php, which can be found in ch15/apps directory in the CDROM implements the URL manager application using the methods discussed in the following sections. run() This method uses a form variable called $cmd variable, which is set in the user interface displayed by ecampaign_mngr.php, to select the appropriate function to implement the list operation. When $cmd is set to delete, it calls the delList() method to delete a URL. When $cmd is set to modify, it calls the modifyURL() method to modify a URL; otherwise, it calls the addURL() method to add a URL. addURLDriver() This method controls the add URL process using the interface variable $step. Here s how it works: . If $step is not set, then displayAddURLMenu() is called to display the add URL interface. This interface sets $step to 2, using a hidden HTML field. . If $step is set to 2, then addURL() is called to add the URL in the database. authorize() See the authorize() method in the e-campaign user interface application called ecampaign_mngr.php for details.

Chapter 15: E-campaign System 531 If the database (1 on 1 web hosting)

Friday, February 29th, 2008

Chapter 15: E-campaign System 531 If the database is successfully updated, the modifyList() method calls takeMap() to show the database and personalization field map interface. If the update fails, it shows an appropriate status message. modifyDatabaseFieldMap() This method uses a list object to call its modifyMapList() method to update the map data in the database. The map interface is displayed by the takeMap() method. delList() This method uses a list object to call its deleteList() method to delete the list. It displays an appropriate status message based on the success or failure of the deleteList() method. takeMap() This method allows you to map the database fields to the standard personalization fields REC_ID, EMAIL, FIRST, LAST, AGE, INCOME, and SEX. It works as follows: . It connects to the list database using a DBI object called $dbiObj. . If the connection to the list database is successful, it performs a select query to detect if the list table exists in the list database. If the table does not exist, the list is deleted from the database. . If the table exists, the takeMap() method uses the tableInfo() method on the query result object, $result, to get the list table s meta data field name and type. . Then it shows an interface that allows the user to map each standard personalization field to a database field. The user must map at least REC_ID (record ID) and the EMAIL (email address). addList() This method is called when a user makes changes in the add interface shown by displayAddListMenu(). It works as follows: . First, it checks to see if the user supplied all the required fields: list name ($listname), database host name ($db_host), database user name ($db_user), database type ($db_type), database table name ($db_table). If these fields are empty, then an alert message is shown and the user is returned to the previous screen. . If the required fields are supplied, a list object called $ecampaignListObj is created and its addNewEcampaignList() is called to add the list in the database.

Web site counters - 530 Part III: Developing E-mail Solutions . If

Thursday, February 28th, 2008

530 Part III: Developing E-mail Solutions . If $step is set to 3, then the database field map that maps the standard personalization fields such as REC_ID, FIRST, LAST, AGE, SEX, INCOME, and EMAIL is stored in the database using the addDatabaseFieldMap method. modifyDriver() This method uses $step, a variable set in the modify list interface forms, to control which method is called. The $step variable is used to select the appropriate method for the appropriate stage of the list modification process. Here is how the modifyDriver() method works: . If $step is not set, then the first step of the modify list process is started by calling displayModifyListMenu(), which shows the modify list interface. This interface sets the $step to 2, using a hidden HTML field. . If $step is set to 2, then the second step of the modify list process is started by calling the modifyList() method. This method stores the list configuration data collected in the previous step and displays the database field mapping interface by calling the takeMap() method. This interface sets the $step value to 3. . If $step is set to 3, then the database field map that maps the standard personalization fields such as REC_ID, FIRST, LAST, AGE, SEX, INCOME, and EMAIL are stored in the database using the modifyDatabaseFieldMap method. authorize() See the authorize() method in the e-campaign user interface application called ecampaign_mngr.php for details. displayAddListMenu() This method displays the add list interface. displayModListMenu() This method displays the modify list interface. modifyList() This method is called when a user makes changes in the modify interface shown by displayModListMenu(). The modifyList() method creates a list object and calls its modEcampaignList() method to update the list in the database.

Web site layout - Chapter 15: E-campaign System 529 Start Get list

Thursday, February 28th, 2008

Chapter 15: E-campaign System 529 Start Get list configuration information such as database hostname, database name, username, password, and the table name, which contains the customer data (EMAIL, RECORD ID, etc.) Ask user to give this list a name. End Connect to the given list database and get meta data for the chosen list table. Map table fields with standard campaign fields (used for personalization) Store list access and mapping information in e-campaign database Figure 15-3: How a list is created. addDriver() This method uses $step, a variable set in the add list interface forms, to control which method is called. The $step variable is used to select the appropriate method for the appropriate stage of the list adding process. Here is how the addDriver() works: . If $step is not set, then the first step of the add list process is started by calling displayAddListMenu(), which shows the add list interface. This interface sets the $step to 2, using a hidden HTML field. . If $step is set to 2, then the second step of the add list process is started by calling the addList() method. This method stores the list configuration data collected in the previous step and displays the database field mapping interface by calling the takeMap() method. This interface sets the $step value to 3.

Apache web server tutorial - 528 Part III: Developing E-mail Solutions Creating an

Thursday, February 28th, 2008

528 Part III: Developing E-mail Solutions Creating an E-campaign User Interface Application This application displays the main user interface for the e-campaign applications. The main user interface application called ecampaign_mngr.php can be found in ch15/apps directory in the CDROM. The methods implemented by this user interface application are discussed in the following sections. run() This method calls the displayMenu() method to display the user interface. displayMenu() This method displays the main user interface. This method creates a List object, a URL object, and a Campaign object to get lists of lists, URLs, and campaigns to display in the interface. authorize() This method returns TRUE since, in the current version everyone is allowed to view the campaign report. If you want to restrict access to the report to a specific user or group of users, you ll have to modify this method to implement your restrictions. Creating a List Manager Application The list-management application manipulates lists. The list-creation process is shown in Figure 15-3. The ecampaign_list_mngr.php application that can be found in ch15/apps directory in the CDROM, which implements the list creation, modification, and deletion process. This application has the following methods. run() This method uses a form variable called the $cmd variable, which is set in the user interface displayed by ecampaign_mngr.php, to select the appropriate function to implement the list operation. When $cmd is set to add, it calls the addDriver() method to add a list. When $cmd is set to modify, it calls the modDriver() method to modify a list; otherwise, it calls the delList() method to delete a list.

Florida web design - Chapter 15: E-campaign System 527 display necessary information.

Wednesday, February 27th, 2008

Chapter 15: E-campaign System 527 display necessary information. Table 15-3 shows which template file is used for what purpose. TABLE 15-3 INTERFACE TEMPLATE FILES Configuration Variable File Name and Purpose $ECAMPAIGN_ADD_TEMPLATE ecampaign_add.ihtml $ECAMPAIGN_MENU_TEMPLATE ecampaign_menu.ihtml $ECAMPAIGN_ADD_URL_TEMPLATE ecampaign_add_url.ihtml $ECAMPAIGN_EXECUTION_TEMPLATE ecampaign_execute.ihtml $ECAMPAIGN_ADD_LIST_TEMPLATE ecampaign_add_list.ihtml $STATUS_TEMPLATE ecampaign_status.ihtml $ECAMPAIGN_MAPPING_TEMPLATE ecampaign_take_map.ihtml $ECAMPAIGN_ADD_CAMPAIGN_TEMPLATE ecampaign_add_campaign.ihtml $ECAMPAIGN_ADD_LABEL_TEMPLATE ecampaign_add_label.ihtml $ECAMPAIGN_REPORT_TEMPLATE ecampaign_report.ihtml $ECAMPAIGN_MOD_URL_TEMPLATE ecampaign_modify_url.ihtml $ECAMPAIGN_ADD_MESSAGE_TEMPLATE ecampaign_add_message.ihtml $ECAMPAIGN_PREVIEW_MESSAGE_TEMPLATE ecampaign_preview_message $ECAMPAIGN_MOD_LIST_TEMPLATE ecampaign_mod_list.ihtml $ECAMPAIGN_UNSUB_TEMPLATE ecampaign_unsub.ihtml $MAIL_TEMPLATE ecampaign_mail.ihtml $ECAMPAIGN_PREVIEW_MESSAGE_ ecampaign_preview_message_ INPUT_TEMPLATE input.ihtml $ECAMPAIGN_PREVIEW_MESSAGE_ ecampaign_preview_message_ SHOW_TEMPLATE show.ihtml $ECAMPAIGN_PREVIEW_MESSAGE_TEMPLATE ecampaign_preview_ message.ihtml $ECAMPAIGN_UNSUB_CONFIRM_TEMPLATE ecampaign_unsub_ confirmation.ihtml Now you re ready to create the e-campaign applications.

Web hosting uk - 526 Part III: Developing E-mail Solutions TABLE 15-2

Wednesday, February 27th, 2008

526 Part III: Developing E-mail Solutions TABLE 15-2 ecampaign.conf VARIABLES (Continued) $LIST_FIELD_MAP_TBL Name of the list map table. $ECAMPAIGN_TBL Name of the campaign table. $ECAMPAIGN_MESSAGE_TBL Name of the message table. $MESSAGE_HDRS_TBL Name of the message header table. $ECAMPAIGN_EXECUTION_TBL Name of the execution table. $ECAMPAIGN_ASSEMBLY_TBL Name of the assembly table. $ECAMPAIGN_TRACK_TBL Name of the URL track table. $ECAMPAIGN_UNSUB_TBL Name of the unsubscription table. $ECAMPAIGN_BOUNCED_TBL Name of the bounced e-mail table. $REPORT_EVEN_ROW_COLOR HTML color code for even rows in a report table. $REPORT_ODD_ROW_COLOR HTML color code for odd rows in a report table. $FROM_HEADER Header ID for the From header. $REPLY_HEADER Header ID for the Reply-to header. $PRIORITY_HEADER Header ID for the Priority header. $SUBJECT_HEADER Header ID for the Subject header. Creating an e-campaign messages file The messages displayed by the e-campaign applications are stored in an e-campaign messages file called ecampaign.messages, which can be found in ch15/apps directory in the CDROM. Creating an e-campaign errors file The error messages displayed by the e-campaign applications are stored in an e-campaign error messages file called ecampaign.errors, which can be found in ch15/apps directory in the CDROM. Creating Interface Template Files The HTML interface templates needed for the e-campaign applications are included on the CD-ROM. These templates contain various template tags to dynamically

Chapter 15: E-campaign System 525 Configuration Variable Purpose (Web site translator)

Tuesday, February 26th, 2008

Chapter 15: E-campaign System 525 Configuration Variable Purpose $ECAMPAIGN_TRACK_CLASS Name of the URL Track class. $ECAMPAIGN_UNSUB_CLASS Name of the Unsubscription class. $ECAMPAIGN_CAMPAIGN_CLASS Name of the Campaign class. $ECAMPAIGN_MESSAGE_CLASS Name of the Message class. $ECAMPAIGN_REPORT_CLASS Name of the Report class. $ECAMPAIGN_MNGR Name of the campaign manager interface application. This application displays the primary user interface. $ECAMPAIGN_URL_MNGR Name of the URL manager application. $ECAMPAIGN_CAMPAIGN_MNGR Name of the campaign manager application. $ECAMPAIGN_LIST_MNGR Name of the list manager application. $ECAMPAIGN_MESSAGE_MNGR Name of the message manager application. $ECAMPAIGN_EXEC_MNGR Name of the campaign execution application. $ECAMPAIGN_REPORT_MNGR Name of the report manager application. $ECAMPAIGN_REDIR_MNGR Name of the URL redirection application. $ECAMPAIGN_UNSUB_MNGR Name of the unsubscription application. $REL_TEMPLATE_DIR Set to relative template directory. $ECAMPAIGN_DB_URL Set to campaign database URL. $MAX_DELIVERY_AT_A_TIME Set to maximum e-mail delivery count per run. Because the execution application cannot run the entire campaign in one shot due to browser timeout issues, it executes this number of e-mails at a time. The execution application calls itself after each run using the meta refresh method. $MAX_WAIT_PER_DELIVERY The number of seconds the campaign execution application waits before it restarts via the meta refresh tag. $SECRET A random number used in the checksum algorithm. $ECAMPAIGN_LIST_TBL Name of the list table. $ECAMPAIGN_URL_TBL Name of the URL table. Continued

524 Part III: Developing E-mail Solutions TABLE 15-2 (Web page design)

Tuesday, February 26th, 2008

524 Part III: Developing E-mail Solutions TABLE 15-2 ecampaign.conf VARIABLES (Continued) Configuration Variable Purpose $PATH Set to the combined directory path consisting of the $PEAR_DIR, the $PHPLIB_DIR, and the $APP_FRAMEWORK_DIR. This path is used with the ini_set() method to redefine the php.ini entry for include_path to include $PATH ahead of the default path. This allows PHP to find the application framework, PHPLIB, and PEAR-related files. $AUTHENTICATION_URL Set to the central login application URL. $LOGOUT_URL Set to the central logout application URL. $HOME_URL Set to the topmost URL of the site. If the URL redirection application does not find a valid URL in the e-campaign database to redirect to for a valid request, it uses this URL as a default. $APPLICATION_NAME Internal name of the application. $XMAILER_ID This is the X-Mailer mail header sent with each mail to identify what program was used to send mail. $DEFAULT_LANGUAGE Set to the default (two- digit) language code. $ROOT_PATH Set to the default (two-digit) language code. $REL_ROOT_PATH Relative path to the root directory. $REL_APP_PATH Relative application path as seen from the Web browser. $ECAMPAIGN_MENU_URL Relative URL path to the campaign manager interface application. $TEMPLATE_DIR Set to the template directory containing the ihtml template files needed for the user-management applications. $CLASS_DIR Set to the class directory where user-managementrelated class files are stored. $ECAMPAIGN_LIST_CLASS Name of the List class. $ECAMPAIGN_URL_CLASS Name of the URL class.

Chapter 15: (Web site domain) E-campaign System 523 setEcampaignCampaignID() This method

Monday, February 25th, 2008

Chapter 15: E-campaign System 523 setEcampaignCampaignID() This method sets the current campaign ID to the campaign ID parameter if it is not null and returns the current campaign ID. getURLResponse() This method returns URL click-through count for each tracked URL in a campaign. getUnsubResponse() This method returns the total unsubscription track for a campaign. getBounceResponse() This method returns the total number of immediate bounces for a given campaign. Creating Common Configuration and Resource Files Like all other applications you ve developed in this book, the e-campaign applications also use a standard set of configuration, message, and error files. These files are discussed in the following sections. Creating an e-campaign configuration file The primary configuration file for the entire e-campaign system is called ecampaign.conf, which can be found in ch15/apps directory in the CDROM. Table 15-2 discusses each configuration variable. TABLE 15-2 ecampaign.conf VARIABLES Configuration Variable Purpose $PEAR_DIR Set to the directory containing the PEAR package; specifically the DB module needed for class.DBI.php in the application framework. $PHPLIB_DIR Set to the PHPLIB directory, which contains the PHPLIB packages; specifically the template.inc package needed for template manipulation. $APP_FRAMEWORK_DIR Set to the application framework directory. Continued