Help preserving sentence structure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux