Difference between revisions of "Extensions:Template Tags"

From Lorekeeper Wiki
Jump to navigation Jump to search
(initial creation)
Tag: 2017 source edit
 
(docu added)
Tag: 2017 source edit
Line 1: Line 1:
{{Extensioninfobox|title=the extension's name|desc=A short description|auth=Author(s)|status=status (such as WIP, testing, stable)|github={{Github|user=username|branch=branch}}|LKVer=What Lorekeeper version the ext is built on|migration=yes/no|package=yes/no}}
+
{{Extensioninfobox|title=Template Tags|desc=Allows you to create reusable template tags that are parsed to html automatically when used in a description.|auth=Cylunny, Moif|status=testing|github={{Github|user=Cylunny|branch=extension/template-tags}}|LKVer=2.1.2|migration=yes|package=no}}
<!-- Put a short summary of your extension here! -->
+
 
 +
Allows you to create reusable template tags that are parsed to html automatically when used in a description. This is built similar to item tags which means new tags can be created by other devs if they wish to! For now, the following templates are available:
 +
* pure (Pure HTML, put anything you want to easily re-use here), #pure1
 +
* dialogue (Turns your input into a little dialogue, visual novel style, with potential background/multiple characters beside each other)
 +
* world expansion card (turns any world expansion item into a preview card, or many, if the [[Extensions: World Expansion]] is also installed)
 +
 
 +
 
 
== Installation ==
 
== Installation ==
<!-- Describe installation. Include any requirements (such as packages), necessary commands, etc. -->
+
* pull & deal with merge conflicts
 +
* <code>php artisan migrate</code>
 +
* <code>php artisan optimize</code> x2
 +
* <code>php artisan update-extension-tracker</code>
 +
 
 
== Configuration ==
 
== Configuration ==
<!-- Is any configuration necessary? Describe it here! -->
+
Create tags via Admin panel (under Site), it should be pretty self explanatory! You must first select the tag type, then save and you will see the options depending on what you picked.
 +
 
 
== Usage ==
 
== Usage ==
<!-- Is there anything users should know about using your extension? -->
+
The tags like #pure1, #dialogue1 or #world_expansion_card1 will be put into a description and upon page load it renders as the actual thing!
 +
 
 
== Troubleshooting ==
 
== Troubleshooting ==
<!-- Are there known issues or errors that require user action? Who should they contact, and where, for support? -->
+
We are never 100% safe from those pesky bugs. If you find something, feel free to contact me- I am Cylunny on the lorekeeper discord!
 +
 
 +
'''World Expansion'''
 +
Note that amazing world expansion extension does not use the Model we used for this extension by default. So if you want to use the tags within world expansion descriptions, simply edit the following line in Fauna.php, Flora.php etc. from:
 +
<code>use Illuminate\Database\Eloquent\Model;</code> to <code>use App\Models\Model;</code> and it should work!
 +
 
 
== Images ==
 
== Images ==
<!-- Do you have any images to show what it looks like in action? -->
+
<gallery>
 +
File:WorldexpansionCard.png|A figure in a world expansion card.
 +
File:DialogueTag.png|Dialogue example.
 +
File:PureHtmlEdit.png|Editing pure HTML tag.
 +
File:WorldexpansionCardEdit.png|Editing world expansion card tag.
 +
File:DialogueTagEdit.png|Editing dialogue tag.
 +
</gallery>
 +
 
 +
== Creating New Template Tags ==
 +
If you would like to add tags feel free to put a PR in but you might have to also poke my DMs x'D. Thanks moif for the following writeup!
 +
 
 +
If you've created an item tag before it's pretty much the same basic setup.
 +
# Add the new tag to `config/lorekeeper/template_tags.php` - the key you use will need to be used in the naming of all the other files for it.
 +
# (Optional?) Create a service file, there are examples provided at `app/Services/Templates/...`. Use this only if needed to eg. format the tag data.
 +
# Create the admin settings blades: `resources/views/admin/templates/tags/yourtag.blade.php`.
 +
# Create the user side blade: `resources/views/templates/yourtag.blade.php`
 +
 
 +
That should be it!
 +
 
 
== See Also ==
 
== See Also ==
<!-- Any relevant other pages. You may consider linking to related extensions, for instance. -->
+
If this extension helped you, feel free to support me on [https://ko-fi.com/cylunny Kofi]! Or go support moif who helped me out~
 
 

Revision as of 08:50, 17 October 2023

Template Tags
Description Allows you to create reusable template tags that are parsed to html automatically when used in a description.
Author(s) Cylunny, Moif
Status testing
Github extension/template-tags
LK Version 2.1.2
Contains a Migration







Allows you to create reusable template tags that are parsed to html automatically when used in a description. This is built similar to item tags which means new tags can be created by other devs if they wish to! For now, the following templates are available:

  • pure (Pure HTML, put anything you want to easily re-use here), #pure1
  • dialogue (Turns your input into a little dialogue, visual novel style, with potential background/multiple characters beside each other)
  • world expansion card (turns any world expansion item into a preview card, or many, if the Extensions: World Expansion is also installed)


Installation

  • pull & deal with merge conflicts
  • php artisan migrate
  • php artisan optimize x2
  • php artisan update-extension-tracker

Configuration

Create tags via Admin panel (under Site), it should be pretty self explanatory! You must first select the tag type, then save and you will see the options depending on what you picked.

Usage

The tags like #pure1, #dialogue1 or #world_expansion_card1 will be put into a description and upon page load it renders as the actual thing!

Troubleshooting

We are never 100% safe from those pesky bugs. If you find something, feel free to contact me- I am Cylunny on the lorekeeper discord!

World Expansion Note that amazing world expansion extension does not use the Model we used for this extension by default. So if you want to use the tags within world expansion descriptions, simply edit the following line in Fauna.php, Flora.php etc. from: use Illuminate\Database\Eloquent\Model; to use App\Models\Model; and it should work!

Images

Creating New Template Tags

If you would like to add tags feel free to put a PR in but you might have to also poke my DMs x'D. Thanks moif for the following writeup!

If you've created an item tag before it's pretty much the same basic setup.

  1. Add the new tag to `config/lorekeeper/template_tags.php` - the key you use will need to be used in the naming of all the other files for it.
  2. (Optional?) Create a service file, there are examples provided at `app/Services/Templates/...`. Use this only if needed to eg. format the tag data.
  3. Create the admin settings blades: `resources/views/admin/templates/tags/yourtag.blade.php`.
  4. Create the user side blade: `resources/views/templates/yourtag.blade.php`

That should be it!

See Also

If this extension helped you, feel free to support me on Kofi! Or go support moif who helped me out~