Integrating Third Party Scripts/Systems (v. 2.72 - 2.9)

The site builder system can be customized by adding your own existing scripts or systems to the code. Please note that the ability to add third party scripts depends extensively on the script itself, and may require advanced coding skills!

For this example, we'll be adding a fictional third party script - a basic mailing list - to the site builder system.

Database Notes: Please note that the database tables by default have a prefix of opc_. But that can be changed in the stconfig.php page. So when creating the code, instead of calling the database as in:

"SELECT * FROM opc_maillist ..."

you'll use the following:

"SELECT * FROM " .SB_DB_PREFIX ."_maillist ..."
  1. STOREADMIN AREA: This will explain how to create a maillist.php page in the administration area.

    1. In opc_permissions, add a new entry:

      Feature: Mailing List
      SetPg: maillist
      SiteGroup: Site Extras
      GivePermission: Yes

      Where SetPg is the name of the page in the storeadmin area (ie. maillist.php would be maillist) and SiteGroup is the main link area that you want the page to appear in the storeadmin area (e.g. Web Site, E-Store, Advanced, Site Extras, or Administration). Leave SubGroup blank. Set GivePermission to 'Yes' if you want the store owner to see it, and 'No' if only the master administrator can see it.

      The opc_permissions table affects the back end storeadmin area. This adds a 'Mailing List' link to the navigation links on the left and right side of the administration area, placing it under the main link heading that you noted in the SiteGroup field.

      Note: As of version 2.93, a field PermOrder was added to the opc_permissions table. This determines the order in which the items in the same SiteGroup are sorted. Add a numeric value here to determine the sort order.

    2. Create a page called maillist.php, where the 'maillist' part is whatever you entered in the 'SetPg' field in the opc_permissions table. Place this page in the /storeadmin/ area.

    3. In this /storeadmin/maillist.php page, add the code:

      Version 2.9:

      
      

      Version 2.84:

      
      
      Administration
      
      
      
      
      
      

      Version 2.72 - 2.83

      
      
      Administration
      
      
      
      
      
      
      
    4. Add your administration area code to the // CONTENT area. Note: the open.php page opens the database, checks for passwords, and determines the permissions, so you don't have to worry about any of that. You'll just add the actual PHP code to administer the back end of the mailing list into this page.

    5. If you need to check CSS styles, go to the style.css page in the /includes/ folder inside the /storeadmin/ folder of the site. (ie. http://theirsite/storeadmin/includes/style.css). The most common styles are to enclose the code in a table, using the class "generaltable" to add the border, using the class "fieldname" to bold face the field names and using the class "button" for submit buttons.

    6. Hint: In many cases you will just want to create a login screen or a link here that points to the third party script administration area. Many scripts require you to use their logins, so you might not be able to integrate the entire system in. If you are an expert developer, you could also try using an iframe in the site builder administration area to contain the script inside the page. Or you can create additional administration pages and add just the detail coding for the administration of the script into that area.

  2. FRONT END WEB SITE: This part shows you how to include the script into the front end of the site.

    1. In opc_pages, add a new entry:

      PageName: maillist
      PageTitle: Mailing List
      PageType: optional
      Active: Yes
      LinkOrder: 18

      Where PageName is the name of the page (ie. if the page is maillist.php, then you'll use maillist), LinkOrder is the maximum LinkOrder value plus 1 (e.g. ie. if the highest LinkOrder value in the database is 22, you'll use 23). Set Active to 'Yes' to show the page, and 'No' if you don't want to show it.

      The opc_pages table affects the front end site. It will display the link to the mailing list in the pages navigation area, so you'll want to make sure the mailing list exists so that the reseller and/or client can show the mailing list.

    2. Create a page called maillist.php and put it in the main public folder, where the 'maillist' part is whatever you entered in the 'PageName' field in the opc_pages table.

    3. Add the following code to that page:

    4. Create a page with the same name (ie. if you named the front end page maillist.php, you'll name this page maillist.php) and put the page into the /enc/ folder.

    5. Add your mailing list front end PHP code into this maillist.php page (in the /enc/ folder). You don't have to open the database or worry about integrating the template or page content - that's all handled for you. All you have to do is to add the actual PHP code needed to manage the mailing list content area here.

    6. If you need to check CSS styles, go to the stylecss.php page in the /enc/ folder of the site. (ie. http://theirsite/enc/stylecss.php) or add styles to your custom template.