files and folders organization

upgraded to 0.9.99

X3 CMS has a simple structure

  • [cms] the application folder
    • [apis] contains RESTful API
      example_api.php
    • [config]
      config.php
    • [controllers]
      • [admin] contains all admin controllers
      • [public]
        ajax_controller.php
        api_controller.php
        error_controller.php
        msg_controller.php
        search_controller.php
        x3admin_controller.php
      • [private]
        login_controller.php (for users in users table, if you don't need delete it)
        logout_controller.php
        msg_controller.php
        search_controller.php
        x3admin_controller.php

You can create new folders for personalized areas
this folders can contain your controllers or a copy&paste of public or private folder contents

    • [files] application files
      • [api_cache] here X3 stores cache of API calls
      • [thumb] thumbnails
      • [tmp] here X3 store cache files
      • [x3_] to separate files for multi-domains
        • [filemanager] for the filemanager
          • [files] here X3 stores all files which not have another place
          • [img] here X3 stores all images
          • [media] here X3 stores all Media files
          • [template] here X3 stores all .html and .htm files
        • [thumbs] thumbnails for the filemanager

You can create other folder you need where you can store particular files

      • sitemap.xml here X3CMS store informations for Search Engine
    • [forms]
      • [admin] for the admin forms
        • subfolders with forms files
    • [helpers]
      AdmUtils_helper.php some useful function for administration
    • [models] contains all X3 admin models
    • [views]
      • [admin] contains all admin views
      • [public] contains all public views
      • [private] contains all private views
      • empty_view.php
  • [files]
    • [css] contains files to use installed TailwindCSS
    • [files] contains all global files like: flags, fonts, loaders
    • [js] contains some Javascript library
  • [INSTALL] this folder contains installation files
  • [plugins]
    • [x3banners]
    • [x3form_builder]
    • [x4flags]
    • [x4get_by_key]
    • [x4site_map]

Here you can put other plugins
Each plugin has, more or less, this structure

  • [x3example] plugin with dedicated table
    • [controllers]
      x3example_controller.php
      Yes, must have the same name
    • [forms]
      x3example_edit_form.php
    • [models]
      X3example_model.php
    • [views]
      • [admin]
        x3example_list_view.php
        view for admin
      • [public]
        x3example_box
        view for the plugin 
    • x3example_plugin.php
    • area_uninstall.php To remove the plugin only from one area
    • global_unistall.php To remove the plugin from all areas
    • install.php To install the plugin
    • instruction_en.txt English instructions
    • instruction_it.txt Italian instructions

The plugin, the controller and the model have the same name (the model with the first character uppercase)
If the plugin has a table (if yes the name starts with x3) the table has the plugin name with an underscore after x3 (e.g. in this example x3_example).

  • [system]
    • [controllers]
      • X4Cms_controller.php
      • X4Msg_controller.php
      • X4Page_controller.php
    • [core]
      • X4Bench_core.php
      • X4Cache_core.php
      • X4Controller_core.php
      • X4Core_core.php
      • X4Db_core.php
      • X4Model_core.php
      • X4Plugin_core.php
      • X4Route_core.php
      • X4View_core.php
    • [drivers]
      • X4mysql_driver.php
    • [helpers]
      • X4Auth_helper.php
      • X4Checker_helper.php
      • X4Debug_helper.php
      • X4Files_helper.php
      • X4Form_helper.php
      • X4Mailer_helper.php
      • X4Mpdf_helper.php
      • X4Pagination_helper.php
      • X4Text_helper.php
      • X4Theme_helper.php
      • X4Time_helper.php
      • X4Url_helper.php
      • X4Utils_helper.php
      • X4Validation_helper.php 
    • [libraries]
      • [restler] this is the RESTful framework
      • [simplehtmldom]
      • restler_library.php
      • simple_html_dom_library.php

Here you can put other libraries you need or you can install them with Composer

For some libraries you must write a new file (e.g. restler_library.php)

    • [models]
      • X4Auth_model.php
      • X4Dict_model.php
      • X4Matches_model.php
      • X4Plugin_model.php
      • X4Site_model.php
    • [views]
      • X4Default_view.php
      • X4Message_view.php
  • [themes]
    • [admin] the admin theme
    • [default] the default theme

Here you can put other themes
Each theme has, more or less, this structure

  • [generic_theme]
    • [css]
      • base.css
      • mail.css
      • rtl.css for right-to-left languages
    • [img] contains all images required by templates and style sheets
    • [js]
      • script.js here you write the rules for the client side behaviour
    • [templates]
      • base.php
      • mail.php
    • favicon.ico
    • install.php
    • uninstall.php 

There are at least one template named base.php then you can have all templates you want

Then  we have the files in the root folder

  • .htaccess htaccess rules
  • gpl-3.0.html General Public License (html format)
  • CHANGELOG.txt changelog
  • humans.txt here you can put your message
  • index.php if you want after install you can remove this file or, if you need a splash page, change the htaccess rule to redirect empty calls to index.php
  • LICENSE.md General Public License
  • page.php the bootstrap script
  • README.md some info about X3 CMS, requirements, features, last changes
  • robots.txt for search engines

Have you a question?