update documentation to use sitename where possible/practical.

This commit is contained in:
Mike Macgirvin 2024-05-20 10:19:42 +10:00
parent 64ec20239d
commit b1ad24fa97
3 changed files with 6 additions and 5 deletions

View file

@ -1,9 +1,9 @@
Creating Addons Creating Addons
=============== ===============
So you want to make $Projectname do something it doesn't already do. There are lots of ways. But let's learn how to write an addon. So you want to make $sitename do something it doesn't already do. There are lots of ways. But let's learn how to write an addon.
In your $Projectname folder/directory, you will probably see a sub-directory called 'addon'. If you don't have one already, go ahead and create it. In your $sitename folder/directory, you will probably see a sub-directory called 'addon'. If you don't have one already, go ahead and create it.
[code] [code]
mkdir addon mkdir addon
[/code] [/code]
@ -52,7 +52,7 @@ In our case, we'll call them randplace_load() and randplace_unload(), as that is
Next we'll talk about [b]hooks[/b], which are essentially event handlers. There are a lot of these, and they each have a name. What we normally do is use the addonname_load() function to register a "handler function" for any hooks you are interested in. Then when any of the corresponding events occur, your code will be called. These are all called with one argument, which is often an array of data or information that is specific to that hook or event. In order to change any information in that array, you must indicate in your handler function that the argument variable is to be passed "by reference". You can do this with '&$variable_name'. Next we'll talk about [b]hooks[/b], which are essentially event handlers. There are a lot of these, and they each have a name. What we normally do is use the addonname_load() function to register a "handler function" for any hooks you are interested in. Then when any of the corresponding events occur, your code will be called. These are all called with one argument, which is often an array of data or information that is specific to that hook or event. In order to change any information in that array, you must indicate in your handler function that the argument variable is to be passed "by reference". You can do this with '&$variable_name'.
We register hook handlers with the 'Code\Extend\Hook::register()' function. It typically takes 3 arguments. The first is the name of the hook we wish to catch, the second is the filename of the file to find our handler function (relative to the base of your $Projectname installation), and the third is the function name of your handler function. Then we'll use 'Code\Extend\Route::register()' to define a "controller" or web page. This requires two arguments. The first is the name of the file we wish to provide the controller logic and the second is the name of the webpage path where we want our controller to answer web requests. By convention we use addon/addonname/Mod_something.php as the filename and in this case the page will be found at https://{yoursite}/something. So let's create our randplace_load() function right now. We register hook handlers with the 'Code\Extend\Hook::register()' function. It typically takes 3 arguments. The first is the name of the hook we wish to catch, the second is the filename of the file to find our handler function (relative to the base of your $sitename installation), and the third is the function name of your handler function. Then we'll use 'Code\Extend\Route::register()' to define a "controller" or web page. This requires two arguments. The first is the name of the file we wish to provide the controller logic and the second is the name of the webpage path where we want our controller to answer web requests. By convention we use addon/addonname/Mod_something.php as the filename and in this case the page will be found at https://{yoursite}/something. So let's create our randplace_load() function right now.
[code] [code]
function randplace_load() { function randplace_load() {

View file

@ -81,7 +81,7 @@ This will select the theme named "suckerberg" and select the "pas
[/code] [/code]
The condensed notation isn't part of Comanche itself but is recognised by $Projectname platform as a theme specifier. The condensed notation isn't part of Comanche itself but is recognised by the internal theme code as a theme specifier.
[b]Regions[/b] [b]Regions[/b]
Each region has a name, as noted above. You will specify the region of interest using a 'region' tag, which includes the name. Any content you wish placed in this region should be placed between the opening region tag and the closing tag. Each region has a name, as noted above. You will specify the region of interest using a 'region' tag, which includes the name. Any content you wish placed in this region should be placed between the opening region tag and the closing tag.

View file

@ -201,7 +201,8 @@ in some text [/nobb][/td]
[/table] [/table]
<h3>$Projectname specific codes</h3> <h3>Platform specific codes</h3>
These codes may not work correctly with other fediverse-enabled software.
[table] [table]
[tbody] [tbody]