Pagina 1 di 1

Simple Template System (STS) Prima volta !!

Inviato: 25/05/2005, 23:09
da bvlghi
Salve a tutti e buona sera
Sto cercando d'imparare ad usarei template x questa contrib, e fino a quando c'è da implementare qualche modulo tutto fila liscio(fino ad ora).
Ora mi è nato un problema serio.
Sto cercando d'integrare la LoginBox_5.21, diciamo che non sarebbe complicato ma usando STS la guida recita

Codice: Seleziona tutto

Se si vogliono aggiungere ulteriori blocchi nuovi o variabili di template, aggiungerle
anche nel file sts_user_code.php.
Nel mio piccolo penso che la variabile della loginbox sia
$loginboxcontent...Ora, Siccome sono un nubbio e non me ne vergogno , anche perche sto facendo una cosa che non ho mai fatto , ma ho tanta voglia d'imparare, come dovrei scrivere questa variabile x far si che funzioni?
Questo è il file sts_user_code.php dell' STS

Codice: Seleziona tutto

<?php 
$sts_block_name = 'catmenu';
    require(STS_START_CAPTURE);
    echo "\n<!-- Start Category Menu -->\n";
    echo tep_draw_form('goto', FILENAME_DEFAULT, 'get', '');
    echo tep_draw_pull_down_menu('cPath', tep_get_category_tree(), $current_category_id, 'onChange="this.form.submit();"');
    echo "</form>\n";
    echo "<!-- End Category Menu -->\n";
    require(STS_STOP_CAPTURE);
    $template['catmenu'] = $sts_block['catmenu'];
     function tep_get_category_tree($parent_id = '0', $spacing = '', $exclude = '', $category_tree_array = '', $include_itself = false) {
    global $languages_id;

    if (!is_array($category_tree_array)) $category_tree_array = array();
    if ( (sizeof($category_tree_array) < 1) && ($exclude != '0') ) $category_tree_array[] = array('id' => '0', 'text' => "Catalog");

    if ($include_itself) {
      $category_query = tep_db_query("select cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd where cd.language_id = '" . (int)$languages_id . "' and cd.categories_id = '" . (int)$parent_id . "'");
      $category = tep_db_fetch_array($category_query);
      $category_tree_array[] = array('id' => $parent_id, 'text' => $category['categories_name']);
    }

    $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and c.parent_id = '" . (int)$parent_id . "' order by c.sort_order, cd.categories_name");
    while ($categories = tep_db_fetch_array($categories_query)) {
      if ($exclude != $categories['categories_id']) $category_tree_array[] = array('id' => $categories['categories_id'], 'text' => $spacing . $categories['categories_name']);
      $category_tree_array = tep_get_category_tree($categories['categories_id'], $spacing . '   ', $exclude, $category_tree_array);
    }

    return $category_tree_array;
  }

?>
Mi basta capire la prima volta come si fa che poi penso che tutte le box da integrare saranno le stesse

Ringrazio tutti in anticipo

Ciao
Paolo

Dimenticavo questa parte di codice d'esempio che sicuramente è importante

Codice: Seleziona tutto

// PUT USER MODIFIED CODE IN HERE, SUCH AS NEW BOXES, ETC.

// The following code is a sample of how to add new boxes easily.
//  Just uncomment block below and tweak for your needs!
//  Use as many blocks as you need and just change the block names.

  // $sts_block_name = 'newthingbox';
  // require(STS_START_CAPTURE);
  // require(DIR_WS_BOXES . 'new_thing_box.php');
  // require(STS_STOP_CAPTURE);
  // $template['newthingbox'] = strip_unwanted_tags($sts_block['newthingbox'], 'newthingbox');
Come si tradice in parole povere italiane ?