topical media & game development

talk show tell print

lib-jquery-learning-code-06-f.php / php



  <?php
  
  entries = array(
    'FAITH' => array(
      'part' => 'n.',
      'definition' => 'Belief without evidence in what is told by one who speaks without knowledge, of things without parallel.',
    ),
    'FAMOUS' => array(
      'part' => 'adj.',
      'definition' => 'Conspicuously miserable.',
      'quote' => array(
        'Done to a turn on the iron, behold',
        'Him who to be famous aspired.',
        'Content?  Well, his grill has a plating of gold,',
        'And his twistings are greatly admired.',
      ),
      'author' => 'Hassan Brubuddy',
    ),
    'FELON' => array(
      'part' => 'n.',
      'definition' => 'A person of greater enterprise than discretion, who in embracing an opportunity has formed an unfortunate attachment.',
    ),
    'FIDDLE' => array(
      'part' => 'n.',
      'definition' => 'An instrument to tickle human ears by friction of a horse\'s tail on the entrails of a cat.',
      'quote' => array(
        'To Rome said Nero:  "If to smoke you turn',
        'I shall not cease to fiddle while you burn."',
        'To Nero Rome replied:  "Pray do your worst,',
        '\'Tis my excuse that you were fiddling first."',
      ),
      'author' => 'Orm Pludge',
    ),
    'FIDELITY' => array(
      'part' => 'n.',
      'definition' => 'A virtue peculiar to those who are about to be betrayed.',
    ),
    'FLOP' => array(
      'part' => 'v.',
      'definition' => 'Suddenly to change one\'s opinions and go over to another party.  The most notable flop on record was that of Saul of Tarsus, who has been severely criticised as a turn-coat by some of our partisan journals.',
    ),
    'FORCE' => array(
      'part' => 'n.',
      'definition' => '',
      'quote' => array(
        '"Force is but might," the teacher said &mdash;',
        '"That definition\'s just."',
        'The boy said naught but thought instead,',
        'Remembering his pounded head:',
        '"Force is not might but must!"',
      ),
    ),
    'FORGETFULNESS' => array(
      'part' => 'n.',
      'definition' => 'A gift of God bestowed upon doctors in compensation for their destitution of conscience.',
    ),
    'FRIENDLESS' => array(
      'part' => 'adj.',
      'definition' => 'Having no favors to bestow.  Destitute of fortune. Addicted to utterance of truth and common sense.',
    ),
    'FRIENDSHIP' => array(
      'part' => 'n.',
      'definition' => 'A ship big enough to carry two in fair weather, but only one in foul.',
      'quote' => array(
        'The sea was calm and the sky was blue;',
        'Merrily, merrily sailed we two.',
        '(High barometer maketh glad.)',
        'On the tipsy ship, with a dreadful shout,',
        'The tempest descended and we fell out.',
        '(O the walking is nasty bad!)',
      ),
      'author' => 'Armit Huff Bettle',
    ),
    'FUTURE' => array(
      'part' => 'n.',
      'definition' => 'That period of time in which our affairs prosper, our friends are true and our happiness is assured.',
    ),
  );
  
  foreach (entries as term => entry) {
    if (strpos(term, strtoupper(_REQUEST['term']))
        !== FALSE) {
      html = '<div class="entry">';
  
      html .= '<h3 class="term">';
      html .= term;
      html .= '</h3>';
  
      html .= '<div class="part">';
      html .= entry['part'];
      html .= '</div>';
  
      html .= '<div class="definition">';
      html .= entry['definition'];
      if (isset(entry['quote'])) {
        foreach (entry['quote'] as line) {
          html .= '<div class="quote-line">'. line .'</div>';
        }
        if (isset(entry['author'])) {
          html .= '<div class="quote-author">'.
            entry['author'] .'</div>';
        }      
      }
      html .= '</div>';
    
      html .= '</div>';
    
      print(html);
    }
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.