Chi Kien Uong
Geranienstraße 30
71034 Böblingen
Deutschland / Germany
|
If you are not registered or logged in, you may still use these forums but with limited features.
Show recent topics
|
|
|
Author |
Message |
07/03/2007 20:48:28
|
Michael_C
Newbie
Joined: 26/02/2006 01:01:52
Messages: 4
Offline
|
I've added a front end to Advanced poll, to display a list of all "active" polls. Each poll on this list can have a "vote" or "view results" button, which depends on wheter a member has already voted or not on a given poll. It worked fine on the old site, but I'm now trying to migrate it to the new site which is using mambo. The first step I took was to see if I could get the poll list to display correctly using a hard coded user id. This worked fine, and it displayed all of the active polls with the appropriate "vote" and "view results" buttons for the user (hard coded). However, I had no success when I removed the hard coded user id, and tried to get the id for the currently logged on user, from the session array.
This brings me to where I'm at now. Instead of having the mambo menu item link directly to poll's index.php file, I had it link to a new script, prepoll.php, whose job was going to be to get the user information and make the info available to poll's index.php - In a test, I made some "play" info visible to index.php, however the displaying of the poll index didn't occur. For the poll list to be displayed, index.php is to be executed twice. The first time $action var is not set, and the default of the case statement (below) is called. poll_index() is a function in index.php, and it would normally execute when the case stament's default is hit.
When I use prepoll.php I have the following line of code
to call index.php.
It goes into index.php fine, dummy/text info is passed to it from prepoll.php, and it goes into the default section of the case statement. However, it doesn't execute poll_index(), because it never goes back into index.php.
Is the include I have in prepoll the problem?
In order to make the session array work correctly in the old site I had to make sure the session array was referenced relative to the domain by using ini_set - e.g., ini_set('session.cookie_domain','.mydomain') ;
I don't have full freedom in the mambo environment, so I thought I could use mambo's get_user() function in prepoll.php and set the session array the way I need it to be set.
Maybe the crux of my question is: How, in php, do you call script B from script A so script B runs the same way as if script B was executed directly?
|
|
|
|
|
|
Based on the open source JForum
|