basic php mixing with mld
5 posters
Page 1 of 1
basic php mixing with mld
Let's start this tutorial with the TM_mainmenu template from the manialink power pack
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
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
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)
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 !
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
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
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>";
?>
- 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>";
?>
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- Posts : 109
Join date : 2010-08-30
Re: basic php mixing with mld
hmm i like more to do it with if() and for home its just $mp=="home" OR $mp==""
Re: basic php mixing with mld
I tried it and it seems less glitchy with the switches and the breaks ^^
Scorm- Posts : 9
Join date : 2010-12-18
Re: basic php mixing with mld
Dude... everything looks so easy with mld thx for this easy tuto
Rots!- Posts : 2
Join date : 2010-10-02
Re: basic php mixing with mld
Nice tutorial.
But you don't talk nothing about maniacodes.
But you don't talk nothing about maniacodes.
adrian46rd- Posts : 2
Join date : 2014-07-28
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|