- Автор темы
- #1
Ребята помогите
создал мод, но вот как его к шаблону привязать не понимаю
Помогите пожалуйста
есть мод
\engine\modules\phone.php
в engine.php
прописал
создал мод, но вот как его к шаблону привязать не понимаю
Помогите пожалуйста
есть мод
\engine\modules\phone.php
PHP:
<?php
//соеденяемся с ДБ
$connection = mysql_connect("localhost", "root", "pass") or die(mysql_error());
mysql_select_db("wsdb", $connection);
//Кодировочка
mysql_query('SET NAMES cp1251');
/*
шапачка для таблицы !
*/
print <<<TEXT
<table width="100%" border="2" cellpadding="2">
<tr bgcolor="#CCCCCC">
<th width="20%" height="30" rowspan="2" align="center" scope="col"><strong>Ф.И.О.</strong></th>
<th width="27%" rowspan="2" align="center" scope="col"><strong>Должнасть</strong></th>
<th width="5%" rowspan="2" align="center" scope="col"><strong>Кабинет</strong></th>
<th colspan="3" align="center" scope="col"><strong>Телефоны</strong><strong></strong></th>
<th width="18%" rowspan="2" align="center" scope="col"><strong>E-Mail</strong></th>
<th width="5%" rowspan="2" align="center" scope="col"> </th>
</tr>
<tr bgcolor="#CCCCCC">
<th align="center" scope="col">внутр</th>
<th align="center" scope="col">внешн</th>
<th align="center" scope="col">моб</th>
</tr>
TEXT;
//делаем 3-ю ступень цикла DO
// 1) определяем основной тип
$ws_plase = mysql_query("select * from ws_dep_str where plase_swich='1' order by plase_seq", $connection);
$ws_plase_n = mysql_fetch_array($ws_plase);
do
{
$pl_n = $ws_plase_n[plase_name];
print <<<TEXT
<tr bgcolor="#777999">
<td height="27" colspan="8" align="center" valign="middle"><strong>$pl_n</strong></td>
</tr>
TEXT;
// 2) подразделение через do
$ws_dep = mysql_query("select * from ws_dep_str where dep_swich='1' and dep_plase='$pl_n' order by dep_seq ", $connection);
$ws_dep_n = mysql_fetch_array($ws_dep);
do
{
$dep_n = $ws_dep_n[dep_name];
$dep_p = $ws_dep_n[dep_plase];
$result = mysql_query("select * from ws_vcards where departament='$dep_n' and works='1' and plase='$pl_n' order by hierarchy ", $connection);
$myrow = mysql_fetch_array($result);
print <<<TEXT
<tr bgcolor="#EEEEEE">
<td height="8" colspan="8" align="center" valign="middle">___________________________________________________________________________</td>
</tr>
<tr bgcolor="#BBBBBB">
<td colspan="8" align="center" valign="middle"><strong>----==== $dep_n ====----</strong></td>
</tr>
TEXT;
// 3) табличка (для секретаря отдельно)
do
{
if ($myrow[post]=='Секретарь')
{
print <<<TEXT
<tr>
<td width="20%" rowspan="2" align="left" valign="middle">$myrow[lastname] $myrow[name] $myrow[patronymic]</td>
<td width="20%" rowspan="2" align="left" valign="middle">$myrow[post]</td>
<td width="5%" rowspan="2" align="center" valign="middle">$myrow[room]</td>
<td width="5%" rowspan="2" align="center" valign="middle">$myrow[Intphone]</td>
<td width="10%" align="center" valign="middle">Тел/Факс $myrow[Workphone]</td>
<td width="10%" rowspan="2" align="center" valign="middle">$myrow[mobile1]<br>$myrow[mobile2]</td>
<td width="25%" rowspan="2" align="left" valign="middle"><a href="mailto:$myrow[email1]">$myrow[email1]</a><br><a href="mailto:$myrow[email2]">$myrow[email2]</a></td>
<td width="5%" rowspan="2" align="center" valign="middle"> </td>
</tr>
<tr>
<td width="10%" align="center" valign="middle">Факс $myrow[infax]</td>
</tr>
TEXT;
}
else
{
print <<<TEXT
<tr>
<td width="20%" align="left" valign="middle">$myrow[lastname] $myrow[name] $myrow[patronymic]</td>
<td width="20%" align="left" valign="middle">$myrow[post]</td>
<td width="5%" align="center" valign="middle">$myrow[room]</td>
<td width="5%" align="center" valign="middle">$myrow[Intphone]</td>
<td width="10%" align="center" valign="middle">$myrow[Workphone]</td>
<td width="10%" align="center" valign="middle">$myrow[mobile1]<br>$myrow[mobile2]</td>
<td width="25%" align="left" valign="middle"><a href="mailto:$myrow[email1]">$myrow[email1]</a><br><a href="mailto:$myrow[email2]">$myrow[email2]</a></td>
<td width="5%" align="center" valign="middle"> </td>
</tr>
TEXT;
}
}
while ( $myrow = mysql_fetch_array($result));
}
while ($ws_dep_n = mysql_fetch_array($ws_dep));
}
while ($ws_plase_n = mysql_fetch_array($ws_plase));
//закрывем таблицу
print "</table>";
?>
в engine.php
прописал
PHP:
case "phone" :
include ENGINE_DIR.'/modules/phone.php';
break;