On a request in another thread, I will share here some hints to get started with PHP.
I may not be he best guide in this territory, but there is still rather few TW-specific information on this.
If you are used to the fantastic foolproofness of TW, with PHP you should know what you are doing because on your server a harmless sounding command like unlink can be a planetary killer. The other danger is that you want to allow people to put files on your server, which always was a little spooky to me.
So as a start, I will share the sources with which I started and comprehensible easy files.
You will start to build an input-form and then a backend that treats the input of that form.
My starting point was w3schools: forms
The aim of what you see in the following code ist to post the tiddler you just edited. By the tag $:/tags/TiddlerInfo it can be accessed as a new tab in the tiddlerinfo. It changes the name of the Tiddler to avoidoverwriting your own tiddlers when importing. Compared to the instruction above you use a textarea to input the text of the body. The target is necessary to avoid a reload when hitting the button - it will show answer of the php.
\define UserTitle() {{$:/status/UserName}}_<<storyTiddler>>
Username:<$edit-text tiddler="$:/status/UserName" default="" tag="input"/><br>
<$reveal type="nomatch" state="$:/status/UserName" text="" default="show">
<$wikify name="UTitle" text=<<UserTitle>>>
<form action="post.php" method="post" target="tester">
<input type="hidden" name="title" value=<<UTitle>>>
<textarea name="content" hidden><$tiddler tiddler=<<storyTiddler>>><$fields exclude='text bag title' template='$name$: $value$
'></$fields>`
`title: {{$:/status/UserName}}_<$view field="title" format="text" />
`
`<$view field="text" format="text" />
</$tiddler></textarea><br/>
<input type="submit" value="Hochladen">
</form>
</$wikify>
<iframe name="tester" style="height:30px;width:90%;border-width:0px;overflow: hidden;"></iframe>
</$reveal>
The content of the file is created in the textarea. Here it is a .tid file but you can also decide to upload a .json file of a tiddler or even a nested .json containing multiple tiddlers. If you do so you have to choose a different ending in the folowing code.
The basic command the backend uses to write the file is explained here:
As a backend I started with the following code, which has to be in the file post.php which is addressed in the form, the folder post has to be created manually because it is not automatically built for now, both in the same directory as your wiki:
<?php
$title = $_POST['title'];
$content = $_POST['content'];
$content = str_replace(' ', '
', $content);
$postfile = fopen('post/'.$title.'.tid', "w") or die("Unable to open file!");
fwrite($postfile, $content);
fclose($postfile);
echo "Your input was stored. It will be manually checked and imported so be patient";
echo "$title";
?>
You will soon want to add further mechanisms such as password-check for the users but this here is a good point to start from.