Hi all,
I hope to do a not stupid question.

Where can I find the definition of Drupal site variables?
Sometime in the code I'd like to use
- the site address (http://...)
- the user logged (name and email)
- the main admin user (name an email)
- other base info.

I don't know how these vars are named (except $user that I see in some code, but I never know what are the variable fields).

Thanks

Comments

nancydru’s picture

mikeschinkel’s picture

the site address (http://...)
global $base_url;
print $base_url;

Also useful:

print request_uri();
print base_path();
the user logged (name and email)
global $user;
print $user->name . ' [' . $user->mail . ']';
the main admin user (name an email)
Although there is probably an easier way...
$admin= db_fetch_object(db_query("SELECT name,mail FROM {users} WHERE uid=1"));  
print $admin->name . ' [' . $admin->mail . ']';
other base info.
Such as...?
devbox’s picture

I thank you.

For now it's ok.
My question is: I found that the site email is $site_mail, but the site name should be $site_name but this does not work to me and I found variable_get('site_name', 'Drupal') to get it... is this right? Why this difference?
It would be nice to know where the variables are set, so I can see the list of them :)

nancydru’s picture

They are stored in the table named "variable." The easiest ways to see their values are to browse the database with phpMyAdmin, use the Devel module, or use the Site Documentation module.

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

mikeschinkel’s picture

If you use Windows let me suggest getting PhpED for debugging ($69, I think), and from MySQL get HeidiSQL (open-source)! They will make learning this things MUCH easier, it did for me!

@devbox: Why this difference?

I dunno. Full moon affected the Drupal core developers. maybe?

devbox’s picture

But... for php there are no other debugger ide?

mikeschinkel’s picture

By "other" do you mean "free?"

Not that I am aware of but I'd be interested to know if someone else knows of a good free one.

devbox’s picture

Free and good :)

I don't understand why php that is used from a lot of developers and is so complex to write and to debug :(

mikeschinkel’s picture

I don't understand why php that is used from a lot of developers and is so complex to write and to debug :(

Amen, brother! :-)

devbox’s picture

I'm trying the Pdt project under eclipse http://www.eclipse.org/pdt/
It seems a little good, but it is really complex to install and make the debugger work :( and it is good, but not really good...

mikeschinkel’s picture

Thanks. I'm trying to stay away from Eclipse until I'm forced!

mikeschinkel’s picture

Double post, sorry.