Api editing site information

For discussion of the Poker Mavens server module and other administration topics

Api editing site information

Postby coyote » Thu Sep 02, 2010 8:37 am

Hi
Is it possible to have an API for editing text site news ?
coyote
 
Posts: 25
Joined: Wed Sep 30, 2009 4:10 am

Re: Api editing site information

Postby Kent Briggs » Thu Sep 02, 2010 9:14 am

coyote wrote:Hi
Is it possible to have an API for editing text site news ?


See the SystemGet and SystemSet commands in the docs. Those apply to every setting on the System tab.
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 3806
Joined: Wed Mar 19, 2008 8:47 pm

Re: Api editing site information

Postby coyote » Fri Sep 03, 2010 4:31 am

If I use this function I have only the first line of text
Code: Select all
<?php
  // Connexion au serveur de jeu
 include "API.php";  // $pw and $url set in this file

  $params = "Password=" . $pw . "&Command=SystemGet&Property=SiteNews";
  $api = Poker_API($url,$params,true);
  $result = $api["Result"];
  if ($result == "Error") die("Error: " . $api["Error"]);
  $sitenews = $api["Value"];

?>

How to get it in full and be able to edit?
if feasible course
in any case thank you for the help I have been very useful ;)
coyote
 
Posts: 25
Joined: Wed Sep 30, 2009 4:10 am

Re: Api editing site information

Postby Kent Briggs » Fri Sep 03, 2010 9:49 am

coyote wrote:If I use this function I have only the first line of text


The carriage return/line feeds in the Site News are messing up the associated array in $api[]. The easiest workaround is to replace them with html break tags. So instead of this:

This is the site news
This is line 2
This is line 3

You enter it as one long line like this:

This is the site news<br/>This is line 2<br/>This is line 3

If you don't want to do that, then change the call to Poker_API() so that the third parameter is false like this:

$api = Poker_API($url,$params,false);

That means that the $api[] array is now just a regular array where you access the elements by their index number:

$api[0] = "Result=Ok"
$api[1] = "Value=This is the site news"
$api[2] = "This is line 2"
$api[3] = "This is line 3"

You'll have to manually loop through the array and pull out the individual lines.
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 3806
Joined: Wed Mar 19, 2008 8:47 pm


Return to Site Administration

Who is online

Users browsing this forum: No registered users and 2 guests