Manialinks

Discuss everything related to Maniaplanet.

Moderator: English Moderator

User avatar
danodude
Posts: 176
Joined: 01 Dec 2011, 12:25
Location: Western Australia

Manialinks

Post 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! :)
User avatar
jonthekiller
Translator
Translator
Posts: 4629
Joined: 15 Jun 2010, 11:07
Location: In Maniaplanet Alpha
Contact:

Re: Manialinks

Post 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>
Image
User avatar
danodude
Posts: 176
Joined: 01 Dec 2011, 12:25
Location: Western Australia

Re: Manialinks

Post by danodude »

And that sends the info to the php script, right?

Thanks :)
User avatar
jonthekiller
Translator
Translator
Posts: 4629
Joined: 15 Jun 2010, 11:07
Location: In Maniaplanet Alpha
Contact:

Re: Manialinks

Post by jonthekiller »

Yes, in the page you can write this :

Code: Select all

$_GET['name']
Image
User avatar
danodude
Posts: 176
Joined: 01 Dec 2011, 12:25
Location: Western Australia

Re: Manialinks

Post by danodude »

Ahhhhh ok... I'm beginning to get it :D Thanks a lot :thumbsup:
User avatar
danodude
Posts: 176
Joined: 01 Dec 2011, 12:25
Location: Western Australia

Re: Manialinks

Post 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!
User avatar
jonthekiller
Translator
Translator
Posts: 4629
Joined: 15 Jun 2010, 11:07
Location: In Maniaplanet Alpha
Contact:

Re: Manialinks

Post 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^^.
Image
User avatar
danodude
Posts: 176
Joined: 01 Dec 2011, 12:25
Location: Western Australia

Re: Manialinks

Post 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
User avatar
danodude
Posts: 176
Joined: 01 Dec 2011, 12:25
Location: Western Australia

Re: Manialinks

Post 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!
User avatar
jonthekiller
Translator
Translator
Posts: 4629
Joined: 15 Jun 2010, 11:07
Location: In Maniaplanet Alpha
Contact:

Re: Manialinks

Post by jonthekiller »

Which PHP version?

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

Return to “Maniaplanet”

Who is online

Users browsing this forum: No registered users and 1 guest