[TMF] How to use ManiaLib?

Open source, lightweight PHP framework for Manialink and Web development.

Moderator: NADEO

User avatar
Slaat3
Posts: 66
Joined: 19 Jun 2011, 08:36
Location: Romania
Contact:

[TMF] How to use ManiaLib?

Post by Slaat3 » 19 Jun 2011, 11:25

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?

User avatar
w1lla
Posts: 2359
Joined: 15 Jun 2010, 11:09
Location: Netherlands
Contact:

Re: How to use ManiaLib?

Post by w1lla » 19 Jun 2011, 11:33

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
TM² Info
SM Info
QM Info

OS: Windows 10 x64 Professional
MB: MSI 970A-G46
Processor: AMD FX-6300 3500 mHz
RAM Memory: 16 GB DDR3
Video: SAPPHIRE DUAL-X R9 280X 3GB GDDR5
KB: Logitech G510s
Mouse: Logitech G300s
Mode Creation
ManiaScript Docs

User avatar
fastforza
Posts: 859
Joined: 15 Jun 2010, 11:19
Contact:

Re: How to use ManiaLib?

Post by fastforza » 19 Jun 2011, 11:35

Sounds like a strip slashes/add slashes problem or you're string hasn't be escaped properly. Add a slash before that slash.
Mania Exchange - Share your maps!

ASUS Maximus IV GENE Z / i7 2600K 3.40Ghz QC / 16GB G.Skill Ripjaws DDR3 / GTX 560 Ti

Need technical help for ManiaPlanet? Click here. :)

User avatar
Slaat3
Posts: 66
Joined: 19 Jun 2011, 08:36
Location: Romania
Contact:

Re: How to use ManiaLib?

Post by Slaat3 » 19 Jun 2011, 11:49

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?

User avatar
gouxim
Nadeo
Nadeo
Posts: 1154
Joined: 14 Jun 2010, 17:20

Re: How to use ManiaLib?

Post by gouxim » 19 Jun 2011, 20:14

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.
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)

User avatar
Slaat3
Posts: 66
Joined: 19 Jun 2011, 08:36
Location: Romania
Contact:

Re: How to use ManiaLib?

Post by Slaat3 » 20 Jun 2011, 09:23

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");

?>

User avatar
gouxim
Nadeo
Nadeo
Posts: 1154
Joined: 14 Jun 2010, 17:20

Re: How to use ManiaLib?

Post by gouxim » 20 Jun 2011, 10:15

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 ?
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)

User avatar
Slaat3
Posts: 66
Joined: 19 Jun 2011, 08:36
Location: Romania
Contact:

Re: How to use ManiaLib?

Post by Slaat3 » 20 Jun 2011, 10:36

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.

User avatar
gouxim
Nadeo
Nadeo
Posts: 1154
Joined: 14 Jun 2010, 17:20

Re: How to use ManiaLib?

Post by gouxim » 20 Jun 2011, 11:43

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.
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)

User avatar
Slaat3
Posts: 66
Joined: 19 Jun 2011, 08:36
Location: Romania
Contact:

Re: How to use ManiaLib?

Post by Slaat3 » 21 Jun 2011, 16:26

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.

Post Reply

Return to “ManiaLib”

Who is online

Users browsing this forum: No registered users and 1 guest