Help preserving sentence structure

From: Date: Fri, 26 Feb 2010 20:11:01 +0000
Subject: Help preserving sentence structure
Groups: php.general 
Request: Send a blank email to php-general+get-302408@lists.php.net to get a copy of this message
Hi, new to this list... I'm adapting some code that generates text and want to keep the syntax. In the original version the output was iterated from an array in <pre> tags. That was fine for what it was, but it's now a word press plugin and the <pre> tags get in the way. How do I keep the sentence structure without using <pre>s? Also, I'm quite new to PHP in general... :) Any help would be much appreciated! Below is an extract of the code with some highlighting for emphasis: function wpm_display_generator() { if (isset($_POST['submit_button'])) { // the form was submitted to this script - generate // and display require_once 'lib/generator.php'; require_once "lib/util.php"; require_once "lib/vocabulary.php"; require_once "lib/widgets.php"; $vocab = Vocabulary::getInstance(); $cats = $vocab->getCategories(); $catName = ''; $sentence = ''; if (isset($_POST['category_choice'])) { $catName = $cats[$_POST['category_choice']]; $gen = new wordGenerator($_POST['category_choice'], $_POST['length_choice']); $lines = $gen->generate(); foreach ($lines as $line) { $sentence .= "<pre>" . $line . "</pre>"; } } require 'sentence.php'; } else { require 'generator_form.php'; } } Many thanks, John -- Out now: Kvist 002 - Raglani - Web of Light - 12" Kvist 003 - EOD - untitled - 12" Kvist 004 - JD Emmanuel - Solid Dawn - CD Kvist 005 - Guillaume Gargaud - Here - CD Coming soon: Kvist 006 - Tom Hamilton - Pieces for Kohn/Formal & Informal Music - CD www.kvistrecords.com

« previous php.general (#302408) next »