Forum Moderators: coopster

Message Too Old, No Replies

php, mysql & postnuke

need help to display current user

         

wjmazza

9:46 pm on Jun 23, 2004 (gmt 0)

10+ Year Member



i am very new to php so sorry if what i am asking is very simple...

i am currently creating a theme for PostNuke [postnuke.com] which has a flash animation as the header... the flash contains dynamic text which is loaded from variables in an external file which i created using php so it can show the current user, the time, and hopefully the site name and slogan if i can get this right.

the data.php file looks like this

&site=<?php code?> //dont know the code
&slogan=<?php code?> //that i have to put
&usr=Welcome <?php code?>! // on these lines
&date=<?php print date("\T\o\d\a\y \i\s l, F j, Y")?> //this one works fine

all the data is stored in a mySQL database but i dont know how to pull the information from the database. i read a post on this site [webmasterworld.com] but i don't really understand how to manipulate the code that jatar_k posted to fit my needs... i understand the username, host, pass, but not the $query and the stuff like that...

walter

jatar_k

10:47 pm on Jun 23, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld wjmazza,

alright let's see if we can'ty find you a solution then

&site=<?php code?> //dont know the code
&slogan=<?php code?> //that i have to put
&usr=Welcome <?php code?>! // on these lines
&date=<?php print date("\T\o\d\a\y \i\s l, F j, Y")?> //this one works fine

first thing, why the ampersand?
is it creating a dynamic url that it will then use to call the flash file?

where will site, slogan and usr come from? db?

wjmazza

11:23 pm on Jun 23, 2004 (gmt 0)

10+ Year Member



the & is required by flash to define the variable names.
ex: the text field where i want it to display the site name is assigned the variable "site" and the field for the slogan is assigned "slogan." since the external file has many variables, the & sign distingueshs each variable from another so it becomes &site, &slogan, etc (the macromedia site said it has something to do with follwing cgi rules)

to my knowledge, the site name, slogan, and user names all come from the database. reading up on some documentation of postnuke, to call the sitename and slogan you type

$slogan = pnConfigGetVar('slogan'); //for slogan
$sitename = pnConfigGetVar('sitename'); //for site name

and then you put the $slogan and $sitename where you want theme to be displayed. i tried to do that but i get an error

Fatal error: Call to undefined function: pnconfiggetvar() in /homepages/44/d88176274/htdocs/html/~fcfcyouth/data.php on line 1

jatar_k

11:27 pm on Jun 23, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I would imagine from the look of that error that you need to include the library where the function is located.

Can you look at the includes in a file that uses pnConfigGetVar and see what libraries it includes? Then look in those libraries to find which one contains that function. Then add a line at the top of your file

include "/path/to/library.php";

that should fix that fatal error

wjmazza

11:29 pm on Jun 23, 2004 (gmt 0)

10+ Year Member



i forgot to metion...
1) the databes is mysql
2) the code is to call the site name & slogan is in php
3) i only get that fatal error when i access the file directly. if i access the theme page where the flash file is displayed, when it goes to call the data.php, it just leaves the areas where the site name, slogan and user name are suppose to be blank but it does show the date correctly

wjmazza

11:49 pm on Jun 23, 2004 (gmt 0)

10+ Year Member



found no mention of includes but looking at other themes as examples, the code is located is under another code

function themeheader() {

$slogan = pnConfigGetVar('slogan');
$sitename = pnConfigGetVar('sitename');
$banners = pnConfigGetVar('banners');

...html code here defining how to display the webpage...

)

btw... thanks for helping and sorry if what i am saying is not really helping you help me... complely new to php and i will not cover php in school until around my 3rd year (only a freshmen)

jatar_k

11:56 pm on Jun 23, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



at the top of the file where you found the themeheader function are there any includes for other files?

or is the pnConfigGetVar function locted in that file?

wjmazza

12:04 am on Jun 24, 2004 (gmt 0)

10+ Year Member



no includes at all
i hosted one of the files i am using as reference on my server <snip>
you can view the sorce with this file

[edited by: jatar_k at 1:53 am (utc) on June 24, 2004]
[edit reason] sorry no urls [/edit]

jatar_k

1:55 am on Jun 24, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



hm, I don't see anything in there either

is there a config file where those vars live?
is that file included by another file?
do you have the option of using grep to find occurences of that function?
or a "find in file" option in one of your text editors?

unless you can find out where those vars live or where that function is I am at a loss.

wjmazza

4:03 pm on Jun 24, 2004 (gmt 0)

10+ Year Member



yeah... it looks like this file (theme.php) is included by another file, which also calls the libray/config file(s) for these and other commands.

but don't worry about it n e more... i found out what the command is,

<?php pnUserGetVar('pn_name')?>
where "pn_name" is the column title in the mysql database that contains the Real name of the user, which i can easily replace with "pn_uname" to display the logged in user name....

but thanks for your help because if you didn't have me go on a hunt for those includes/files, i wouldn't have found the solution

walter mazza
(btw, sorry about the URL in the last post... must of have skiped that part of the TOS/Posting Rules but at least i didn't post the ENTIRE code! ;P )

wjmazza

4:05 pm on Jun 24, 2004 (gmt 0)

10+ Year Member



little off topic which is y i put it in a different post but it looks like 3 years ago today you registered for the forums... happy anniversary, i guess?

jatar_k

5:35 pm on Jun 24, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>>sorry about the URL in the last post

no big thing

>>least i didn't post the ENTIRE code

I was happy about that ;)
I did read through the file though before I removed the link

>>happy anniversary, i guess

well july, but thank you, 3 yrs, wow

Glad I could help you find a solution

wjmazza

6:56 pm on Jun 24, 2004 (gmt 0)

10+ Year Member



ohh oops! my bad! lol