Regarding serendipity['dbPreifx']

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
manoj
Regular
Posts: 49
Joined: Tue Sep 05, 2006 12:20 pm

Regarding serendipity['dbPreifx']

Post by manoj »

hi,

when a query is executed how {$serendipity['dbPreifx']} is parsed and where exactly its value is replaced?
Also in serendipity_config_local.inc.php
$serendipity['dbPrefix'] is set to 'serendipity_'; from where is this value fetched?

In one of the customised query in userdefined function we used
serendipity_db_query("SELECT authorid FROM serendipity_".$table);
$table is passed as parameter to function, this was working fine.
but when we changed it to
serendipity_db_query("SELECT authorid FROM {$serendipity['dbPrefix']}" . $table); we are facing problems like in the left navigation the links are displayed like ADMIN_FRONTPAGE ,NEW_ENTRY , EDIT_ENTRIES and likewise for all the links.
why is this happening?
pls help me out.
thanks.
manoj
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Regarding serendipity['dbPreifx']

Post by garvinhicking »

Hi!

It is parsed by the value of the configuration of Serendipity; inside the DB Configuration you enter the prefix name of the database. Choosing a database prefix is only available in the "expert mode" of the Serendipity Installation first time.

The dbPrefix value is inserted in each SQL statement.
serendipity_db_query("SELECT authorid FROM {$serendipity['dbPrefix']}" . $table); we are facing problems like in the left navigation the links are displayed like ADMIN_FRONTPAGE ,NEW_ENTRY , EDIT_ENTRIES and likewise for all the links.
why is this happening?
It might be a problem because you did not use "global $serendipity" in your function where you called serendipity_db_query? And thus $serendipity['dbPrefix'] would have been empty?

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
manoj
Regular
Posts: 49
Joined: Tue Sep 05, 2006 12:20 pm

Post by manoj »

$v = "SELECT authorid FROM {$serendipity['dbPrefix']}" . $table;
echo $v;
The output is shown as:
SELECT authorid FROM serendipity_entries for one case(like when we add new entry).

The problem is only for administrator and when other users login the links are displayed fine(i.e the proper values like New Entry instead of New_Entry).

Also in administrator mode the , when we click on manage groups the three default(Admin,chief editor,standard editor) group names are not displayed but edit and delete links are shown for each of the 3 rows displayed. Also userdefined group names are displayed.

This is happening only when the query is changed as specified in previous post.

Also i have echoed the {$serendipity['dbPrefix']} and it prints serendipity_.
pls help.
thanks.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

This sounds as if the language constant files are not properly included.

What exactly did you patch? Does it happen with a s9y that you did not modify?

I'm a bit confused, I don'T understadn what you are doing. :)

Could you send some screenshots and explain what exactly you modified where and how, which files, etc.?

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply