Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP
Author Message
Donovan
Client



Joined: Oct 07, 2003
Posts: 735
Location: Ohio

PostPosted: Fri Oct 05, 2007 12:37 pm Reply with quote

I have started modifying a custom built application at work and have a couple issues. The guy that built this thing is long gone. I can tell he based it heavily off of phpBB as the code looks very familiar. I can see comments throughout that reference phpBB.

Anyway..

I am putting together a reporting feature. I have a working link to the reports in the menu. I have a template installed that is viewable.

My problem is getting the selections in a popup, that is based on a template as well, to refresh the index.php page and display all questions with their corresponding statistics.

So far I'm just working on displaying the questions and will do the stats later.

The popup lets you select the course and createdby (user_id) of all the questions in the database.

Here is some of my code.

http://www.donovanfamily.us/flight/index.txt

the template that goes with this

http://www.donovanfamily.us/flight/index_body.txt

This following is the popup that is used to make the selections of course and user (author of the questions) which is done by using list boxes.

http://www.donovanfamily.us/flight/viewquestions.txt

and its template

http://www.donovanfamily.us/flight/viewquestions_body.txt

I'm thinking I will need three pages instead of just two. A getinfo.tpl along with getinfo.php, then a viewquestion along with its template file and lastly the index.php with would hold the original menu.

The problem is index is already displayed with the popup viewquestion on top. If I send the variables back to index I would need to refresh the page.

My non-existent knowledge of the term $template->assign_block_vars is a pain in my neck.
 
View user's profile Send private message Visit poster's website ICQ Number
Donovan







PostPosted: Tue Oct 09, 2007 7:28 am Reply with quote

So does anybody know why this wont work?

Code:
$template->set_filenames(array(

         'body' => 'reports/viewquestions_body.tpl')
      );   


      //Start
            
            $result = $db->sql_query("SELECT * FROM ".QUESTIONS_TABLE." q
            JOIN ".COURSE_TABLE." c ON (q.course_id = c.course_id)
            JOIN ".USERS_TABLE." u ON (u.user_id = q.createdby)
            WHERE q.course_id = ".$course_id." AND q.createdby = ".$user_id."");            
            
            if (!$result) {
      echo("<p>Error performing query: " . mysql_error() . "</p>");
            exit();   
            }      
      
      while ($question = $db->sql_fetchrow($result))    {


I then assign my variables
Code:


$template->assign_block_vars('question',array('qno' => $i, 'qid' => $question['question_id'],
                                 'NAME' => $question['ques_name'],
                                 'STEM' => nl2br($question['stem'])."<br>",
                                 'MEDIA' => $media."<br>",
                                 'FEED' => $question['feedback']."<br>"));



And in the end I generate the page.

Code:


$template->pparse('body');


All that comes up is the shell of the template with no data.
 
Donovan







PostPosted: Fri Oct 12, 2007 9:20 am Reply with quote

Made some changes to try and get this working.

My main index page

http://www.donovanfamily.us/flight/index.txt

the template that goes with this

http://www.donovanfamily.us/flight/index_body.txt

Where I can bring up the popup to select the courses and createdby (author of the questions)

http://www.donovanfamily.us/flight/getinfo.txt

and its template

http://www.donovanfamily.us/flight/getinfo_body.txt

Which sends me to the page to view all the questions from the course selected by author.

http://www.donovanfamily.us/flight/viewquestions.txt

and its template

http://www.donovanfamily.us/flight/viewquestions_body.txt

I think my issue resides with the assign_block_vars not working as intended.

I can manually assign values

$media = $question['stem'];

then echo these out but am unable to pass these using the

assign_block_vars so they appear in the template.

This phpBB template engine is difficult for me to understand but that is what the previous developer used.

There are over 4000 questions from probably 100 authors in the database.

As always thanks for any assistance.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©