[pmwiki-devel] php arrays

dso dso at moosoft.com
Tue Dec 26 16:18:22 CST 2006


I have a recipe I am working on but my PHP isn't so good.

  $width = $vars["width"];
  $height = $vars["height"];

  $url   = $ScriptUrl . "/" . $pagename;

  $links[0] = "<input name='langpair' value='en|fr'
title='Fran&#231;ais/French' src='france.jpg' height='10' type='image'
width='15'>";
  $links[1] = "<input name='langpair' value='en|de'
title='Deutsch/German' src='germany.jpg' height='10' type='image'
width='15'>";
  $links[2] = "<input name='langpair' value='en|it'
title='Italiano/Italian' src='italy.jpg' height='10' type='image'
width='15'>";
  $links[3] = "<input name='langpair' value='en|pt'
title='Portugu&#234;s/Portuguese' src='portugal.jpg' height='10'
type='image' width='15'>";
  $links[4] = "<input name='langpair' value='en|es'
title='Espa&#241;ol/Spanish' src='spain.jpg' height='10' type='image'
width='15'>";
  $links[5] = "<input name='langpair' value='en|ja'
title='&#26085;&#26412;&#35486;/Japanese' src='japan.jpg' height='10'
type='image' width='15'>";
  $links[6] = "<input name='langpair' value='en|ko'
title='&#54620;&#44397;&#50612;/Korean' src='korea.jpg' height='10'
type='image' width='15'>";
  $links[7] = "<input name='langpair' value='en|zh-CN'
title='&#20013;&#25991;&#65288;&#31616;&#20307;&#65289;/Chinese
Simplified' src='china.jpg' height='10' type='image' width='15'>";
  $links[8] = "<input name='langpair' value='en|ar'
title='&#1593;&#1585;&#1576;&#1610;/Arabic' src='sa.jpg' height='10'
type='image' width='15'>";

  $r = "\n<form action='http://www.google.com/translate'
target='_blank'>\n";
  $r .= "<input name='u' value='$url' type='hidden' />\n";
  $r .= "<input name='hl' value='en' type='hidden'>\n";
  $r .= "<input name='ie' value='UTF8' type='hidden'>\n";
  $r .= "<table width='100pct' cellpadding='1' cellspacing='0'>\n";

  //loop to create table here

  $r .= "</table>\n";
  $r .= "</form>\n";


How do you create a loop such that the array of links can be output in
an arbitrary fashion based on the width and height given?  Thanks!

Daniel



More information about the pmwiki-devel mailing list