Gallaz Software
Would you like to react to this message? Create an account in a few clicks or log in to continue.

basic php mixing with mld

5 posters

Go down

basic php mixing with mld Empty basic php mixing with mld

Post  bibi Sat Jan 08, 2011 6:29 pm

Let's start this tutorial with the TM_mainmenu template from the manialink power pack
basic php mixing with mld 4d288e271fa39
This will be the home page of our manialink
Then hide the frame Window-TM
Create a new frame here in the exemple called tracks
basic php mixing with mld 4d288e942b346
This will be what we see when we press the "my tracks button"
Now let's save every frame to a file : track.xml,home.xml,menu.xml,bckg.xml
(Right click on each frame : save frame)
Now create a new document and 4 frames
right click on first frame : include frame from a distant xml file
basic php mixing with mld 4d288ea70bfa1
then in the frame properties click the File button. This will upload the selected file (here on the picture track.xml) on your FTP host.
Save the document and export as php
now edit your php file with something like notepad+ or whatever...

you should have something like that :
(note that i use relative urls)
Code:

<?php
echo "<?xml version='1.0' encoding='UTF-8'?>";
echo "<manialink>";
echo "    <timeout>0</timeout>";
echo "    <type>default</type>";
echo "    <frame>";
echo "        <include url='./bckg.xml'></include>";
echo "        <include url='./menu.xml'></include>";
echo "        <include url='./home.xml'></include>";
echo "        <include url='./track.xml'></include>";
echo "    </frame>";
echo "</manialink>";
?>
change the code like this
Code:

<?php
if(isset($_GET['page'])) {
  $page = $_GET['page'];
} else {
  $page="home";
}
echo "<?xml version='1.0' encoding='UTF-8'?>";
echo "<manialink>";
echo "    <timeout>0</timeout>";
echo "    <type>default</type>";
echo "    <frame>";
echo "        <include url='./bckg.xml'></include>";
echo "        <include url='./menu.xml'></include>";
switch ($page) {
case "home":
echo "        <include url='./home.xml'></include>";
break;
case "track":
echo "        <include url='./track.xml'></include>";
break;
}
echo "    </frame>";
echo "</manialink>";
?>
This code gets the parameter "page"
if not set the parameter is "home"
the switch instruction decides to show the frame home.xml or track.xml... You can add as many pages as you want...

Upload this php file and register it on the player page with a code for exemple md:tutophp
now if you type in the tm eplorer md:tutophp you will see the home page (you can also type md:tutophp?page=home)
and if you type md:tutophp?page=track then you'll see the track page

lastly, our menu doesn't wortk because we didn't set the right url. (In the template by default the code is maniad)
We have to edit menu.xml
for this right-click on the frame <menu> and select make editable
select the first button. In the object property : if object clicked then goto : replace maniad by md:tutophp?page=home
same thing for the second button with code : md:tutophp?page=track
then save the menu frame
to upload our newly corrected "menu" frame (we already made it before) : right-click > include frame from a distant file. Select file >menu.xml, it will be uploaded and we are done !
bibi
bibi

Posts : 109
Join date : 2010-08-30

Back to top Go down

basic php mixing with mld Empty Re: basic php mixing with mld

Post  Banane9 Sun Jan 09, 2011 3:07 pm

hmm i like more to do it with if() and for home its just $mp=="home" OR $mp==""
Banane9
Banane9

Posts : 26
Join date : 2010-11-30
Age : 27
Location : Germany

http://banane9.ba.funpic.de/phpbb/

Back to top Go down

basic php mixing with mld Empty Re: basic php mixing with mld

Post  Scorm Mon Jan 10, 2011 1:12 am

I tried it and it seems less glitchy with the switches and the breaks ^^

Scorm

Posts : 9
Join date : 2010-12-18

Back to top Go down

basic php mixing with mld Empty Re: basic php mixing with mld

Post  Banane9 Mon Jan 10, 2011 12:38 pm

hmm never had a problem with that Very Happy
Banane9
Banane9

Posts : 26
Join date : 2010-11-30
Age : 27
Location : Germany

http://banane9.ba.funpic.de/phpbb/

Back to top Go down

basic php mixing with mld Empty Re: basic php mixing with mld

Post  Rots! Tue Jan 18, 2011 12:27 am

Dude... everything looks so easy with mld thx for this easy tuto

Rots!

Posts : 2
Join date : 2010-10-02

Back to top Go down

basic php mixing with mld Empty Re: basic php mixing with mld

Post  adrian46rd Tue Jul 29, 2014 1:08 pm

Nice tutorial.
But you don't talk nothing about maniacodes.

adrian46rd

Posts : 2
Join date : 2014-07-28

Back to top Go down

basic php mixing with mld Empty Re: basic php mixing with mld

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum