Ole Sandberg | 7 Oct 01:03
Picon

mySql problem (I think)

I have a problem with my Spip-based site. I don't know exactly what
the problem is. I am no expert on php (or mySql) - but I can follow
simple instructions :-)

My site has a communication problem. All the cached text from Spip is
visible to the public but nothing from the database: no images and
none of the older articles. Also the search-function doesn't work and
- most importantly - I cannot access the private area. It seems to me
there's a database (perhaps a priviledge?) problem. The strange thing
is that it happened all of a sudden and I have not changed anything.

When I try to access the private area I get various error messages.
Such as "1045 Access denied for user: 'root <at> localhost' (Using
password: NO)"
I have also received the standard "500 Internal Server Error. The
server encountered an internal error or misconfiguration and was
unable to complete your request." And the message from Spip that "A
technical problem (mySql Server) prevents access to this part of the
site".

These messages can all mean different things and I cannot find any
information on them on Spip.net.

I have tried to delete the file "inc_connect" as well as the
".htaccess" to see if I can re-install my Spip. It does not help. When
I then try to go to ../ecrire it sends me to ../ecrire/install.php3
which seems right but the page is totally blank.

I have ftp-access and acess to the mySql database via MyAdmin

(Continue reading)

Gilles VINCENT | 7 Oct 03:04
Picon
Gravatar

Re: mySql problem (I think)

Hi,

your site is built on SPIP 1.82d .
This version is quite stable but you should start to update to the
version 1.8.3a
(because of 2 security fixes)

You won't loose data if you reinstall SPIP (or upgrade to spip 1.83a)
: you just have to choose during the installation process the database
that was used before.

Actually, when you remove inc_connect.php3, you are redirected to the
installation process. This is the correct process, but it fails at
this step. The fact that the page is blank can be due to diverse
reasons :
- Maybe the installation file was modified so that a new installation
can't be done
- Maybe your server does not support the extension .php3 anymore

As I just said,  you must install you website again.

You can find the latest build of the 1.8 branch (version [10336]) here :
http://tech-nova.fr/SPIP/spip-1.8.3-svn10336.zip

But this version will be useless if the .php3 extension isn't
supported by your server.
I have just built a version with the .php extension instead of .php3.
It can be downloaded here :
http://tech-nova.fr/SPIP/spip-1.8.3-svn10336-with-php.zip
(I used the transformation script available here :
(Continue reading)

Thomas Sutton | 7 Oct 06:42

Adding tables, loops, and tags

Hi folks,

I'm writing a plug-in to add a new type of "thing" to SPIP. I've  
started my plug-in (using the information on doc.spip.net) and have  
it creating my table and am now trying to write my loops and tags  
based on the examples in ecrire/public/boucles.php and also those in  
plugins/forms_et_plugins_1_9_1/public/forms_boucles.php. Alas, I have  
been unable to find any sort of pattern in the source nor any  
documentation for doing this. Can anyone recommend an example that I  
can use as a guide to:

1) Creating the database tables for a new type of thing (similar to  
ARTICLES, SITES, and the rest).
2) Create a new type of loop to query this table (I've got this  
working).
3) Create tags to access the data inside these loops. I'll need my  
own tags (#DESTINATION) and built-in ones (#TITRE, #DESCRIPTIF) to  
work on these.
4) Add join tables so that I can attach documents and mots to these  
things.
5) Create new criteria like {id_thing} so that I can get the  
documents attached to a 'thing'.
6) Tie this all together with an admin interface.

I've got some of this working in files mentioned in <fonctions> tags  
in plugin.xml:

1) I add $tables_principale['spip_things'] = array('field' => ...,  
'key' => ...); and call creer_base(); and my table is created.
2) I've added a function boucle_THINGS_dist($id, &$bs) based similar  
(Continue reading)

Thomas Sutton | 7 Oct 10:07

Re: Adding tables, loops, and tags

Hi list,

Next time, I'll have lunch *before* sending such a message. I went  
and sat in the park for an hour, came back and found <http:// 
doc.spip.org/@La-base-de-donnees,4391>. While a little bit sparse (it  
describes only four of the thirteen arrays mentioned), this says that  
I need a line like:

	$table_des_tables['things'] = 'things';

in my base/things.php file. I don't understand *why* this makes a  
difference (my loop ran the correct number times before, it just  
wouldn't access any data), but I can now use {numeric_column > 0} and  
#TITRE, and it works.

Now to figure out how to do documents and keywords...

Regards,

Thomas Sutton

Web Developer
bouncingorange
graphic + web design

On 07/10/2008, at 12:42 PM, Thomas Sutton wrote:

> Hi folks,
>
> I'm writing a plug-in to add a new type of "thing" to SPIP. I've  
(Continue reading)

Gilles VINCENT | 7 Oct 10:51
Picon
Gravatar

Re: Adding tables, loops, and tags

Hi

2008/10/7 Thomas Sutton <thomas@...>:
> <http://doc.spip.org/ <at> La-base-de-donnees,4391>. While a little bit sparse
> (it describes only four of the thirteen arrays mentioned), this says that I
> need a line like:
>
>        $table_des_tables['things'] = 'things';
>

The description of the table is better calculated in the version 2.0.
I think that you won't need this declaration.

> Now to figure out how to do documents and keywords...

Documents and keywords :
------------------------------------
>From memory you just have to create the tables spip_things_documents
and spip_things_mots.
I haven't tested it with the prefix of the plugin, but it should work.
There is no reason, because normally, when SPIP calculates the queries
from the loops, it doesn't take into account the prefix of the tables
(except in case of collisions)

The id of these tables must be id_thing, id_document, and id_mot :
that's necessary for SPIP to detect automatically the join queries.

Now you can use
<BOUCLE(THINGS){id_document=#ID_DOCUMENT}> : Displays the things
related to a document
(Continue reading)

Gilles VINCENT | 7 Oct 10:56
Picon
Gravatar

Re: Adding tables, loops, and tags

2008/10/7 Gilles VINCENT <gilles.vincent@...>:
> Now you can use
> <BOUCLE(THINGS){id_document=#ID_DOCUMENT}> : Displays the things
> related to a document

Of course the opposite join automatically works :
<BOUCLE(DOCUMENTS){id_thing=#ENV{myParameter}}> : Displays the
documents related to the thing which id is equal to myParameter

.Gilles
Thomas Sutton | 7 Oct 11:13

Re: Adding tables, loops, and tags

Hi Gilles,

On 07/10/2008, at 4:51 PM, Gilles VINCENT wrote:

> 2008/10/7 Thomas Sutton <thomas@...>:
>> <http://doc.spip.org/ <at> La-base-de-donnees,4391>. While a little bit  
>> sparse
>> (it describes only four of the thirteen arrays mentioned), this  
>> says that I
>> need a line like:
>>
>>        $table_des_tables['things'] = 'things';
>>
>
> The description of the table is better calculated in the version 2.0.
> I think that you won't need this declaration.

Great! I did seem really odd that some stuff works without it (the  
loop runs the right number of times) but other stuff does not (none  
of the tags inside the loop work). Everything I've seen of 2.0 looks  
fantastic. I'm looking forward to the release.

>> Now to figure out how to do documents and keywords...
>
> Documents and keywords :
> ------------------------------------
> From memory you just have to create the tables spip_things_documents
> and spip_things_mots.
> I haven't tested it with the prefix of the plugin, but it should work.
> There is no reason, because normally, when SPIP calculates the queries
(Continue reading)

Gilles VINCENT | 7 Oct 11:34
Picon
Gravatar

Re: Adding tables, loops, and tags

2008/10/7 Thomas Sutton <thomas@...>:
> I'd hoped it would be this simple, and it is. Perhaps this won't take me two
> weeks after all. ;-)

I hope also.
SPIP is sometimes really magic :)

> Is it possible to create a loop that takes it's data from some source other
> than the database? Data in a PHP array, for example?

The only solution to get some PHP values in the loops is to use #EVAL{}
Mixed with #SET, #GET, and #ARRAY, you should make it possible.
(#ARRAY may read a serialized array)

> I'm writing this all up as a tutorial on our internal wiki. I'll have to put
> the finished document online somewhere...

Great news !!

There is a website that id dedicaced to plugins : http://plugins.spip.net
Maybe you contribution could be published here.
(There is also http://doc.spip.org for the developpers)

Both sites aren't translated yet, but your contribution should be a good start

.Gilles
Thomas Sutton | 7 Oct 12:12

Re: Adding tables, loops, and tags

Hi Gilles,

On 07/10/2008, at 5:34 PM, Gilles VINCENT wrote:

> 2008/10/7 Thomas Sutton <thomas@...>:
>> I'd hoped it would be this simple, and it is. Perhaps this won't  
>> take me two
>> weeks after all. ;-)
>
> I hope also.
> SPIP is sometimes really magic :)
>
>> Is it possible to create a loop that takes it's data from some  
>> source other
>> than the database? Data in a PHP array, for example?
>
> The only solution to get some PHP values in the loops is to use  
> #EVAL{}
> Mixed with #SET, #GET, and #ARRAY, you should make it possible.
> (#ARRAY may read a serialized array)

I was thinking more of writing

<?php

function boucle_ALOOP_dist($id_boucle, &$boucles) {
	// Something
	return calculer_boucle($id_boucle, $boucles);
}

(Continue reading)

Fil | 7 Oct 12:21
Favicon
Gravatar

Re: Adding tables, loops, and tags

> where the objects that <BOUCLE(ALOOP)> loops over are not from a database
> query but instead, a PHP array, a DOM tree, an Iterable object, etc. Perhaps
> by stuffing the data for the loop into some variable in $boucles[$id_boucle]
> before the call to calculer_boucle()? Is this at all possible, or should I
> just import the data into a table before wanting to use it?

This was nearly put into SPIP 2.0, but we're still not quite sure
about the correct syntax, so in the meantime it is in the "SPIP 2.0
Reloaded" plugin by Cédric (no documentation yet).

svn://zone.spip.org/spip-zone/_plugins_/_test_/spip_2_reloaded

-- Fil

Gmane