Source files
From SMFMods
This article is a stub, an unfinished article. You can help SMFMods.org by expanding it.
Source files usually refers to the files in SMF's Sources directory. These contain all the "business code" (queries, etc). Usually, the source files are responsible for reading from and writing to the database. All data from the source files should be written to the $context array, which will then be read from the Template files.
A simple Source file may look like:
<?php if (!defined('SMF')) die('Hacking attempt...'); function Test() { global $boarddir, $context, $mbname, $modSettings, $scripturl, $settings, $txt; // Kick them out if they're a guest. is_not_guest(); $context['test'] = 'This is a test'; // Load our template. loadTemplate('Test'); } ?>
Each action has its own function in its own source file.
Categories: Stubs | Writing mods | Files
