ManiaTemplate - lightweight template engine for Manialinks

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

Post Reply
User avatar
magnetik
Posts: 1673
Joined: 01 Feb 2012, 19:13
Location: Bordeaux
Contact:

ManiaTemplate - lightweight template engine for Manialinks

Post by magnetik »

Introduction
ManiaTemplate is a very-lightweight CMS for ManiaLinks.
First you create or import XML templates with placeholders for the content.
Then you create pages based on templates and you fill the placeholders with a simple Manialink admin interface.
You can easilly exchange templates with simple XML files.

It can be used to quicly create a bookmarkable manialink for your server
Image
(This template is included)

Requirements
  • PHP 5.3 or newer
  • MySQL 5.0
  • A Web Services API username and password
  • + a ManiaConnect application
Templates placeholders
The basic syntax to define a placeholder is: @@name@@

For instance :

Code: Select all

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<manialink version="1">
	<label text="@@text@@" />
</manialink>
You can add a description in order to be clearer with the syntax: @@name|Description here@@

Code: Select all

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<manialink version="1">
	<label text="@@text||This is the text in the middle@@" />
</manialink>
You are not limited in the location of placeholders, you can add them:
  • In text attribute
  • In manialink attribute
  • For setting a different style
  • ...
So you can do:

Code: Select all

<label sizen="@@labelSize@@" />
<quad sizen="10 10" style="Icons128x128_1" substyle="@@iconSubStyle@@" />

Installation
  1. Download zip file here.
  2. Configure your application, options are located in config/app.php
    * You can add administrators by adding their login with this syntax :

    Code: Select all

    $config->moderators[] = 'your_login';
    * Replace http://www.example.com with your hostname, and configure your mysql database information, your url, your manialink and your webservice API username and password.
  3. Load the file ressources/database.sql in the database named 'maniatemplate'. You can change it in the file 'librairies/ManiaTemplate/Services/AbstractServices.php'.
  4. (optionnal) Copy the 3 xml templates from the folder ressources/layouts/ into your Documents/ManiaPlanet/Media/Manialink
  5. Go to the app url within the game (on localhost it should be http://127.0.0.1/pages/)
  6. Upload your first layout but clicking 'Upload a layout'
  7. Create your first page by clicking on the layout name
Screenshots
List of installed layouts:
Image

Page creation:
Image

Placeholders edition:
Image

Page example:
Image

Exemple of layout

Code: Select all

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<manialink version="1">
<quad posn="-80 45 1" sizen="160 90" style="Bgs1" substyle="BgWindow" />
<quad posn="-70 44 2" sizen="140 12" style="Bgs1" substyle="BgWindow2" />
<label posn="0 40 3" halign="center" text="@@first||First line of text@@" />
<label posn="0 30 2" halign="center" text="@@textlink||Text of the center link@@" manialink="@@link||This must be a link@@"/>
<label posn="0 20 2" halign="center" text="$l[www.maniaplanet.com]Voici un lien url vers le site www.maniaplanet.com$l" />
<label posn="0 0 2" halign="center" style="@@style||Style of the last line@@" text="@@last||Text of the last line@@" />
</manialink>
There are a few additionnal example in the ressources/layouts folder.

As it is the very first version, any suggestions or comments are welcome !
This application is very simple and may help some people to understand how to use ManiaLib.
ManiaPlanet technical documentation portal (Dedicated, ManiaLink, ManiaScript, Titles...) -- contribute!
User avatar
magnetik
Posts: 1673
Joined: 01 Feb 2012, 19:13
Location: Bordeaux
Contact:

Re: ManiaTemplate - lightweight template engine for Manialin

Post by magnetik »

Updated package with a template, preview here.
ManiaPlanet technical documentation portal (Dedicated, ManiaLink, ManiaScript, Titles...) -- contribute!
Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 1 guest