Татьяна5 писал(а): а в php как?
Код: Выделить всё
$sql = 'SELECT sc_id, sc_name
FROM ' . SC_TABLE;
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
$sc_array = array(
'SC_ID' => $row['sc_id'],
'SC_NAME' => $row['sc_name'],
);
$id = $row['sc_id'];
$sql2 = 'SELECT smiley_id, code, smiley_url, smiley_width, smiley_height
FROM ' . SMILIES_TABLE . '
WHERE sc_id = ' . $id;
$result2 = $this->db->sql_query($sql2);
while ($row2 = $this->db->sql_fetchrow($result2))
{
$smiley = array(
'SMILEY_ID' => $row2['smiley_id'],
'CODE' => $row2['code'],
'SMILEY_URL' => $row2['smiley_url'],
'WIDTH' => $row2['smiley_width'],
'HEIGHT' => $row2['smiley_height'],
);
$this->template->assign_block_vars('sc.smiley', $smiley);
}
$this->db->sql_freeresult($result2);
$this->template->assign_block_vars('sc', $sc_array);
}
$this->db->sql_freeresult($result);
Код: Выделить всё
<!-- BEGIN sc -->
<strong>{sc.SC_NAME}</strong>
<!-- BEGIN smiley -->
<a href="#" onclick="insert_text('{sc.smiley.CODE}', true); return false;">
<img src="./images/smilies/{sc.smiley.SMILEY_URL}" width="{sc.smiley.WIDTH}" height="{sc.smiley.HEIGHT}" alt="{sc.smiley.CODE}" title="{sc.smiley.CODE}">
</a>
<!-- END smiley -->
<!-- END sc -->
Татьяна5 писал(а): И действительно ли в исходном коде порядок поменялся
В исходнике черт ногу сломит:
Код: Выделить всё
<strong></strong>
<a href="#" onclick="insert_text(';)', true); return false;">
<img src="./images/smilies/icon_e_wink.gif" width="15" height="17" alt=";)" title=";)">
</a>
<strong></strong>
<a href="#" onclick="insert_text(':(', true); return false;">
<img src="./images/smilies/icon_e_sad.gif" width="15" height="17" alt=":(" title=":(">
</a>
<strong></strong>
<a href="#" onclick="insert_text(':o', true); return false;">
<img src="./images/smilies/icon_e_surprised.gif" width="15" height="17" alt=":o" title=":o">
</a>
<strong></strong>
<a href="#" onclick="insert_text(':shock:', true); return false;">
<img src="./images/smilies/icon_eek.gif" width="15" height="17" alt=":shock:" title=":shock:">
</a>
<strong></strong>
<a href="#" onclick="insert_text(':?', true); return false;">
<img src="./images/smilies/icon_e_confused.gif" width="15" height="17" alt=":?" title=":?">
</a>
<strong>Первая категоря</strong>
Почему то повторяется стронг, там где он не должен быть...