Brauche hilfe beim eigenem Forum mit smarty

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • #16
    so hab alles mögliche was mir einfällt probiert und hab es jetzt so aber das klappt auch nicht richtig

    PHP-Code:
    while($row_catagories mysql_fetch_object($sql2))  
    {
     
    $catagories[] = array(
        
    'cat_title' => $row_catagories->title,      
         );
     
    $forums[] = array(
        
    'forum_name' => $row_catagories->name,
             
    'forum_desc' => $row_catagories->description
         
    );
        } 
    tpl

    Code:
    <table border="1" cellspacing="0" width="900" >
    <tr>
    <td>
    {foreach from=$catagorie item=categorie}
      <br><br>{$catagorie.cat_title} <br>
        {foreach from=$forums item=forums}
          --->{$forums.forum_name} <br>
    	   --->{$forums.forum_description}
        {/foreach}
    {/foreach}
    </td>
    </tr>
    </table>

    Kommentar


    • #17
      Hilfe bei Smarty tpl aus der DB parsen

      Bräuchte hilfe beim Parsen eines Templates aus einer Datenbank (Smarty) wenn jemand Ahnung dann bitte hilfe <.<

      PHP-Code:
      <?php session_start (); 
      require(
      'inc/function.php');
      require(
      'config.php');
      $absoluter_pfad dirname(__FILE__);
      define('SMARTY_DIR'$absoluter_pfad.'/smarty/');
      require(
      SMARTY_DIR.'Smarty.class.php');

       
      $connect mysql_connect($dbhost$dbuser$dbpass);
           if (!
      $connect)
            {
            die(
      'Verbindung nicht möglich : ' mysql_error());
            }
            else
            {
            
      $select mysql_select_db($dbname);
             if (!
      $select){
             die(
      'Konnte datenbank nicht auswählen: ' mysql_error());
             
      mysql_close($connect);
              }
              else
              {



      // put these function somewhere in your application
      function db_get_template ($tpl_name, &$tpl_source, &$smarty_obj)
      {
          
      // do database call here to fetch your template,
          // populating $tpl_source
          
      $sql = new SQL;
          
      $sql->query("select  content
                         from templates
                          where id='2'"
      );
          if (
      $sql->num_rows) {
              
      $tpl_source $sql->record['tpl_source'];
              return 
      true;
          } else {
              return 
      false;
          }
      }

      // register the resource name "db"
      $smarty->register_resource("db", array("db_get_template"));
      $datum ="22.3.89";
      $smarty->assign("date",$datum);    
      $smarty->display("db:index.tpl");


      mysql_close($connect);

      }
      }
      ?>
      fehler:


      Fatal error: Call to a member function on a non-object in .../testdb2.php on line 43

      Kommentar


      • #18
        unterlasse bitte das doppelposten! *zusammenführ*
        I don't believe in rebirth. Actually, I never did in my whole lives.

        Kommentar

        Lädt...
        X