Api editing site information

For discussion of the Poker Mavens server module and other administration topics
Post Reply
coyote
Posts: 29
Joined: Wed Sep 30, 2009 4:10 am

Api editing site information

Post by coyote »

Hi
Is it possible to have an API for editing text site news ?
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: Api editing site information

Post by Kent Briggs »

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.
coyote
Posts: 29
Joined: Wed Sep 30, 2009 4:10 am

Re: Api editing site information

Post by coyote »

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 ;)
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: Api editing site information

Post by Kent Briggs »

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.
Post Reply