Page 1 of 1

Maniaflash as frame like tsviewer

Posted: 16 Feb 2014, 22:03
by NJin
Are there any possibilities to include the maniaflash news into your own manialink?

Re: Maniaflash as frame like tsviewer

Posted: 17 Feb 2014, 13:56
by magnetik
That's something we want do to :thumbsup:

For now, you can use our WebServices to retreive the messages from a specific channel.

Re: Maniaflash as frame like tsviewer

Posted: 17 Feb 2014, 20:04
by NJin
And how i can add this? xD

Re: Maniaflash as frame like tsviewer

Posted: 18 Feb 2014, 16:49
by NJin
Is there s specific code for maniaflash?
Because my php knowledge is not so good

Re: Maniaflash as frame like tsviewer

Posted: 18 Feb 2014, 17:24
by w1lla
ManiaFlash GetChannel:

done with webservices:

Code: Select all

<?php
/**
 * Maniaplanet Web Services SDK for PHP
 *
 * @copyright   Copyright (c) 2009-2011 NADEO (http://www.nadeo.com)
 * @license     http://www.gnu.org/licenses/lgpl.html LGPL License 3
 * @author      $Author: maximeraoust $:
 * @version     $Revision: 2 $:
 * @date        $Date: 2011-09-08 18:03:11 +0200 (Thu, 08 Sep 2011) $:
 */
require_once __DIR__.'/libraries/autoload.php';

try
{
$mf = new Maniaplanet\WebServices\ManiaFlash('loginMPWS','passwordMPWS');
$id = 'thedoge'; // ManiaFlash Channel ID:
$list = $mf->getChannel($id);
	/**
	 * Return informations about a ManiaFlash
	 * @param string $id
	 * @return Object
	 *			- name
	 *			- description
	 *			- id
	 * @throws Exception
	 */
var_dump($list->id);
}
catch(\Maniaplanet\WebServices\Exception $e)
{
	echo "Error!\n";
	printf('HTTP Response: %d %s', $e->getHTTPStatusCode(),
		$e->getHTTPStatusMessage());
	echo "\n";
	printf('API Response: %s (%d)', $e->getMessage(), $e->getCode());
	echo "\n";
}
echo "\n";
?>
You can also do GetMessages to get some messages:

Code: Select all

<?php
/**
 * Maniaplanet Web Services SDK for PHP
 *
 * @copyright   Copyright (c) 2009-2011 NADEO (http://www.nadeo.com)
 * @license     http://www.gnu.org/licenses/lgpl.html LGPL License 3
 * @author      $Author: maximeraoust $:
 * @version     $Revision: 2 $:
 * @date        $Date: 2011-09-08 18:03:11 +0200 (Thu, 08 Sep 2011) $:
 */
require_once __DIR__.'/libraries/autoload.php';

try
{
$mf = new Maniaplanet\WebServices\ManiaFlash('loginMPWS','passwordMPWS');
$id = 'thedoge'; // ManiaFlash Channel ID:
$list = $mf->getMessages($id, $offset = 0, $length = 10);
	/**
	 * Return latest messages of a channel
	 * @param string $id
	 * @return Object[]
	 *				- id
	 *				- author
	 *				- dateCreated
	 *				- message
	 *				- link
	 * @throws Exception
	 */
var_dump($list);
}
catch(\Maniaplanet\WebServices\Exception $e)
{
	echo "Error!\n";
	printf('HTTP Response: %d %s', $e->getHTTPStatusCode(),
		$e->getHTTPStatusMessage());
	echo "\n";
	printf('API Response: %s (%d)', $e->getMessage(), $e->getCode());
	echo "\n";
}
echo "\n";
?>

Re: Maniaflash as frame like tsviewer

Posted: 18 Feb 2014, 21:28
by NJin
Ok now i get this in the browser:

Code: Select all

array(1) { [0]=> object(stdClass)#3 (8) { ["id"]=> string(4) "2194" ["author"]=> string(8) "tm-jinzo" ["dateCreated"]=> string(19) "2014-02-16 22:16:37" ["message"]=> string(44) "Maniaflash for $i$0f0gτx$000. $fffCommunity" ["link"]=> NULL ["iconStyle"]=> NULL ["iconSubStyle"]=> NULL ["mediaURL"]=> string(0) "" } } 
Now i want to print out only the message, but how?

Re: Maniaflash as frame like tsviewer

Posted: 18 Feb 2014, 21:53
by w1lla
Message in this case will only report a Title message.

There is no way to show the details of the message only a way to link it.

for instance by getting:

Code: Select all

var_dump($list[0]->id);
Will get the id of the message or replace id with message

Re: Maniaflash as frame like tsviewer

Posted: 18 Feb 2014, 22:22
by NJin
hm damnit

Re: Maniaflash as frame like tsviewer

Posted: 20 Feb 2014, 13:58
by magnetik
It's just that we haven't updated the API.

We will add the full message soon.