Templates, custom functions, mysql

From: Date: Thu, 14 Aug 2003 19:53:22 +0000
Subject: Templates, custom functions, mysql
Groups: php.general 
Request: Send a blank email to php-general+get-159613@lists.php.net to get a copy of this message
Hi list, I'm using TemplatePower (http://templatepower.codocad.com/) as my template engine. There will be multiple rows of results, and the data is stored in the $tpl->assign(); parts. The function gets projects for a given employee. My function is at the bottom of this e-mail. The problem is that I can't get the results to be printed to my $template, or $home_tpl. $home_tpl is named home.tpl, and that's where the html code is that displays the results from worker_projects(); Can anyone help me out here? If you need more info, just let me know. Tyler Longren tyler@jdhost.com CODE BELOW function worker_projects() { $template = $home_tpl; $tpl = new TemplatePower("$template"); $tpl->prepare(); // Begin getting consulting projects. $consultingproject_sqltext = "SELECT customer.custid,customer.ownorgname,customerorder.custid,consultingproject.p rojectid,consultingproject.description,consultingproject.startdate,consultin gproject.enddate,consultingprojectassign.workerid,consultingprojectassign.pr ojectid FROM consultingproject,consultingprojectassign, customerorder, customer WHERE consultingprojectassign.workerid='$_COOKIE[workerid]' AND consultingproject.projectid=consultingprojectassign.projectid AND consultingproject.ordid = customerorder.ordid AND customer.custid = customerorder.custid ORDER BY enddate ASC"; $consultingproject_sql = mysql_query("$consultingproject_sqltext"); if (mysql_num_rows($consultingproject_sql) < "1") { $tpl->newBlock('no_consulting_projects'); $tpl->assign("no_consulting_projects","You don't have any consulting projects."); } else { $alternate = "1"; $tpl->newBlock('consulting_projects'); while ($row = mysql_fetch_array($consultingproject_sql)) { $tpl->newBlock('consulting_projects_data'); $tpl->assign("consulting_projectid","$row[projectid]"); $tpl->assign("consulting_company","$row[ownorgname]"); $tpl->assign("consulting_startdate","$row[startdate]"); $tpl->assign("consulting_enddate","$row[enddate]"); if ($alternate == "1") { $color = "#ffffff"; $tpl->assign("row_color","$color"); $alternate = "2"; } else { $color = "#cecece"; $tpl->assign("row_color","$color"); $alternate = "1"; } } } mysql_close($connection); $tpl->printToScreen(); return $tpl; // End getting consulting projects. }

« previous php.general (#159613) next »