Hi
Is it possible to have an API for editing text site news ?
Api editing site information
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: Api editing site information
See the SystemGet and SystemSet commands in the docs. Those apply to every setting on the System tab.coyote wrote:Hi
Is it possible to have an API for editing text site news ?
Re: Api editing site information
If I use this function I have only the first line of text
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
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"];
?>
if feasible course
in any case thank you for the help I have been very useful
-
- Site Admin
- Posts: 5880
- Joined: Wed Mar 19, 2008 8:47 pm
Re: Api editing site information
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:coyote wrote:If I use this function I have only the first line of text
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.