Page 1 of 3

[TMF] How to use ManiaLib?

Posted: 19 Jun 2011, 11:25
by Slaat3
It's the first time I make a manialink. I have already tried Easy ManiaLink Creator, but I didn't like it because it's too basic and un-finished.

I tried using ManiaLib 2.0 but there is no documentation or tutorial and the instructions on the forum are very light so I downloaded the source of ManiaLive. There is no information about how to use it. There is a WWW folder (what is this?) which contains the index.php, a config folder and a libraries folder. If I upload all of them to the server and I try to access the index.php (here: http://www.tm-energy.comlu.com/www/index.php), I get this error:
PHP Error Message

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/a9815135/public_html/www/index.php on line 17


PHP Error Message

Parse error: syntax error, unexpected T_STRING in /home/a9815135/public_html/www/index.php on line 17
I've got this error too when I installed ManiaLib 2.0 example too.

How should I use ManiaLib 2.0?

Re: How to use ManiaLib?

Posted: 19 Jun 2011, 11:33
by w1lla
Better to use:

http://code.google.com/p/manialib/downl ... p&can=1&q=

Its and older version but it much clearer to handle as a starter.

Documentation about the current manialib can be found:

http://code.google.com/p/manialib/wiki/ManiaLib?tm=6

Re: How to use ManiaLib?

Posted: 19 Jun 2011, 11:35
by fastforza
Sounds like a strip slashes/add slashes problem or you're string hasn't be escaped properly. Add a slash before that slash.

Re: How to use ManiaLib?

Posted: 19 Jun 2011, 11:49
by Slaat3
Thank you very much for the help.
Another question: If I use ManiaLib 0.1 and I will want to upgrade can I upgrade to 1.0 or 2.0?

Re: How to use ManiaLib?

Posted: 19 Jun 2011, 20:14
by gouxim
ManiaLib 2.0 is indeed not much documented for now. We released a preview for the more curious developers.
Slaat3 wrote:Thank you very much for the help.
Another question: If I use ManiaLib 0.1 and I will want to upgrade can I upgrade to 1.0 or 2.0?
It's not easy. We broke a lot of things between 1 and 2. But ManiaLib 1.0 is quite powerful so you should be able to live without the 2.0.

Re: How to use ManiaLib?

Posted: 20 Jun 2011, 09:23
by Slaat3
I have installed ManiaLib 0.1 and this is what I'm getting:
[manialink=http://lib.tm-energy.comlu.com/index.php][/manialink]
Fatal error
An error occurred. Please try again later.
And the URL:
http://lib.tm-energy.comlu.com/index.php
http://lib.tm-energy.comlu.com//connect.php
This page contains the following errors:

error on line 3 at column 6: XML declaration allowed only at the start of the document
Below is a rendering of the page up to the first error.

0
<?php
/**
* Connection page
* @author Maxime Raoust
* @package auto_connect
*/

require_once("core.inc.php");

$request = RequestEngine::getInstance();

require_once("header.php");

Manialink::beginFrame(0, 0, 1);

$ui = new Button;
$ui->setAlign("center", "center");
$ui->setScale(2);
$ui->setText("Connect");
$ui->setManialink($request->createLink("index.php"));
$ui->addPlayerId();
$ui->save();

Manialink::endFrame();

require_once("footer.php");

?>

Re: How to use ManiaLib?

Posted: 20 Jun 2011, 10:15
by gouxim
Look at the XML code:

Code: Select all

<?xml version="1.0"?> 
<manialink><timeout>0</timeout><label posn="15 -48 1" sizen="20 0" halign="center" valign="bottom" textsize="1" text="Powered by $<$ccc$o$h[manialib]ManiaLib$h$>"/><quad sizen="128 128" halign="center" valign="center" image="http://www.lib.tm-energy.comlu.comimages/bg_stadium.dds"/><quad posn="64 -48 15" sizen="7 7" halign="right" valign="bottom" style="Icons64x64_1" substyle="Refresh" manialink="http://lib.tm-energy.comlu.com//connect.php"/><frame posn="0 0 1"><label sizen="20 0" halign="center" valign="center" scale="2" style="CardButtonMedium" addplayerid="1" manialink="http://lib.tm-energy.comlu.com//index.php" text="Connect"/></frame></manialink> 
<?xml version="1.0"?> 
<manialink><timeout>0</timeout><label posn="15 -48 1" sizen="20 0" halign="center" valign="bottom" textsize="1" text="Powered by $<$ccc$o$h[manialib]ManiaLib$h$>"/><quad sizen="50 20" halign="center" valign="center" style="Bgs1" substyle="BgWindow2"/><frame posn="0 9 1"><quad sizen="48 4" halign="center" style="Bgs1" substyle="BgTitle2"/><label posn="0 -0.75 0" sizen="46 0" halign="center" style="TextTitleError" text="Fatal error"/></frame><label posn="0 0 2" sizen="124 0" halign="center" valign="center" style="TextStaticSmall" text="An error occurred. Please try again later." autonewline="1"/><label posn="0 -3 5" sizen="20 0" halign="center" style="CardButtonMedium" manialink="http://lib.tm-energy.comlu.com//index.php" text="Back"/></manialink> 
I guess the method "Manialink::render()" has been called twice. Btw any reason why you're using 0.1 instead of 1.0 ?

Re: How to use ManiaLib?

Posted: 20 Jun 2011, 10:36
by Slaat3
Thanks for the help.
w1lla wrote: Its and older version but it much clearer to handle as a starter.
I think I will use 1.0 because I you say that is powerful and easy to use. Also I have documentation for it.

Re: How to use ManiaLib?

Posted: 20 Jun 2011, 11:43
by gouxim
The main difference between 0.1 and 1.0 is the application architecture.

In 0.1 you create a file per page (for example index.php and maps.php) and in those files you require the core of the framework, you do you stuff and you show the interface.

In 1.0 we introduced the MVC pattern: now you only have the index.php which does not change ; all of your app logic is put in the controller classes ; all of your views are put in separate files. It's a bit more complicated to use at first, but not that much ; and it greatly improves the quality/maintenability of the application.

Re: How to use ManiaLib?

Posted: 21 Jun 2011, 16:26
by Slaat3
I have installed ManiaLib 1.0b and customized most of it for my team. After editing the Examples/_navigation file and uploading it to the server, the TM browser redirects to http://www.tm-energy.comlu.com/?/splash/ and don't recognize the ManiaLink.

Here is what I get in Chrome:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<redirect>http://www.tm-energy.comlu.com/?/splash/</redirect>
Why it redirects to that adress? index.php is unchanged. Where is the problem?

P.S.: I reinstalled several times ManiaLib and applied again my changes.