Component

Module

API Integration Code

Directory

File Folder Link
M - Api.php \\SYNAS\Allan\DOCUMENTATION\Module\API\rckuc\wolf\app\models
V - all files \\SYNAS\Allan\DOCUMENTATION\Module\API\rckuc\wolf\app\views
C - ApiController.php \\SYNAS\Allan\DOCUMENTATION\Module\API\rckuc\wolf\app\controllers
backend.php \\SYNAS\Allan\DOCUMENTATION\Module\API\rckuc\wolf\app\layouts
style.css \\SYNAS\Allan\DOCUMENTATION\Module\API\rckuc\wolf\admin\themes\black_and_white
api.js \\SYNAS\Allan\DOCUMENTATION\Module\API\rckuc\wolf\admin\javascripts

wolf_api.sql

\\SYNAS\Allan\DOCUMENTATION\Module\API

 

Step 1

Update: backend.php

  • Insert scripts file in <head> section
  • Add new tab for "Api"
<head> <link href="<?php echo URI_PUBLIC; ?>wolf/admin/themes/<?php echo Setting::get('theme'); ?>/switch_button.css" id="css_theme" media="screen" rel="Stylesheet" type="text/css" /> ... <script type="text/javascript" src="<?php echo URI_PUBLIC; ?>wolf/admin/javascripts/api.js"></script> </head> <!-- Add 'API' Tab --> <body id="body_<?php echo $ctrl.'_'.Dispatcher::getAction(); ?>"> <ul> <li id="page-plugin" class="plugin"><a href="<?php echo get_url('api'); ?>"<?php if ($ctrl=='api') echo ' class="current"'; ?>><?php echo __('API'); ?></a></li> </ul> </body>
<head>
    <link href="<?php echo URI_PUBLIC; ?>wolf/admin/themes/<?php echo Setting::get('theme'); ?>/switch_button.css" id="css_theme" media="screen" rel="Stylesheet" type="text/css" />
    ...
    <script type="text/javascript" src="<?php echo URI_PUBLIC; ?>wolf/admin/javascripts/api.js"></script>
</head>

<!-- Add 'API' Tab -->
<body id="body_<?php echo $ctrl.'_'.Dispatcher::getAction(); ?>">
    <ul>
        <li id="page-plugin" class="plugin"><a href="<?php echo get_url('api'); ?>"<?php if ($ctrl=='api') echo ' class="current"'; ?>><?php echo __('API'); ?></a></li>
    </ul>
</body>

Step 2

Update: style.css

/* For API */ #api_page { max-height: 20rem; overflow: auto; display: flex; flex-direction: column; } #api_page > label { background: #ffffff; border: 1px solid #e0e0e0; /* border-radius: 10px; */ padding: 0.3rem; margin-bottom: 0.3rem; display: flex; flex-direction: row; gap: 1rem; align-items: center; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05); }
/* For API  */
#api_page {
  max-height: 20rem;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

#api_page > label {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  /* border-radius: 10px; */
  padding: 0.3rem;
  margin-bottom: 0.3rem;
  display: flex;
  flex-direction: row;
  gap: 1rem;
  align-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

Step 3

Update: All Layout

<head> <!-- Insert this inside <head> --> <?php $apis = Api::findByPageId((int)$this->id); ?> <?php foreach ($apis as $api) : ?> <?php if ((int)$api->status === 1 && $api->section === 'head') : ?> <?php // Check if the code contains PHP tags if (strpos($api->code, '<?php') !== false) { eval('?>' . $api->code); // execute PHP code safely } else { echo $api->code; // just output plain text or HTML } ?> <?php endif; ?> <?php endforeach; ?> </head> <body class="home"> <!-- Insert this right after <body> --> <?php foreach ($apis as $api) : ?> <?php if ((int)$api->status === 1 && $api->section === 'body_start') : ?> <?php if (strpos($api->code, '<?php') !== false) { eval('?>' . $api->code); // execute PHP code safely } else { echo $api->code; // just output plain text or HTML } ?> <?php endif; ?> <?php endforeach; ?> .... <!-- Insert this right before </body> --> <?php foreach ($apis as $api) : ?> <?php if ((int)$api->status === 1 && $api->section === 'body_end') : ?> <?php if (strpos($api->code, '<?php') !== false) { eval('?>' . $api->code); // execute PHP code safely } else { echo $api->code; // just output plain text or HTML } ?> <?php endif; ?> <?php endforeach; ?> </body>
<head>
    <!-- Insert this inside <head> -->
    <?php $apis = Api::findByPageId((int)$this->id); ?>
    <?php foreach ($apis as $api) : ?>
        <?php if ((int)$api->status === 1 && $api->section === 'head') : ?>
            <?php 
            // Check if the code contains PHP tags
            if (strpos($api->code, '<?php') !== false) {
                eval('?>' . $api->code); // execute PHP code safely
            } else {
                echo $api->code; // just output plain text or HTML
            }
            ?>
        <?php endif; ?>
    <?php endforeach; ?>
</head>

<body class="home">
    <!-- Insert this right after <body> -->
    <?php foreach ($apis as $api) : ?>
        <?php if ((int)$api->status === 1 && $api->section === 'body_start') : ?>
            <?php
            if (strpos($api->code, '<?php') !== false) {
                eval('?>' . $api->code); // execute PHP code safely
            } else {
                echo $api->code; // just output plain text or HTML
            }
            ?>
        <?php endif; ?>
    <?php endforeach; ?>


....


    <!-- Insert this right before </body> -->
    <?php foreach ($apis as $api) : ?>
        <?php if ((int)$api->status === 1 && $api->section === 'body_end') : ?>
            <?php
            if (strpos($api->code, '<?php') !== false) {
                eval('?>' . $api->code); // execute PHP code safely
            } else {
                echo $api->code; // just output plain text or HTML
            }
            ?>
        <?php endif; ?>
    <?php endforeach; ?>
</body>

Step 4

Copy all related files to your project and import sql table

Code Copied To Clipboard!