Mysql DB -> export -> xml für Rss

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Genau!
    Problem ist, ich gebe die news in Tabellen aus! Deshalb weiss ich nicht wie ich ihm sagen soll dass er bei der Ausgabe diese Tabellen alle durchsuchen und ersetzen soll!
    PHP Code:
    <?php // replace.inc.php
    function replace($inhalt) {
       
    $eintrag =  str_replace(":-)""<img src=\"/phpBB2/images/smiles/icon_smile.gif\"
     border=\"0\" alt=\"\" title=\"\">"
    $inhalt);
       
    $eintrag =  str_replace(":)"
    "<img src=\"/phpBB2/images
    /smiles/icon_smile.gif\" border=\"0\" alt=\"\"
     title=\"\">"
    $inhalt);
    return 
    $eintrag;


    ?>
    Wie sage ich jetzt der Funktion dass sie die Tabellen mit den News auf der Site wo sie includet ist durchsuchen soll?
    Last edited by Gr3yh0und; 15-10-2005, 10:06.
    Bye
    Grey

    Comment


    • #17
      brich deinen code bitte um.
      PHP Code:
      // deine funktion inkludieren

      $ausgabe 'foo :-) bar';

      $ausgabe replace($ausgabe);

      echo 
      $ausgabe

      Comment


      • #18
        und wie bekomme ich den Eintrag in eine Variable? Ich gebe ja für jede News das ganze neu aus...
        PHP Code:
        <h2 align="center">Neuigkeiten</h2>
        <br> 
        <?php $sql "SELECT * FROM news ORDER BY NewsDatum DESC LIMIT 4";    
            
        $result mysql_query($sql) OR die(mysql_error());    
            if(
        mysql_num_rows($result)) {        
                while(
        $row mysql_fetch_assoc($result)) { 
                    
        $sql2 "SELECT
         UserID FROM users WHERE 
        UserName = '"
        .$row['NewsAutor']."'";    
                    
        $result2 mysql_query($sql2) OR die(mysql_error());    
                    if(
        mysql_num_rows($result2)) {        
                        while(
        $row2 mysql_fetch_assoc($result2)) {
                        
        $Datum date("d.m.Y H:i:s",strtotime($row['NewsDatum']));?>
        <table width="700"  border="0" align="center" cellpadding="0" cellspacing="0"
         bordercolor="#000000"
         class="textCentral2">
          <tr>
            <td><table width="100%"  border="0" cellpadding="0" cellspacing="0">
              <tr class="News">
                <td width="51%"><div align="center"><b><?php echo $row['NewsTitel'];
         
        ?></b></div></td>
                <td width="49%"><div align="center">gepostet am <b><?php echo $Datum;
         
        ?></b> von <?php echo 
        "<a href=index2.php?action=userdetails&ID=".$row2['UserID'].">
        "
        .$row['NewsAutor']."</a>"?></div></td>
                </tr>
            </table>
              <table width="100%"  border="0" cellpadding="0" cellspacing="0">
                <tr class="bevelTop">
                  <td height="18" valign="top"><div align="center"><?php echo 
        $row['NewsInhalt']; ?></div></td>
                </tr>
              </table>
        Last edited by Gr3yh0und; 15-10-2005, 10:06.
        Bye
        Grey

        Comment


        • #19
          Original geschrieben von penizillin
          brich deinen code bitte um.

          Comment


          • #20
            Hab ich doch, isses immernoch zu breit?
            Bye
            Grey

            Comment


            • #21
              ja, ich muss immer noch scrollen.

              hint:
              dein
              PHP Code:
              echo $row['NewsInhalt']; 
              ist das gleiche, wie mein
              PHP Code:
              echo $ausgabe

              Comment


              • #22
                Hi
                ja das hab ich mir auch gedacht... aber nicht wirklich umgesetzt... ich habs jetzt so
                PHP Code:
                 include 'replace.inc.php'
                PHP Code:
                 <table width="100%"  border="0" cellpadding="0" cellspacing="0">
                        <tr class="bevelTop">
                          <td height="18" valign="top"><div align="center"><?php
                 $inhalt 
                $row['NewsInhalt']; $inhalt replace($inhalt); echo $inhalt?>
                </div></td>
                        </tr>
                      </table>
                PHP Code:
                <?php // replace.inc.php
                function replace($inhalt) {
                   
                $eintrag =  str_replace(":-)""<img src=\"/phpBB2/images/smiles/
                icon_smile.gif\" border=\"0\" alt=\"\" title=\"\">"
                $inhalt);
                   
                $eintrag =  str_replace(":)"
                "<img src=\"/phpBB2/images/smiles/
                icon_smile.gif\" border=\"0\" alt=\"\" title=\"\">"
                $inhalt);
                return 
                $inhalt;


                ?>
                funzt aber trotzdem nicht?
                Last edited by Gr3yh0und; 15-10-2005, 10:07.
                Bye
                Grey

                Comment


                • #23
                  OK es wäre vllt sinnvoll $eintrag zurückzugeben anstatt $inhalt...

                  : ) verwandelt er jetzt, aber :- ) nicht

                  außerdem ist das ganze recht buggy... er wandelt jetzt nur 1 Smilie um... ?!?!?
                  Last edited by Gr3yh0und; 15-10-2005, 10:17.
                  Bye
                  Grey

                  Comment


                  • #24
                    So ich glaub ich weiss worans liegt dass er immer nur 1 smilieart umwandelt...
                    PHP Code:
                    <?php // replace.inc.php
                    function replace($inhalt) {
                        
                    $eintrag =  str_replace(";-)""<img
                     src=\"/friends/phpBB2/images/smiles/icon_wink.gif\">"
                    $inhalt);
                        
                    $eintrag =  str_replace(":)""<img
                     src=\"/friends/phpBB2/images/smiles/icon_smile.gif\">"
                    $inhalt);
                    return 
                    $eintrag;


                    ?>
                    wieso nimmt er immer nur das letzte her?
                    Last edited by Gr3yh0und; 15-10-2005, 10:41.
                    Bye
                    Grey

                    Comment


                    • #25
                      hint:
                      PHP Code:
                      <?php

                      $a 
                      'foo 1 bar';
                      $b null;

                      var_dump($a);
                      var_dump($b);

                      # ausgabe klar?

                      $b str_replace('1''0'$a);

                      var_dump($b); # ausgabe: "foo 0 bar"

                      $b str_replace('0''x'$a); # achtung! du veränderst wieder $a!

                      var_dump($b); # du erwartest: "foo x bar"

                      # tatsächliche ausgabe: "foo 1 bar", weil $a keine null enthält.

                      ?>

                      Comment

                      Working...
                      X