FileMaker php API

Permalink
I Have dropped Filemaker.php and Folder that defines the API in src folder for Concrete 5.7.
How do I include the file in the system so that I can take advantage of the class in a block?
Please see the picture of the directory structure.

1 Attachment

winewise
 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi winewise,

You do not want to place any files inside the concrete directory. This directory is overwritten when concrete5 is upgraded.

A "src" folder can be created in the application folder. This will prevent it from being overwritten on upgrade.
application\src\FileMaker.php
application\src\FileMaker

FileMaker.php will need to be namespaced.
namespace Application\Src;

To use the class.
use Application\Src\FileMaker;
$fileMakerObject = new FileMaker();

This forum post covers the topic and has some examples.
https://www.concrete5.org/community/forums/5-7-discussion/how-do-y5....
winewise replied on at Permalink Reply
winewise
Thank you for your reply. I get part 1 and 3 but can not understand part 2. Would you please let me know how to set name space and where?
I which file do I create a name space such as

> FileMaker.php will need to be namespaced.
> namespace Application\Src;

Let us assume I am doing a php block on the home page in the main section. Or better still I would want this namespace to be available globally. Do I put this in default.php file?

Thanks;
Jay


> On Jul 25, 2015, at 1:06 AM, concrete5 Community <discussions@concretecms.com> wrote:
MrKDilkington replied on at Permalink Reply
MrKDilkington
In FileMaker.php, the namespace would be added after the opening PHP tag.
<?php
namespace Application\Src;
// there may be code here
class FileMaker
{
    // class code
}