[
    {
        "id": "54",
        "name": "createRecord",
        "shortcode": "[cwp-tmpl-createrecord]",
        "code": "<?php\r\n\r\n\r\n\/\/ fmCWP( host.domain, database, layout, user, password )\r\n\/\/ $fm = new fmCWP(FM_HOST, FM_DATABASE, FM_LAYOUT, FM_USER, FM_PASSWORD);\r\n\r\n$fm = new fmCWP(FM_HOST_DEMO, FM_DATABASE_DEMO, FM_LAYOUT_DEMO, FM_USER_DEMO, FM_PASSWORD_DEMO);\r\n\r\n\r\n\/\/ Setting the parameters for the new record\r\n$params = [\r\n    \"fieldData\" => [\r\n        \"Title\" => \"Mr.\",\r\n        \"First Name\" => \"Lawrence\",\r\n        \"Last Name\" => \"Smith\",\r\n        \"Job Title\" => \"Cobbler\",\r\n        \"Company\" => \"Larry's Shoe Repair\",\r\n        \"Website\" => \"google.com\"\r\n    ],\r\n    \/\/ Partal Data To Be Added\r\n    \"portalData\" => [\r\n        \"Phone Numbers\" => [\r\n            [\r\n                \"Phone Numbers::Type\" => \"Office\",\r\n                \"Phone Numbers::Number\" => \"(800) 555-5555)\",\r\n            ],\r\n            [\r\n                \"Phone Numbers::Type\" => \"Cell\",\r\n                \"Phone Numbers::Number\" => \"(555) 555-5555)\",\r\n            ],\r\n        ],\r\n\r\n        \"Email Addresses\" => [\r\n            [\r\n                \"Email Addresses::Type\" => \"Work\",\r\n                \"Email Addresses::Address\" => \"lawrence@lectus.ca\",\r\n            ],\r\n        ],\r\n\r\n        \"Addresses\" => [\r\n            [\r\n                \"Addresses::Type\" => \"Word\",\r\n                \"Addresses::Address Line 1\" => \"123 Cobbler Way\",\r\n                \"Addresses::Address Line 2\" => \"Unit 2\",\r\n                \"Addresses::City\" => \"Cobbleton\",\r\n                \"Addresses::State\" => \"KY\",\r\n                \"Addresses::Postal Code\" => \"42104\",\r\n                \"Addresses::Country\" => \"USA\"\r\n            ],\r\n        ],\r\n    ],\r\n\r\n    \/\/ script to run AFTER\r\n    \"script\" => \"Log request\",\r\n    \"script.param\" => \"Parameter from FMCWP Snippets - create record\"\r\n];\r\n\r\n\/\/ Creating new record\r\n$result = $fm->createRecord($params);\r\n\r\n\/\/ Capture Response Array\r\n$response = $fm->getResponse($result);\r\n\r\n\/\/ Capture error\r\n$error = $fm->isError($result) ;\r\n\r\n\/\/ Display Result Message\r\nif ( !$error ){ cwpSuccessMessage($response) ; } else { cwpErrorMessage($response) ; }\r\n\r\n\/\/ Display Formatted response array\r\nfmcwpShowResponse($response);",
        "css": "",
        "type": "Template",
        "status": "1",
        "time": "2025-09-20 14:00:10",
        "modified_time": "2025-10-06 22:21:11",
        "description": "",
        "location": "frontend",
        "priority": "10"
    },
    {
        "id": "55",
        "name": "deleteRecord",
        "shortcode": "[cwp-tmpl-deleterecord]",
        "code": "<?php\r\n\r\n\r\n\/\/ fmCWP( host.domain, database, layout, user, password )\r\n\/\/ $fm = new fmCWP(FM_HOST, FM_DATABASE, FM_LAYOUT, FM_USER, FM_PASSWORD);\r\n\r\n$fm = new fmCWP(FM_HOST_DEMO, FM_DATABASE_DEMO, FM_LAYOUT_DEMO, FM_USER_DEMO, FM_PASSWORD_DEMO);\r\n\r\n\r\n\/\/ Provide the record id of the record to delete\r\n$id = 999;\r\n\r\n\/\/ script to run AFTER\r\n$params = [\r\n    \"script\" => \"Log request\",\r\n    \"script.param\" => \"Parameter from fmCWP - delete record\"\r\n];\r\n\r\n\/\/ Deleting record with ID 5 (field in the database - c_record_id)\r\n$result = $fm->deleteRecord($id, $params);\r\n\r\n\/\/ Capture Response Array\r\n$response = $fm->getResponse($result);\r\n\r\n\/\/ Capture error\r\n$error = $fm->isError($result) ;\r\n\r\n\/\/ Display Result Message\r\nif ( !$error ){ cwpSuccessMessage($response) ; } else { cwpErrorMessage($response) ; }\r\n\r\n\/\/ Display Formatted response array\r\nfmcwpShowResponse($response);",
        "css": "",
        "type": "Template",
        "status": "1",
        "time": "2025-09-20 14:00:10",
        "modified_time": "2025-10-06 22:21:37",
        "description": "",
        "location": "frontend",
        "priority": "10"
    },
    {
        "id": "56",
        "name": "duplicateRecord",
        "shortcode": "[cwp-tmpl-duplicaterecord]",
        "code": "<?php\r\n\r\n\r\n\/\/ fmCWP( host.domain, database, layout, user, password )\r\n\/\/ $fm = new fmCWP(FM_HOST, FM_DATABASE, FM_LAYOUT, FM_USER, FM_PASSWORD);\r\n\r\n$fm = new fmCWP(FM_HOST_DEMO, FM_DATABASE_DEMO, FM_LAYOUT_DEMO, FM_USER_DEMO, FM_PASSWORD_DEMO);\r\n\r\n\r\n\/\/ Setting the optional parameters for the duplicating record. That can be checked in example database in layout data_log after the created record.\r\n$params = [\r\n    \"script\" => \"Log request\",\r\n    \"script.param\" => \"Parameter from FMCWP Snippets - duplicate record\"\r\n];\r\n\r\n\/\/ Provide the record id of the record to duplicated\r\n$id = 999;\r\n\r\n\/\/ Duplicating record with ID provided\r\n$result = $fm->duplicateRecord($id, $params);\r\n\r\n\/\/ Capture Response Array\r\n$response = $fm->getResponse($result);\r\n\r\n\/\/ Capture error\r\n$error = $fm->isError($result) ;\r\n\r\n\/\/ Display Result Message\r\nif ( !$error ){ cwpSuccessMessage($response) ; } else { cwpErrorMessage($response) ; }\r\n\r\n\/\/ Display Formatted response array\r\nfmcwpShowResponse($response);\r\n\r\n\r\n",
        "css": "",
        "type": "Template",
        "status": "1",
        "time": "2025-09-20 14:00:10",
        "modified_time": "2025-10-06 22:21:56",
        "description": "",
        "location": "frontend",
        "priority": "10"
    },
    {
        "id": "57",
        "name": "editRecord",
        "shortcode": "[cwp-tmpl-editrecord]",
        "code": "<?php\r\n\r\n\r\n\/\/ fmCWP( host.domain, database, layout, user, password )\r\n\/\/ $fm = new fmCWP(FM_HOST, FM_DATABASE, FM_LAYOUT, FM_USER, FM_PASSWORD);\r\n\r\n$fm = new fmCWP(FM_HOST_DEMO, FM_DATABASE_DEMO, FM_LAYOUT_DEMO, FM_USER_DEMO, FM_PASSWORD_DEMO);\r\n\r\n\r\n\/\/ Set the record id\r\n$id = 1;\r\n\r\n\/\/ Setting parameters for editing - surname, email, personal identification number, product key for first row, version and date of expiration for second row will be edited\r\n$params = [\r\n    \"fieldData\" => [\r\n        \"First Name\" => \"Ron Glen\",\r\n        \"Last Name\" => \"Cates\",\r\n        \"Job Title\" => \"FileMaker Developer\",\r\n        \"Company\" => \"RGC Data LLC\",\r\n        \"Website\" => \"rgcdata.com\",\r\n    ],\r\n\r\n    \/\/ Add or Edit portal data\r\n    \"portalData\" => [\r\n        \"Phone Numbers\" => [\r\n            \/\/ Include Record ID to edit portal data\r\n            [\r\n                \"recordId\" => \"1\",\r\n                \"Phone Numbers::Type\" => \"Office\",\r\n                \"Phone Numbers::Number\" => \"(270) 770-5871\",\r\n            ],\r\n            \/\/ If there is no record id portal record will be created\r\n            [\r\n                \"recordId\" => \"\",\r\n                \"Phone Numbers::Type\" => \"Fax\",\r\n                \"Phone Numbers::Number\" => \"(888) 888-8888\",\r\n            ],\r\n        ],\r\n\r\n        \"Email Addresses\" => [\r\n            [\r\n                \"recordId\" => \"1\",\r\n                \"Email Addresses::Type\" => \"Work\",\r\n                \"Email Addresses::Address\" => \"ron@rgcdata.com\",\r\n            ],\r\n        ],\r\n\r\n        \"Addresses\" => [\r\n            [\r\n                \"recordId\" => \"1\",\r\n                \"Addresses::Type\" => \"Other\",\r\n                \"Addresses::Address Line 1\" => \"\",\r\n                \"Addresses::Address Line 2\" => \"\",\r\n                \"Addresses::City\" => \"Bowling Green\",\r\n                \"Addresses::State\" => \"KY\",\r\n                \"Addresses::Postal Code\" => \"42104\",\r\n                \"Addresses::Country\" => \"USA\"\r\n            ],\r\n        ],\r\n    ],\r\n\r\n    \/\/ script to run AFTER\r\n    \"script\" => \"Log request\",\r\n    \"script.param\" => \"Parameter from FMCWP Snippets - Edit record\"\r\n];\r\n\r\n\/\/ Edit the record\r\n$result = $fm->editRecord($id, $params);\r\n\r\n\/\/ Capture Response Array\r\n$response = $fm->getResponse($result);\r\n\r\n\/\/ Capture error\r\n$error = $fm->isError($result) ;\r\n\r\n\/\/ Display Result Message\r\nif ( !$error ){ cwpSuccessMessage($response) ; } else { cwpErrorMessage($response) ; }\r\n\r\n\/\/ Display Formatted response array\r\nfmcwpShowResponse($response);",
        "css": "",
        "type": "Template",
        "status": "1",
        "time": "2025-09-20 14:00:10",
        "modified_time": "2025-10-06 22:22:18",
        "description": "",
        "location": "frontend",
        "priority": "10"
    },
    {
        "id": "58",
        "name": "findRecords",
        "shortcode": "[cwp-tmpl-findrecords]",
        "code": "<?php\r\n\r\n\r\n\/\/ fmCWP( host.domain, database, layout, user, password )\r\n\/\/ $fm = new fmCWP(FM_HOST, FM_DATABASE, FM_LAYOUT, FM_USER, FM_PASSWORD);\r\n\r\n$fm = new fmCWP(FM_HOST_DEMO, FM_DATABASE_DEMO, FM_LAYOUT_DEMO, FM_USER_DEMO, FM_PASSWORD_DEMO);\r\n\r\n\r\n\/\/ Setting up parameters for find record\r\n$params = [\r\n\r\n    \/\/ Build the find\r\n    \"query\" => [\r\n        [\r\n            \"Email Addresses::Address\" => \"==nu@gmail.com\"\r\n            \/\/\"omit\" => \"false\"\r\n        ],\r\n        \/\/ New Request\r\n        [\r\n            \"Email Addresses::Address\" => \"==ron@rgcdata.com\"\r\n            \/\/\"omit\" => \"false\"\r\n        ]\r\n    ],\r\n\r\n    \/\/ Number of records to return ( limit ) starting at ( offset )\r\n    \"limit\"=>10,\r\n    \"offset\"=>1,\r\n\r\n    \/\/ Sort The Records\r\n    \"sort\" => [\r\n        [\r\n            \"fieldName\" => \"Last Name\",\r\n            \"sortOrder\" => \"ascend\",\r\n        ],\r\n    ],\r\n\r\n    \/\/ Portal limit and offset perameters\r\n    \"limit.Email Addresses\"=> 2,\r\n    \"offset.Email Addresses\"=> 1,\r\n\r\n    \/\/ script to run BEFORE the request\r\n    \"script.prerequest\" => \"Log request\",\r\n    \"script.prerequest.param\" => \"Prerequest parameter from FMCWP Snippets - find record\",\r\n\r\n    \/\/ script to run BEFORE the sort\r\n    \"script.presort\" => \"Log request\",\r\n    \"script.presort.param\" => \"Presort parameter from FMCWP Snippets - find record\",\r\n\r\n    \/\/ script to run AFTER\r\n    \"script\" => \"Log request\",\r\n    \"script.param\" => \"Parameter from fFMCWP Snippets - find record\",\r\n    \"layout.response\"=> \"Contact Details\"\r\n\r\n\r\n];\r\n\r\n\/\/ Find the record with mail lawrence@lectus.ca\r\n$result = $fm->findRecords($params);\r\n\r\n\/\/ Capture Response Array\r\n$response = $fm->getResponse($result);\r\n\r\n\/\/ Capture error\r\n$error = $fm->isError($result) ;\r\n\r\n\/\/ Display Result Message\r\nif ( !$error ){ cwpSuccessMessage($response) ; } else { cwpErrorMessage($response) ; }\r\n\r\n\/\/ Display Formatted response array\r\nfmcwpShowResponse($response);",
        "css": "",
        "type": "Template",
        "status": "1",
        "time": "2025-09-20 14:00:10",
        "modified_time": "2025-10-06 22:20:48",
        "description": "",
        "location": "frontend",
        "priority": "10"
    },
    {
        "id": "59",
        "name": "getDatabaseNames",
        "shortcode": "[cwp-tmpl-getdatabasenames]",
        "code": "<?php\r\n\r\n\r\n\/\/ fmCWP( host.domain, database, layout, user, password )\r\n\/\/ $fm = new fmCWP(FM_HOST, FM_DATABASE, FM_LAYOUT, FM_USER, FM_PASSWORD);\r\n\r\n$fm = new fmCWP(FM_HOST_DEMO, FM_DATABASE_DEMO, FM_LAYOUT_DEMO, FM_USER_DEMO, FM_PASSWORD_DEMO);\r\n\r\n\r\n\/\/ Get databese names for all databeses that are hosted and have enabled access via FileMaker Data API\r\n$result = $fm->getDatabaseNames();\r\n\r\n\/\/ Capture Response Array\r\n$response = $fm->getResponse($result);\r\n\r\n\/\/ Capture error\r\n$error = $fm->isError($result) ;\r\n\r\n\/\/ Display Result Message\r\nif ( !$error ){ cwpSuccessMessage($response) ; } else { cwpErrorMessage($response) ; }\r\n\r\n\/\/ Display Formatted response array\r\nfmcwpShowResponse($response);\r\n\r\n\r\n",
        "css": "",
        "type": "Template",
        "status": "1",
        "time": "2025-09-20 14:00:10",
        "modified_time": "2025-10-06 22:22:57",
        "description": "",
        "location": "frontend",
        "priority": "10"
    },
    {
        "id": "60",
        "name": "getLayoutMetadata",
        "shortcode": "[cwp-tmpl-getlayoutmetadata]",
        "code": "<?php\r\n\r\n\r\n\/\/ fmCWP( host.domain, database, layout, user, password )\r\n\/\/ $fm = new fmCWP(FM_HOST, FM_DATABASE, FM_LAYOUT, FM_USER, FM_PASSWORD);\r\n\r\n$fm = new fmCWP(FM_HOST_DEMO, FM_DATABASE_DEMO, FM_LAYOUT_DEMO, FM_USER_DEMO, FM_PASSWORD_DEMO);\r\n\r\n\r\n\/\/ Get useful information about specific layout, including fields on the layout, portals,...\r\n$result = $fm->getLayoutMetadata();\r\n\r\n\/\/ Capture Response Array\r\n$response = $fm->getResponse($result);\r\n\r\n\/\/ Capture error\r\n$error = $fm->isError($result) ;\r\n\r\n\/\/ Display Result Message\r\nif ( !$error ){ cwpSuccessMessage($response) ; } else { cwpErrorMessage($response) ; }\r\n\r\n\/\/ Display Formatted response array\r\nfmcwpShowResponse($response);\r\n\r\n\r\n",
        "css": "",
        "type": "Template",
        "status": "1",
        "time": "2025-09-20 14:00:10",
        "modified_time": "2025-10-06 22:23:25",
        "description": "",
        "location": "frontend",
        "priority": "10"
    },
    {
        "id": "61",
        "name": "getLayoutNames",
        "shortcode": "[cwp-tmpl-getlayoutnames]",
        "code": "<?php\r\n\r\n\r\n\/\/ fmCWP( host.domain, database, layout, user, password )\r\n\/\/ $fm = new fmCWP(FM_HOST, FM_DATABASE, FM_LAYOUT, FM_USER, FM_PASSWORD);\r\n\r\n$fm = new fmCWP(FM_HOST_DEMO, FM_DATABASE_DEMO, FM_LAYOUT_DEMO, FM_USER_DEMO, FM_PASSWORD_DEMO);\r\n\r\n\r\n\/\/ Get all avaiable layouts names for given database\r\n$result = $fm->getLayoutNames();\r\n\r\n\/\/ Capture Response Array\r\n$response = $fm->getResponse($result);\r\n\r\n\/\/ Capture error\r\n$error = $fm->isError($result) ;\r\n\r\n\/\/ Display Result Message\r\nif ( !$error ){ cwpSuccessMessage($response) ; } else { cwpErrorMessage($response) ; }\r\n\r\n\/\/ Display Formatted response array\r\nfmcwpShowResponse($response);\r\n\r\n\r\n",
        "css": "",
        "type": "Template",
        "status": "1",
        "time": "2025-09-20 14:00:10",
        "modified_time": "2025-10-06 22:23:47",
        "description": "",
        "location": "frontend",
        "priority": "10"
    },
    {
        "id": "62",
        "name": "getProductInformation",
        "shortcode": "[cwp-tmpl-getproductinformation]",
        "code": "<?php\r\n\r\n\r\n\/\/ fmCWP( host.domain, database, layout, user, password )\r\n\/\/ $fm = new fmCWP(FM_HOST, FM_DATABASE, FM_LAYOUT, FM_USER, FM_PASSWORD);\r\n\r\n$fm = new fmCWP(FM_HOST_DEMO, FM_DATABASE_DEMO, FM_LAYOUT_DEMO, FM_USER_DEMO, FM_PASSWORD_DEMO);\r\n\r\n\r\n\/\/ Get product informations about the server, date,...\r\n$result = $fm->getProductInformation();\r\n\r\n\/\/ Capture Response Array\r\n$response = $fm->getResponse($result);\r\n\r\n\/\/ Capture error\r\n$error = $fm->isError($result) ;\r\n\r\n\/\/ Display Result Message\r\nif ( !$error ){ cwpSuccessMessage($response) ; } else { cwpErrorMessage($response) ; }\r\n\r\n\/\/ Display Formatted response array\r\nfmcwpShowResponse($response);\r\n\r\n\r\n",
        "css": "",
        "type": "Template",
        "status": "1",
        "time": "2025-09-20 14:00:10",
        "modified_time": "2025-10-06 22:24:10",
        "description": "",
        "location": "frontend",
        "priority": "10"
    },
    {
        "id": "63",
        "name": "getRecord",
        "shortcode": "[cwp-tmpl-getrecord]",
        "code": "<?php\r\n\r\n\r\n\/\/ fmCWP( host.domain, database, layout, user, password )\r\n\/\/ $fm = new fmCWP(FM_HOST, FM_DATABASE, FM_LAYOUT, FM_USER, FM_PASSWORD);\r\n\r\n$fm = new fmCWP(FM_HOST_DEMO, FM_DATABASE_DEMO, FM_LAYOUT_DEMO, FM_USER_DEMO, FM_PASSWORD_DEMO);\r\n\r\n\r\n\/\/ Setting up parameters for get record\r\n$params= [\r\n\r\n    \/\/ script to run BEFORE\r\n    \"script.prerequest\" => \"Log request\",\r\n    \"script.prerequest.param\" => \"MyScriptPreRequestParameters\",\r\n\r\n    \/\/ script to run AFTER\r\n    \"script\" => \"Log request\",\r\n    \"script.param\" => \"Parameter from FMCWP Snippets - get record\",\r\n    \"layout.response\"=> \"Contact Details\",\r\n\r\n    \/\/ Portal sort and offset perameters\r\n    \/\/\"_limit.USER_licence\"=> ,\r\n    \/\/\"_offset.USER_licence\"=> \r\n    \r\n];\r\n\r\n\/\/ Set Record id\r\n$id = 1;\r\n\r\n\/\/ Get record by id with applied parameters\r\n$result = $fm->getRecord($id, $params);\r\n\r\n\/\/ Capture Response Array\r\n$response = $fm->getResponse($result);\r\n\r\n\/\/ Capture error\r\n$error = $fm->isError($result) ;\r\n\r\n\/\/ Display Result Message\r\nif ( !$error ){ cwpSuccessMessage($response) ; } else { cwpErrorMessage($response) ; }\r\n\r\n\/\/ Display Formatted response array\r\nfmcwpShowResponse($response);\r\n\r\n\r\n",
        "css": "",
        "type": "Template",
        "status": "1",
        "time": "2025-09-20 14:00:10",
        "modified_time": "2025-10-06 22:24:45",
        "description": "",
        "location": "frontend",
        "priority": "10"
    },
    {
        "id": "64",
        "name": "getRecords",
        "shortcode": "[cwp-tmpl-getrecords]",
        "code": "<?php\r\n\r\n\r\n\/\/ fmCWP( host.domain, database, layout, user, password )\r\n\/\/ $fm = new fmCWP(FM_HOST, FM_DATABASE, FM_LAYOUT, FM_USER, FM_PASSWORD);\r\n\r\n$fm = new fmCWP(FM_HOST_DEMO, FM_DATABASE_DEMO, FM_LAYOUT_DEMO, FM_USER_DEMO, FM_PASSWORD_DEMO);\r\n\r\n\r\n\/\/ Setting up parameters for get record\r\n$params= [\r\n\r\n    \/\/ Number of records to return ( limit ) starting at ( offset )\r\n    \"limit\"=>10,\r\n    \"offset\"=>1,\r\n    \r\n    \/\/ script to run BEFORE\r\n    \"script.prerequest\" => \"Log request\",\r\n    \"script.prerequest.param\" => \"MyScriptPreRequestParameters\",\r\n\r\n    \/\/ script to run AFTER\r\n    \"script\" => \"Log request\",\r\n    \"script.param\" => \"Parameter from fmCWP - get record\",\r\n    \"layout.response\"=> \"Contact Details\",\r\n\r\n    \/\/ Portal limit and offset perameters\r\n    \/\/\"_limit.USER_licence\"=> ,\r\n    \/\/\"_offset.USER_licence\"=> \r\n    \r\n];\r\n\r\n\/\/ Get records and apply parameters\r\n$result = $fm->getRecords($params);\r\n\r\n\/\/ Capture Response Array\r\n$response = $fm->getResponse($result);\r\n\r\n\/\/ Capture error\r\n$error = $fm->isError($result) ;\r\n\r\n\/\/ Display Result Message\r\nif ( !$error ){ cwpSuccessMessage($response) ; } else { cwpErrorMessage($response) ; }\r\n\r\n\/\/ Display Formatted response array\r\nfmcwpShowResponse($response);\r\n\r\n\r\n",
        "css": "",
        "type": "Template",
        "status": "1",
        "time": "2025-09-20 14:00:10",
        "modified_time": "2025-10-06 22:25:05",
        "description": "",
        "location": "frontend",
        "priority": "10"
    },
    {
        "id": "65",
        "name": "getScriptNames",
        "shortcode": "[cwp-tmpl-getscriptnames]",
        "code": "<?php\r\n\r\n\r\n\/\/ fmCWP( host.domain, database, layout, user, password )\r\n\/\/ $fm = new fmCWP(FM_HOST, FM_DATABASE, FM_LAYOUT, FM_USER, FM_PASSWORD);\r\n\r\n$fm = new fmCWP(FM_HOST_DEMO, FM_DATABASE_DEMO, FM_LAYOUT_DEMO, FM_USER_DEMO, FM_PASSWORD_DEMO);\r\n\r\n\r\n\/\/ Get all avaiable scripts names for specific database\r\n$result = $fm->getScriptNames();\r\n\r\n\/\/ Capture Response Array\r\n$response = $fm->getResponse($result);\r\n\r\n\/\/ Capture error\r\n$error = $fm->isError($result) ;\r\n\r\n\/\/ Display Result Message\r\nif ( !$error ){ cwpSuccessMessage($response) ; } else { cwpErrorMessage($response) ; }\r\n\r\n\/\/ Display Formatted response array\r\nfmcwpShowResponse($response);\r\n\r\n\r\n",
        "css": "",
        "type": "Template",
        "status": "1",
        "time": "2025-09-20 14:00:10",
        "modified_time": "2025-10-06 22:25:27",
        "description": "",
        "location": "frontend",
        "priority": "10"
    },
    {
        "id": "66",
        "name": "loadImageFromContainer",
        "shortcode": "[cwp-tmpl-loadimagefromcontainer]",
        "code": "<?php\r\n\r\n\r\n\/\/ fmCWP( host.domain, database, layout, user, password )\r\n\/\/ $fm = new fmCWP(FM_HOST, FM_DATABASE, FM_LAYOUT, FM_USER, FM_PASSWORD);\r\n\r\n$fm = new fmCWP(FM_HOST_DEMO, FM_DATABASE_DEMO, FM_LAYOUT_DEMO, FM_USER_DEMO, FM_PASSWORD_DEMO);\r\n\r\n\r\n\/\/ Set the record id\r\n$id = 1;\r\n\r\n\/\/ Load record from database\r\n$result = $fm->getRecord($id);\r\n\r\n\/\/ Capture Response Array\r\n$response = $fm->getResponse($result);\r\n\r\n\/\/ Capture error\r\n$error = $fm->isError($result) ;\r\n\r\n\/\/ Path in array where is stored image url generated by FileMaker\r\n$imageURL = $response[\"response\"][\"data\"][0][\"fieldData\"][\"Photo\"];\r\n\r\n\/\/ image type from field\r\n$imageType = $response[\"response\"][\"data\"][0][\"fieldData\"][\"photoType\"];\r\n\r\n\/\/ image base64 encoded\r\n$imageBase64 = $response[\"response\"][\"data\"][0][\"fieldData\"][\"cPhotoBase64\"];\r\n\r\n\/\/ use $imageURL in image tag src\r\n$srcUrl = $imageURL;\r\n\r\n\/\/ use $imageType and $imageBase64 in image tag src\r\n$srcBase64 = 'data:image\/' . $imageType . ';base64,'. $imageBase64;\r\n\r\n\/\/ use $imageURL in image tag src\r\necho '<div>Using container url:<br>\r\n<div style=\"font-size: 0.8em; font-style: italic; line-height: .1.2;\">\r\nIf container urls do not display, see the documentation<br> on how to turn on persistant urls on your server.\r\n<\/div>\r\n<br><img src=\"' . $srcUrl . '\" width=\"250x\"><\/div><br>';\r\n\r\n\/\/ use $imageType and $imageBase64 in image tag src\r\necho '<div>Using base64 encoded:<br><br><img src=\"' . $srcBase64 . '\" width=\"250x\"><\/div><br>';\r\n\r\n\/\/ Display Result Message\r\nif ( !$error ){ cwpSuccessMessage($response) ; } else { cwpErrorMessage($response) ; }\r\n\r\n\/\/ Display Formatted response array\r\nfmcwpShowResponse($response);\r\n\r\n\r\n",
        "css": "",
        "type": "Template",
        "status": "1",
        "time": "2025-09-20 14:00:10",
        "modified_time": "2025-10-06 22:47:44",
        "description": "",
        "location": "frontend",
        "priority": "10"
    },
    {
        "id": "67",
        "name": "logout",
        "shortcode": "[cwp-tmpl-logout]",
        "code": "<?php\r\n\r\n\r\n\/\/ fmCWP( host.domain, database, layout, user, password )\r\n\/\/ $fm = new fmCWP(FM_HOST, FM_DATABASE, FM_LAYOUT, FM_USER, FM_PASSWORD);\r\n\r\n$fm = new fmCWP(FM_HOST_DEMO, FM_DATABASE_DEMO, FM_LAYOUT_DEMO, FM_USER_DEMO, FM_PASSWORD_DEMO);\r\n\r\n\r\n\/\/ Logout from the server\r\n$result = $fm->logout();\r\n\r\n\/\/ Capture Response Array\r\n$response = $fm->getResponse($result);\r\n\r\n\/\/ Capture error\r\n$error = $fm->isError($result) ;\r\n\r\n\/\/ Display Result Message\r\nif ( !$error ){ cwpSuccessMessage($response) ; } else { cwpErrorMessage($response) ; }\r\n\r\n\/\/ Display Formatted response array\r\nfmcwpShowResponse($response);\r\n\r\n\r\n",
        "css": "",
        "type": "Template",
        "status": "1",
        "time": "2025-09-20 14:00:10",
        "modified_time": "2025-10-06 22:29:07",
        "description": "",
        "location": "frontend",
        "priority": "10"
    },
    {
        "id": "68",
        "name": "runScript",
        "shortcode": "[cwp-tmpl-runscript]",
        "code": "<?php\r\n\r\n\r\n\/\/ fmCWP( host.domain, database, layout, user, password )\r\n\/\/ $fm = new fmCWP(FM_HOST, FM_DATABASE, FM_LAYOUT, FM_USER, FM_PASSWORD);\r\n\r\n$fm = new fmCWP(FM_HOST_DEMO, FM_DATABASE_DEMO, FM_LAYOUT_DEMO, FM_USER_DEMO, FM_PASSWORD_DEMO);\r\n\r\n\r\n\/\/ Setting script parameters\r\n$scriptParam =[\r\n    \"script.param\"=>\"Parameter from FM Snippets - run script\"\r\n];\r\n\r\n\/\/ Run script\r\n$result = $fm->runScript(\"Log request\", $scriptParam);\r\n\r\n\/\/ Capture Response Array\r\n$response = $fm->getResponse($result);\r\n\r\n\/\/ Capture error\r\n$error = $fm->isError($result) ;\r\n\r\n\/\/ Display Result Message\r\nif ( !$error ){ cwpSuccessMessage($response) ; } else { cwpErrorMessage($response) ; }\r\n\r\n\/\/ Display Formatted response array\r\nfmcwpShowResponse($response);\r\n\r\n\r\n",
        "css": "",
        "type": "Template",
        "status": "1",
        "time": "2025-09-20 14:00:10",
        "modified_time": "2025-10-06 22:29:28",
        "description": "",
        "location": "frontend",
        "priority": "10"
    },
    {
        "id": "69",
        "name": "setFileMakerLayout",
        "shortcode": "[cwp-tmpl-setfilemakerlayout]",
        "code": "<?php\r\n\r\n\r\n\/\/ fmCWP( host.domain, database, layout, user, password )\r\n\/\/ $fm = new fmCWP(FM_HOST, FM_DATABASE, FM_LAYOUT, FM_USER, FM_PASSWORD);\r\n\r\n$fm = new fmCWP(FM_HOST_DEMO, FM_DATABASE_DEMO, FM_LAYOUT_DEMO, FM_USER_DEMO, FM_PASSWORD_DEMO);\r\n\r\n\r\n\/\/ Used to change layout if different from specified when making the connection\r\n$fm->setFilemakerLayout(\"log\");\r\n\r\n\r\n",
        "css": "",
        "type": "template",
        "status": "1",
        "time": "2025-09-20 14:00:10",
        "modified_time": "2025-10-06 13:13:07",
        "description": "",
        "location": "frontend",
        "priority": "10"
    },
    {
        "id": "70",
        "name": "setGlobalField",
        "shortcode": "[cwp-tmpl-setglobalfield]",
        "code": "<?php\r\n\r\n\r\n\/\/ fmCWP( host.domain, database, layout, user, password )\r\n\/\/ $fm = new fmCWP(FM_HOST, FM_DATABASE, FM_LAYOUT, FM_USER, FM_PASSWORD);\r\n\r\n$fm = new fmCWP(FM_HOST_DEMO, FM_DATABASE_DEMO, FM_LAYOUT_DEMO, FM_USER_DEMO, FM_PASSWORD_DEMO);\r\n\r\n\r\n\/\/ Setting up the mandatory parameters for set global field\r\n$params = [\r\n    \"globalFields\" => [\r\n        \"Contacts::gGlobal1\" => \"123456789\",\r\n        \"Contacts::gGlobal2\" => \"Global g_text is set up\"\r\n        \r\n    ]\r\n];\r\n\r\n\/\/ Sets the values into the global fields\r\n$result = $fm->setGlobalField($params);\r\n\r\n\/\/ Capture Response Array\r\n$response = $fm->getResponse($result);\r\n\r\n\/\/ Capture error\r\n$error = $fm->isError($result) ;\r\n\r\n\/\/ Display Result Message\r\nif ( !$error ){ cwpSuccessMessage($response) ; } else { cwpErrorMessage($response) ; }\r\n\r\n\/\/ Display Formatted response array\r\nfmcwpShowResponse($response);\r\n\r\n\r\n",
        "css": "",
        "type": "Template",
        "status": "1",
        "time": "2025-09-20 14:00:10",
        "modified_time": "2025-10-06 22:30:27",
        "description": "",
        "location": "frontend",
        "priority": "10"
    },
    {
        "id": "71",
        "name": "uploadFileToContainer",
        "shortcode": "[cwp-tmpl-uploadfiletocontainer]",
        "code": "<?php\r\n\r\n\r\n\/\/ fmCWP( host.domain, database, layout, user, password )\r\n\/\/ $fm = new fmCWP(FM_HOST, FM_DATABASE, FM_LAYOUT, FM_USER, FM_PASSWORD);\r\n\r\n$fm = new fmCWP(FM_HOST_DEMO, FM_DATABASE_DEMO, FM_LAYOUT_DEMO, FM_USER_DEMO, FM_PASSWORD_DEMO);\r\n\r\n\r\n\/\/ Set the record id\r\n$id = 1;\r\n\r\n\/\/ Upload the file\r\n$result = $fm->uploadFileToContainer($id, \"Photo\", 1, \"wp-content\/plugins\/cwp-snippets\/assets\/images\/RonGlenCates.jpg\");\r\n\r\n\/\/ Capture Response Array\r\n$response = $fm->getResponse($result);\r\n\r\n\/\/ Capture error\r\n$error = $fm->isError($result) ;\r\n\r\n\/\/ Display Result Message\r\nif ( !$error ){ cwpSuccessMessage($response) ; } else { cwpErrorMessage($response) ; }\r\n\r\n\/\/ Display Formatted response array\r\nfmcwpShowResponse($response);\r\n\r\n\/\/ Load record from database\r\n$result = $fm->getRecord($id);\r\n\r\n\/\/ Capture Response Array\r\n$response = $fm->getResponse($result);\r\n\r\n\/\/ Capture error\r\n$error = $fm->isError($result) ;\r\n\r\n\r\n\r\n\/\/ Path in array where is stored image url generated by FileMaker\r\n$imageURL = $response[\"response\"][\"data\"][0][\"fieldData\"][\"Photo\"];\r\n\r\n\/\/ image type from field\r\n$imageType = $response[\"response\"][\"data\"][0][\"fieldData\"][\"photoType\"];\r\n\r\n\/\/ image base64 encoded\r\n$imageBase64 = $response[\"response\"][\"data\"][0][\"fieldData\"][\"cPhotoBase64\"];\r\n\r\n\/\/ use $imageURL in image tag src\r\n$srcUrl = $imageURL;\r\n\r\n\/\/ use $imageType and $imageBase64 in image tag src\r\n$srcBase64 = 'data:image\/' . $imageType . ';base64,'. $imageBase64 ;\r\n\r\n\/\/ use $imageURL in image tag src\r\necho '<div>Using container url:<br>\r\n<div style=\"font-size: 0.8em; font-style: italic; line-height: .1.2;\">\r\nIf container urls do not display, see the documentation<br> on how to turn on persistant urls on your server.\r\n<\/div><br><img src=\"' . $srcUrl . '\" width=\"250x\"><\/div><br>';\r\n\r\n\/\/ use $imageType and $imageBase64 in image tag src\r\necho '<div>Using base64 encoded:<br><br><img src=\"' . $srcBase64 . '\" width=\"250x\"><\/div><br>';\r\n\r\n\/\/ Display Result Message\r\nif ( !$error ){ cwpSuccessMessage($response) ; } else { cwpErrorMessage($response) ; }\r\n\r\n\/\/ Display Formatted response array\r\nfmcwpShowResponse($response);\r\n\r\n\r\n",
        "css": "",
        "type": "Template",
        "status": "1",
        "time": "2025-09-20 14:00:10",
        "modified_time": "2025-10-06 22:42:54",
        "description": "",
        "location": "frontend",
        "priority": "10"
    },
    {
        "id": "72",
        "name": "uploadFormDataToContainer",
        "shortcode": "[cwp-tmpl-uploadformdatatocontainer]",
        "code": "<?php ?>\r\n\t\r\n<form action=\"\" method=\"post\" enctype=\"multipart\/form-data\">\r\n\r\n\t<!-- required for wordpress best practices -->\r\n\t<?php wp_nonce_field('upload_file'); ?>\r\n\r\n\t<input type=\"file\" name=\"image\" accept=\"image\/png, image\/jpeg\">\r\n\t<button type=\"submit\" name=\"submit\">Submit<\/button>\r\n\t<br>\r\n<\/form><br>\r\n\t\t\t\t\t\t\r\n<?php\r\n\r\nif(isset($_POST['submit'], $_POST['_wpnonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['_wpnonce'])), 'upload_file')){\r\n\r\n\/\/ fmCWP( host.domain, database, layout, user, password )\r\n\/\/ $fm = new fmCWP(FM_HOST, FM_DATABASE, FM_LAYOUT, FM_USER, FM_PASSWORD);\r\n\r\n$fm = new fmCWP(FM_HOST_DEMO, FM_DATABASE_DEMO, FM_LAYOUT_DEMO, FM_USER_DEMO, FM_PASSWORD_DEMO);\r\n\r\n\r\n\/\/ This is ID the record that was made and the file be set there\r\n$id = 1;\r\n\r\n\/\/ Setting up the parameter for upload\r\n$file = isset($_FILES[\"image\"]) ? $_FILES[\"image\"] : '' ;\r\n\r\n\/\/ File upload\r\n$result = $fm->uploadFormDataToContainer($id, \"Photo\", 1, $file);\r\n\r\n\t\/\/Capture Response Array\r\n$response = $fm->getResponse($result);\r\n\t\r\n\/\/Capture error\r\n$error = $fm->isError($result) ;\r\n\r\n\/\/ Display Result Message\r\nif ( !$error ){ cwpSuccessMessage($response) ; } else { cwpErrorMessage($response) ; }\r\n\r\n\/\/ Display Formatted response array\r\nfmcwpShowResponse($response);\r\n\r\n\r\n\/\/ Load record from database\r\n$result = $fm->getRecord($id);\r\n\r\n\/\/ Capture Response Array\r\n$response = $fm->getResponse($result);\r\n\t\r\n\/\/ Capture error\r\n$error = $fm->isError($result) ;\r\n\t\r\n\/\/ Path in array where is stored image url generated by FileMaker\r\n$imageURL = $response[\"response\"][\"data\"][0][\"fieldData\"][\"Photo\"];\r\n\r\n\/\/ image type from field\r\n$imageType = $response[\"response\"][\"data\"][0][\"fieldData\"][\"photoType\"];\r\n\r\n\/\/ image base64 encoded\r\n$imageBase64 = $response[\"response\"][\"data\"][0][\"fieldData\"][\"cPhotoBase64\"];\r\n\r\n\/\/ use $imageURL in image tag src\r\n$srcUrl = $imageURL;\r\n\r\n\/\/ use $imageType and $imageBase64 in image tag src\r\n$srcBase64 = 'data:image\/' . $imageType . ';base64,'. $imageBase64 ;\r\n\r\n\r\n\/\/ use $imageURL in image tag src\r\necho '<div>Using container url:<br>\r\n<div style=\"font-size: 0.8em; font-style: italic; line-height: .1.2;\">\r\nIf container urls do not display, see the documentation<br> on how to turn on persistant urls on your server.\r\n<\/div><br><img src=\"' . $srcUrl . '\" width=\"250x\"><\/div><br>';\r\n\r\n\/\/ use $imageType and $imageBase64 in image tag src\r\necho '<div>Using base64 encoded:<br><br><img src=\"' . $srcBase64 . '\" width=\"250x\"><\/div><br>';\r\n\r\n\t\r\n\/\/ Display Result Message\r\nif ( !$error ){ cwpSuccessMessage($response) ; } else { cwpErrorMessage($response) ; }\r\n\t\r\n\/\/ Display Formatted response array\r\nfmcwpShowResponse($response);\r\n\r\n}\r\n",
        "css": "",
        "type": "Template",
        "status": "1",
        "time": "2025-09-20 14:00:10",
        "modified_time": "2025-10-06 22:46:48",
        "description": "",
        "location": "frontend",
        "priority": "10"
    }
]