PDF Name anstelle des Dateinamens

Gesperrt
Andreas
Beiträge: 254
Registriert: So 16. Nov 2003, 14:48
Wohnort: Reichshof
Kontaktdaten:

PDF Name anstelle des Dateinamens

Beitrag von Andreas »

Hallo zusammen,
ich möchte mit Hilfe des Download-Moduls (siehe unten) den Usern verschiedene PDF-Dateien anbieten. Nun soll aber nicht der Dateiname (also z.b. prospekt_11_04.pdf) angezeigt werden, sondern der Name, den ich unter "Medienname" im Downloadbereich eingeben kann (z.B. "Aktuelles Produktprospekt").

Hat jemand eine Idee?

Hier das Modul:
Input

Code: Alles auswählen

$wert = 0; 
$werte = array( 
"CMS_VAR[1]", "CMS_VALUE[1]", "CMS_VAR[3]", "CMS_VALUE[3]" , 
"CMS_VAR[4]", "CMS_VALUE[4]", "CMS_VAR[6]", "CMS_VALUE[6]" , 
"CMS_VAR[7]", "CMS_VALUE[7]", "CMS_VAR[9]", "CMS_VALUE[9]" , 
"CMS_VAR[10]", "CMS_VALUE[10]", "CMS_VAR[12]", "CMS_VALUE[12]" , 
"CMS_VAR[13]", "CMS_VALUE[13]", "CMS_VAR[15]", "CMS_VALUE[15]" , 
"CMS_VAR[16]", "CMS_VALUE[16]", "CMS_VAR[18]", "CMS_VALUE[18]" , 
"CMS_VAR[19]", "CMS_VALUE[19]", "CMS_VAR[21]", "CMS_VALUE[21]" , 
"CMS_VAR[22]", "CMS_VALUE[22]", "CMS_VAR[24]", "CMS_VALUE[24]" , 
"CMS_VAR[25]", "CMS_VALUE[25]", "CMS_VAR[27]", "CMS_VALUE[27]"); 

$query = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE filetype = 'pdf'"; 

$db->query($query); 

while ($db->next_record()) { 
//$knurpsel replaces old $filename 
$knurpsel[$db->f("idupl")] = $db->f("filename"); 

} // end while 

function d_checked($which) { 
  if ($which != "") { 
    return "checked"; 
  } 
} // end function 

echo "<table width=\"300\" cellspacing=\"1\" cellpadding=\"4\" border=\"0\" bgcolor=\"#000000\"> 
        <tr bgcolor=\"#cccccc\" align=\"center\"> 
          <td>Aktiv</td> 
          <td>Datei wählen</td> 
        </tr>"; 
for ( $i = 0; $i < 9; $i++ ){ 
      echo "<tr bgcolor=\"#ffffff\" align=\"center\"> 
                 <td><input name=\"$werte[$wert]\" value=\"on\""; 
      $wert++; 
      echo "type=\"checkbox\" ".d_checked("$werte[$wert]")."></td> 
                 <td>"; 
$wert++; 
echo "<select name=\"$werte[$wert]\">"; 
      $wert++; 
      if (is_array($knurpsel)) { 
          foreach ($knurpsel as $key => $value) { 
                   if ("$werte[$wert]" == $key) { 
                        echo "<option selected=\"selected\" value=\"". $key ."\">". $value ."</option>"; 
                   } else { 
                        echo "<option value=\"". $key ."\">". $value ."</option>"; 
                   } // end if 
          } // end foreach 
      } // end if 

      echo "  </select></td></tr>"; 
      $wert++; 
} // for ende 
echo "</table>"; 
Output

Code: Alles auswählen

<?php 



echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">"; 

if ("CMS_VALUE[1]" == "on") { 

  $s = "CMS_VALUE[3]"; 
  $query = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE filetype = 'pdf'"." AND idupl = '$s'"; 

  $db->query($query); 
  $db->next_record(); 

  $file = $db->f("filename"); 
$href =  $cfgClient[$client]["htmlpath"]["frontend"] . $cfgClient[$client]["upload"]. $db->f("dirname") . $db->f("filename"); 
        $description = strip_tags(urldecode($db->f("description"))); 
        $medianame = $db->f("name"); 

  echo "<tr><td colspan=\"2\" heigth=\"1\" ><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td></tr>"; 
  echo "<tr height=\"20\"> 
          <td style=\"padding-left:20px\" width=\"460\" class=\"text11bn\" width=\"\">Download <a class=\"main\" target=\"_blank\" href=\"$href\">$file</a><BR>$medianame<BR>$description</td> 
          <td align=\"center\" width=\"20\"><a target=\"_blank\" href=\"$href\"><img src=\"images/icons/diskette_out.gif\" border=\"0\" ></a></td> 
        </tr>"; 
  echo "<tr><td colspan=\"2\" heigth=\"1\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td></tr>"; 

} // end if 

if ("CMS_VALUE[4]" == "on") { 

  $s = "CMS_VALUE[6]"; 
  $query = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE filetype = 'pdf'"." AND idupl = '$s'"; 
  $db->query($query); 
  $db->next_record(); 

  $file = $db->f("filename"); 
$href =  $cfgClient[$client]["htmlpath"]["frontend"] . $cfgClient[$client]["upload"]. $db->f("dirname") . $db->f("filename"); 
        $description = strip_tags(urldecode($db->f("description"))); 

  echo "<tr height=\"20\"> 
          <td style=\"padding-left:20px\" width=\"460\" class=\"text11bn\" width=\"\"><a class=\"main\" target=\"_blank\" href=\"$href\">$file</a><BR>$description</td> 
          <td align=\"center\" width=\"20\" ><a target=\"_blank\" href=\"$href\"><img src=\"images/icons/diskette_out.gif\" border=\"0\" ></a></td> 
        </tr>"; 
  echo "<tr><td colspan=\"2\" heigth=\"1\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td></tr>"; 

} // end if 

if ("CMS_VALUE[7]" == "on") { 

  $s = "CMS_VALUE[9]"; 
  $query = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE filetype = 'pdf'"." AND idupl = '$s'"; 
  $db->query($query); 
  $db->next_record(); 

  $file = $db->f("filename"); 
  $href =  $cfgClient[$client]["htmlpath"]["frontend"] . $cfgClient[$client]["upload"]. $db->f("dirname") . $db->f("filename"); 
        $description = strip_tags(urldecode($db->f("description"))); 
         
  echo "<tr height=\"20\"> 
          <td style=\"padding-left:20px\" width=\"460\" class=\"text11bn\" width=\"\"><a class=\"main\" target=\"_blank\" href=\"$href\">$file</a><BR>$description</td> 
          <td align=\"center\" width=\"20\" ><a target=\"_blank\" href=\"$href\"><img src=\"images/icons/diskette_out.gif\" border=\"0\" ></a></td> 
        </tr>"; 
  echo "<tr><td colspan=\"2\" heigth=\"1\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td></tr>"; 

} // end if 

if ("CMS_VALUE[10]" == "on") { 

  $s = "CMS_VALUE[12]"; 
  $query = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE filetype = 'pdf'"." AND idupl = '$s'"; 
  $db->query($query); 
  $db->next_record(); 

  $file = $db->f("filename"); 
  $href =  $cfgClient[$client]["htmlpath"]["frontend"] . $cfgClient[$client]["upload"]. $db->f("dirname") . $db->f("filename"); 
        $description = strip_tags(urldecode($db->f("description"))); 
         
  echo "<tr height=\"20\"> 
          <td style=\"padding-left:20px\" width=\"460\" class=\"text11bn\" width=\"\"><a class=\"main\" target=\"_blank\" href=\"$href\">$file</a><BR>$description</td> 
          <td align=\"center\" width=\"20\" ><a target=\"_blank\" href=\"$href\"><img src=\"images/icons/diskette_out.gif\" border=\"0\" ></a></td> 
        </tr>"; 
  echo "<tr><td colspan=\"2\" heigth=\"1\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td></tr>"; 

} // end if 

if ("CMS_VALUE[13]" == "on") { 

  $s = "CMS_VALUE[15]"; 
  $query = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE filetype = 'pdf'"." AND idupl = '$s'"; 
  $db->query($query); 
  $db->next_record(); 

  $file = $db->f("filename"); 
$href =  $cfgClient[$client]["htmlpath"]["frontend"] . $cfgClient[$client]["upload"]. $db->f("dirname") . $db->f("filename"); 
        $description = strip_tags(urldecode($db->f("description"))); 
         
  echo "<tr height=\"20\"> 
          <td style=\"padding-left:20px\" width=\"460\" class=\"text11bn\" width=\"\"><a class=\"main\" target=\"_blank\" href=\"$href\">$file</a><BR>$description</td> 
          <td align=\"center\" width=\"20\" ><a target=\"_blank\" href=\"$href\"><img src=\"images/icons/diskette_out.gif\" border=\"0\"></a></td> 
        </tr>"; 
  echo "<tr><td colspan=\"2\" heigth=\"1\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td></tr>"; 

} // end if 

if ("CMS_VALUE[16]" == "on") { 

  $s = "CMS_VALUE[18]"; 
  $query = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE filetype = 'pdf'"." AND idupl = '$s'"; 
  $db->query($query); 
  $db->next_record(); 

  $file = $db->f("filename"); 
$href =  $cfgClient[$client]["htmlpath"]["frontend"] . $cfgClient[$client]["upload"]. $db->f("dirname") . $db->f("filename"); 
        $description = strip_tags(urldecode($db->f("description"))); 
         
  echo "<tr height=\"20\"> 
          <td style=\"padding-left:20px\" width=\"460\" class=\"text11bn\" width=\"\"><a class=\"main\" target=\"_blank\" href=\"$href\">$file</a><BR>$description</td> 
          <td align=\"center\" width=\"20\" ><a target=\"_blank\" href=\"$href\"><img src=\"images/icons/diskette_out.gif\" border=\"0\" ></a></td> 
        </tr>"; 
  echo "<tr><td colspan=\"2\" heigth=\"1\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td></tr>"; 

} // end if 


if ("CMS_VALUE[19]" == "on") { 

  $s = "CMS_VALUE[21]"; 
  $query = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE filetype = 'pdf'"." AND idupl = '$s'"; 
  $db->query($query); 
  $db->next_record(); 

  $file = $db->f("filename"); 
$href =  $cfgClient[$client]["htmlpath"]["frontend"] . $cfgClient[$client]["upload"]. $db->f("dirname") . $db->f("filename"); 
        $description = strip_tags(urldecode($db->f("description"))); 
         
  echo "<tr height=\"20\"> 
          <td style=\"padding-left:20px\" width=\"460\" class=\"text11bn\" width=\"\"><a class=\"main\" target=\"_blank\" href=\"$href\">$file</a><BR>$description</td> 
          <td align=\"center\" width=\"20\" ><a target=\"_blank\" href=\"$href\"><img src=\"images/icons/diskette_out.gif\" border=\"0\" ></a></td> 
        </tr>"; 
  echo "<tr><td colspan=\"2\" heigth=\"1\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td></tr>"; 

} // end if 

if ("CMS_VALUE[22]" == "on") { 

  $s = "CMS_VALUE[24]"; 
  $query = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE filetype = 'pdf'"." AND idupl = '$s'"; 
  $db->query($query); 
  $db->next_record(); 

  $file = $db->f("filename"); 
  $href =  $cfgClient[$client]["htmlpath"]["frontend"] . $cfgClient[$client]["upload"]. $db->f("dirname") . $db->f("filename"); 
        $description = strip_tags(urldecode($db->f("description"))); 
         
  echo "<tr height=\"20\"> 
          <td style=\"padding-left:20px\" width=\"460\" class=\"text11bn\" width=\"\"><a class=\"main\" target=\"_blank\" href=\"$href\">$file</a><BR>$description</td> 
          <td align=\"center\" width=\"20\" ><a target=\"_blank\" href=\"$href\"><img src=\"images/icons/diskette_out.gif\" border=\"0\" ></a></td> 
        </tr>"; 
  echo "<tr><td colspan=\"2\" heigth=\"1\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td></tr>"; 

} // end if 

if ("CMS_VALUE[25]" == "on") { 

  $s = "CMS_VALUE[27]"; 
  $query = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE filetype = 'pdf'"." AND idupl = '$s'"; 
  $db->query($query); 
  $db->next_record(); 

  $file = $db->f("filename"); 
  $href =  $cfgClient[$client]["htmlpath"]["frontend"] . $cfgClient[$client]["upload"]. $db->f("dirname") . $db->f("filename"); 
        $description = strip_tags(urldecode($db->f("description"))); 
         
  echo "<tr height=\"20\"> 
          <td style=\"padding-left:20px\" width=\"460\" class=\"text11bn\" width=\"\"><a class=\"main\" target=\"_blank\" href=\"$href\">$file</a><BR>$description</td> 
          <td align=\"center\" width=\"20\" ><a target=\"_blank\" href=\"$href\"><img src=\"images/icons/diskette_out.gif\" border=\"0\"></a></td> 
        </tr>"; 
  echo "<tr><td colspan=\"2\" heigth=\"1\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td></tr>"; 

} // end if 


echo "</table>"; 

?>
Besten Dank im voraus.

Gruß
Andreas
emergence
Beiträge: 10653
Registriert: Mo 28. Jul 2003, 12:49
Wohnort: Austria
Kontaktdaten:

Beitrag von emergence »

an sich sollte folgendes funktionieren 4.5.2alpha

output bereich:

am beginn nach <?php

Code: Alles auswählen

cInclude("classes", "class.properties.php");
$properties = new PropertyCollection;
ergänzen

und nach

Code: Alles auswählen

        $medianame = $db->f("name");
folgendes ergänzen

Code: Alles auswählen

$pathfile = $db->f("dirname") . $db->f("filename");

$keywords = $properties->getValue("upload", $pathfile, "file", "keywords");
$medianame = $properties->getValue("upload", $pathfile, "file", "medianame");
$medianotes = $properties->getValue("upload", $pathfile, "file", "medianotes");
$vprotected = $properties->getValue("upload", $pathfile, "file", "protected");
was du dann mit diesen variablen machst bleibt dir überlassen...
*** make your own tools (wishlist :: thx)
Andreas
Beiträge: 254
Registriert: So 16. Nov 2003, 14:48
Wohnort: Reichshof
Kontaktdaten:

Beitrag von Andreas »

Hallo Emergence,
vielen Dank!!!!

Klappt wunderbar!

Noch ein schönes Wochenende.
Gruß
Andreas
oma wetterwax
Beiträge: 97
Registriert: Do 6. Mai 2004, 07:38
Kontaktdaten:

Beitrag von oma wetterwax »

kreisch!!!
und ich hab vorgestern zwanzigmal die abfrage an die con_properties geschrieben ...

oma
mit dem brett vorm kopf
Gesperrt