28.12.2007, 03:48 | #1 |
Новичок
Регистрация: 28.12.2007
Сообщений: 3
Вес репутации: 0
|
Lore
Помогите вставить код в движок Lore, там шаблоны *.tpl используются...
по ходу: в index.php есть строчка PHP код:
Код:
function display() { $this->_initialize_query(); $template_vars = array( 'have_row_checkboxes' => $this->have_row_checkboxes, 'have_order_by_controls' => $this->have_order_by_controls, 'current_page' => $this->current_page, 'total_results' => $this->total_results, 'num_pages' => $this->num_pages, 'have_page_controls' => $this->have_page_controls, 'name' => $this->name, 'icon' => $this->icon, 'links' => $this->links, 'option_fields' => $this->option_fields, 'search_fields' => $this->search_fields, 'advanced_action_fields' => $this->advanced_action_fields, 'row_name' => $this->row_name, 'action' => $_SERVER['PHP_SELF'], 'num_cols' => $num_cols, 'field_names' => $field_names, 'num_link_cols' => count($this->links), 'rows' => $rows ); if( count($this->option_fields) || count($this->search_fields) || $this->have_page_controls ) { $template_vars['form']['update_results'] = $this->form->get_field_html('update_results'); } foreach( array_keys($this->option_fields) AS $field_id ) { $template_vars['form']['option_fields'][$field_id] = $this->form->get_field_html($field_id); } foreach( $this->search_fields AS $search_field ) { if( $search_field['type'] == 'text' ) { $template_vars['form']['search_by'] = $this->form->get_field_html('search_by'); $template_vars['form']['search_for'] = $this->form->get_field_html('search_for'); } } foreach( $this->fields AS $field ) { $field_names[] = $field['display_name']; } foreach( $this->query_fields AS $display_name => $array) { $field_names[] = $display_name; } if( $this->have_page_controls ) { if( $this->current_page > 1 ) { $template_vars['form']['prev_page'] = $this->form->get_field_html('prev_page'); $template_vars['form']['first_page'] = $this->form->get_field_html('first_page'); } if( $this->current_page < $this->num_pages ) { $template_vars['form']['next_page'] = $this->form->get_field_html('next_page'); $template_vars['form']['last_page'] = $this->form->get_field_html('last_page'); } $template_vars['form']['current_page_input'] = $this->form->get_field_html('current_page'); $template_vars['form']['results_per_page'] = $this->form->get_field_html('results_per_page'); } if( $this->have_order_by_controls ) { $template_vars['form']['order_by_field'] = $this->form->get_field_html('order_by_field'); $template_vars['form']['order_by_type'] = $this->form->get_field_html('order_by_type'); $template_vars['form']['order_by_submit_button'] = $this->form->get_field_html('order_by_submit_button'); } $rownum = 0; $result = $this->db->query( $this->select_query->make() ); while( $row = $this->db->fetch_array($result) ) { $row_checkboxes[$rownum] = $row['id']; // fields retrieved from database that need to be displayed foreach( $this->fields AS $field => $array ) { extract($array); $rows[$rownum]['fields'][$field] = $row[$field]; } // for each link, substitute in any fields from this row $linknum = 0; foreach( $this->links AS $link ) { $rows[$rownum]['links'][$linknum]['link'] = $link['display_name']; $vars = array(); foreach( $link['vars'] AS $var_name => $var_value ) { eval('$vars[$var_name] = ' . '"$var_name=' . $var_value . '";'); } $rows[$rownum]['links'][$linknum]['link_to'] = $link['script'] . '?' . implode('&', $vars); $linknum++; } $rownum++; } // end while $num_cols = count($this->fields)+count($this->links)+count($this->query_fields)+2; if( $this->have_row_checkboxes ) { $this->form->set_field_properties('row_checkboxes', array('select_options' => $row_checkboxes)); for( $i = 0; $i < count($rows); $i++ ) { $template_vars['form']['row_checkboxes'][$i] = $this->form->get_field_html('row_checkboxes', $i); } if( count( $this->advanced_action_fields ) ) { foreach( $this->advanced_action_fields AS $field_id => $advanced_action_field ) { $template_vars['form']['advanced_action_fields'][$field_id]['select'] = $this->form->get_field_html($field_id . '_select'); $template_vars['form']['advanced_action_fields'][$field_id]['button'] = $this->form->get_field_html($field_id . '_button'); } } $template_vars['form']['action'] = $this->form->get_field_html('action'); $template_vars['form']['action_submit_button'] = $this->form->get_field_html('action_submit_button'); } $template_vars['rows'] = $rows; $template_vars['num_cols'] = $num_cols; $template_vars['field_names'] = $field_names; $template_vars['form']['submit_action'] = $this->form->get_property('submit_action'); $this->te->assign($template_vars); $this->te->display($this->template); } // end function display Возможно что выше мной написанный бред(c моим базовым знанием пхп), и надо сделать по другому, кто знает подскажите) |
28.12.2007, 09:07 | #2 |
Специалист
|
Правильно думаете.
__________________
|