Page 1 of 2

Manialinks

Posted: 07 Aug 2012, 08:24
by danodude
Hi all, I have asked this before, but I would like to know how to use PHP with manialinks.

I'm not a PHP pro, but I know enough to upload files, send emails, get info from forms etc in HTML.

I have been having trouble getting my brain around using it in manialinks though. There doesnt seem to be a attribute to get the information from the <entry> tag in manialinks. Would someone be able to give me a small example of getting some information from a user using a button, <entry>, and PHP?

This is what I've managed to get so far:

Code: Select all

<?php

$name = "danodude";

?>

<manialink version="1">
	<frame posn="0 0 0">
		<quad posn="0 0 0" sizen="100 40" style="Bgs1InRace" substyle="BgWindow3"/>
		<label posn="0 0 1" scale="1" text="<?php echo $name; ?>"/>
		<entry posn="0 -4 1" sizen="60 20" name="entry1" default="Enter your name"/>
		<label posn="0 -30 1" style="CardButtonMedium" text="Apply" manialink="http://localhost/ManialinkPreviewer/test.php"/>
	</frame>
</manialink>
Thanks! :)

Re: Manialinks

Posted: 07 Aug 2012, 09:00
by jonthekiller
You can add the ?name=entry1 in the url like this :

Code: Select all

<?php

$name = "danodude";

?>

<manialink version="1">
   <frame posn="0 0 0">
      <quad posn="0 0 0" sizen="100 40" style="Bgs1InRace" substyle="BgWindow3"/>
      <label posn="0 0 1" scale="1" text="<?php echo $name; ?>"/>
      <entry posn="0 -4 1" sizen="60 20" name="entry1" default="Enter your name"/>
      <label posn="0 -30 1" style="CardButtonMedium" text="Apply" manialink="http://localhost/ManialinkPreviewer/test.php?name=entry1"/>
   </frame>
</manialink>

Re: Manialinks

Posted: 07 Aug 2012, 12:26
by danodude
And that sends the info to the php script, right?

Thanks :)

Re: Manialinks

Posted: 07 Aug 2012, 13:01
by jonthekiller
Yes, in the page you can write this :

Code: Select all

$_GET['name']

Re: Manialinks

Posted: 08 Aug 2012, 08:03
by danodude
Ahhhhh ok... I'm beginning to get it :D Thanks a lot :thumbsup:

Re: Manialinks

Posted: 08 Aug 2012, 08:31
by danodude
Ok I've gotten this, but theres an error somewhere, would you be able to point it out?

This is the main page:

Code: Select all

<?php

$name = "danodude";

?>

<manialink version="1">
   <frame posn="0 0 0">
      <quad posn="0 0 0" sizen="100 40" style="Bgs1InRace" substyle="BgWindow3"/>
      <label posn="0 0 1" scale="1" text="<?php echo $name; ?>"/>
      <entry posn="0 -4 1" sizen="60 20" name="entry1" default="Enter your name"/>
      <label posn="0 -30 1" style="CardButtonMedium" text="Apply" manialink="http://localhost/ManialinkPreviewer/script.php?name=entry1"/>
   </frame>
</manialink>
This is the handling script:

Code: Select all

<?php

	$value = $_GET['entry1'];
	
?>

<manialink version="1">
	<frame posn="0 0 0">
		<quad posn="0 0 0" sizen="100 40" style="Bgs1InRace" substyle="BgWindow3"/>
		<label posn="0 0 1" scale="1" text="<?php echo $value; ?>"/>
	</frame>
</manialink>
I can't see anything wrong, but there must be something ;)

Thanks!

Re: Manialinks

Posted: 08 Aug 2012, 09:25
by jonthekiller

Code: Select all

<?php

   $value = $_GET['name'];
   
?>

<manialink version="1">
   <frame posn="0 0 0">
      <quad posn="0 0 0" sizen="100 40" style="Bgs1InRace" substyle="BgWindow3"/>
      <label posn="0 0 1" scale="1" text="<?php echo $value; ?>"/>
   </frame>
</manialink>
It's maybe better^^.

Re: Manialinks

Posted: 08 Aug 2012, 09:30
by danodude
lol ;) I've got the flu and I'm really dopey today :P I'll try that now.

Edit:

Thanks so much buddy!! It works... you have no idea how long I've wanted to make that work :D :D

Re: Manialinks

Posted: 08 Aug 2012, 09:38
by danodude
Uhmmmm... :lol:

I have another problem lol.

This is an invalid manialink file? It works if I replace

Code: Select all

$value = $_GET['name'];
with

Code: Select all

$value = 'danodude';

Code: Select all

<?php

	$value = $_GET['name'];
	
?>

<manialink version="1">
   <frame posn="0 0 0">
      <quad posn="0 0 0" sizen="100 40" style="Bgs1InRace" substyle="BgWindow3"/>
      <label posn="0 0 1" scale="1" text="<?php echo $value; ?>"/>
      <entry posn="0 -4 1" sizen="60 20" name="entry1" default="Enter your name"/>
      <label posn="0 -30 1" style="CardButtonMedium" text="Apply" manialink="http://localhost/ManialinkPreviewer/test.php?name=entry1"/>
   </frame>
</manialink>
Thanks for all the help!

Re: Manialinks

Posted: 08 Aug 2012, 10:55
by jonthekiller
Which PHP version?

If 5.3, it's maybe when you haven't a value in the $_GET['name'].