Seite 1 von 1

Problem mit Mini Modul

Verfasst: Fr 27. Feb 2009, 16:28
von birke
Hallo,

ich habe ein kleines Modul, das eine Headline, ein Bild, einen Text und darunter drei Links ausgeben soll. Leider ist es so, dass ich die Links nicht editieren kann. Habe seit ca. 8 Jahren kein PHP mehr verwendet und stehe etwas auf dem Schlauch. :oops:

Woran kann das nur liegen?

Grüße, Birke

Auszug, der Probleme macht

Code: Alles auswählen

if( "CMS_LINK[13]" != "http://" || "" ) {

  echo "<div class=\"Box_1SP\" style=\"clear:left; float:left;\">";
  echo '<a href="CMS_LINK[13]" target="CMS_LINKTARGET[13]" class="LinkListe">';
  echo "&rarr; "."CMS_LINKTITLE[13]";
  echo '</a>'; 
  echo "CMS_LINKEDIT[13]";
  echo "</div>";
}

GesamtModul

Code: Alles auswählen

<?php

echo "<div class=\"Box_1SP\">";

  echo "<img src=\"upload/system/pfeil_01.png\" alt=\"\" class=\"TeaserPfeil\" />";
  echo "<div class=\"TeaserBoxHead\">"."CMS_HTML[5]"."</div>";
    
  if ("CMS_IMG[5]" != "") {echo '<div class="TeaserBild"><img src="CMS_IMG[5]" alt="" /></div>';}
  if ($edit) {echo "CMS_IMGDESCR[5]";}
    
  echo "<div class=\"TeaserBoxText\">"."CMS_HTML[51]"."</div>";
    

if( "CMS_LINK[11]" != "http://" || "" ) {

  echo "<div class=\"Box_1SP\" style=\"clear:left; float:left; margin-top:20px; z-index:3;\">";
  echo '<a href="CMS_LINK[11]" target="CMS_LINKTARGET[11]" class="LinkListe">';
  echo "&rarr; "."CMS_LINKTITLE[11]";
  echo '</a>'; 
  echo "CMS_LINKEDIT[11]";
  echo "</div>";
}

if( "CMS_LINK[12]" != "http://" || "" ) {

  echo "<div class=\"Box_1SP\" style=\"clear:left; float:left;\">";
  echo '<a href="CMS_LINK[12]" target="CMS_LINKTARGET[12]" class="LinkListe">';
  echo "&rarr; "."CMS_LINKTITLE[12]";
  echo '</a>'; 
  echo "CMS_LINKEDIT[12]";
  echo "</div>";
}

if( "CMS_LINK[13]" != "http://" || "" ) {

  echo "<div class=\"Box_1SP\" style=\"clear:left; float:left;\">";
  echo '<a href="CMS_LINK[13]" target="CMS_LINKTARGET[13]" class="LinkListe">';
  echo "&rarr; "."CMS_LINKTITLE[13]";
  echo '</a>'; 
  echo "CMS_LINKEDIT[13]";
  echo "</div>";
}

echo "</div>";

?>

Re: Problem mit Mini Modul

Verfasst: Do 5. Mär 2009, 10:36
von emergence
seitens logik würde ich das

Code: Alles auswählen

  echo "CMS_LINKEDIT[13]"; 
ausserhalb der if schleife setzen...

Re: Problem mit Mini Modul

Verfasst: Di 19. Mai 2009, 21:31
von beachcoder
Hallo,

das du PHP nicht wirklich beherrschst merkt man an der Bedingung

Code: Alles auswählen

if( "CMS_LINK[11]" != "http://" || "" )
ist ja auch nicht böse gemeint, was du sicherlich meinstest ist

Code: Alles auswählen

if( "CMS_LINK[11]" != "http://" && "CMS_LINK[11]" != "" )
aber besonders gut programmiert ist das auch nicht. Versuche es lieber so (auch wenn das an Perfektion noch lange keine Glanzleistung ist - warscheinlich funzt es nichtmal, weil ich in Contendio selbst der totale Newbie bin...)

Code: Alles auswählen

$link[0] =  "CMS_LINK[11]";
$target[0] =  "CMS_LINKTARGET[11]";
$title[0] =  "CMS_LINKTITLE[11]";

$link[1] =  "CMS_LINK[12]";
$target[1] =  "CMS_LINKTARGET[12]";
$title[1] =  "CMS_LINKTITLE[12]";

$link[2] =  "CMS_LINK[13]";
$target[2] =  "CMS_LINKTARGET[13]";
$title[2] =  "CMS_LINKTITLE[13]";

for( $i = 0; $i < array_count( $link ); $i++ )
{
    if( !empty( $link[$i] ) ) 
    {
      echo "<div class=\"Box_1SP\" style=\"clear:left; float:left;\">";
      echo '<a href="$link[$i]" target="$target[$i]" class="LinkListe">';
      echo "&rarr; "."$title[$i]";
      echo '</a>';
      echo "</div>";
    }
}

lg
beachcoder