• Resolved rosmith

    (@rosmith)


    Using a PHP command, I am including on a WordPress page HTML documents which are generated by a software program. These documents contain PRE tags which work fine except when there are spaces at the beginning of a line. When a line starts with spaces, WordPress ignores the spaces. Since the documents I am trying to include contain rows of statisitics in columns, this throws off the columns. Is there someway to get WordPress to recognize the leading spaces on each line? Perhaps something I can add to the CSS? Maybe a plugin which makes WordPress behave? Any thoughts would be appreciated.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You view these documents directly from your browser and the leading spaces are there? That would be rather unusual… unless there’s a style sheet involved.

    Do the web pages you’re working with include their own CSS?
    Is it accessible?

    Thread Starter rosmith

    (@rosmith)

    Thanks for your post. Yes, if I look at these documents directly in a browser, the leading spaces are there.

    There is no CSS called by the documents I am trying to include. The only stylesheet utilized is the one connected to WordPress.

    This appears, judging from a number of other posts, to be a problem encountered by others. It is an important issue for me because I literally have hundreds of these documents to include, and they are updated with new statistics on a regular basis.

    Thanks for any help you can give.

    Suppose you turn off the WYSIWYG (rte) editor and use the “less fancy but helluva lot more useful editor” (imho) instead?

    If I had to guess, I’d say the wysiwyg editor is eating the PRE tags.

    As a test:
    You can turn it off by logging on as yourself, clicking Users and scrolling down to the Personal Options section and unchecking “Use the visual rich editor when writing” and then click “Update Profile” button.

    As the above poster said, go into your user profile and turn off the fancy editor (option at the bottom of the profile, it’s a checkbox).

    Thread Starter rosmith

    (@rosmith)

    I appreciate the help HandySolo and Wyrd33, unfortunately, the visual rich editor box was already unchecked because I tried this earlier. Any other thoughts?

    Thanks for the help!

    Man… ok. Experiment with this plugin? http://priyadi.net/archives/2005/09/27/wordpress-plugin-code-autoescape/

    By design, it doesn’t do exactly what you’re after, BUT… it may get you close enough to make up the differences in CSS.

    Why yes, I AM grasping at straws.

    Thread Starter rosmith

    (@rosmith)

    Thanks for the help HandySolo!

    Here is where I am. I downloaded and installed and activated the plugin you suggested might be helpful. I wrote preformatted text directly into the “Page Content” box on a “Write Page” page on WordPress. That text was contained within a “pre” and “code” tags. This worked. Leading spaces were recognized and rendered.

    However, when I put the same code in an HTML document and call that document for inclusion using a PHP code the leading spaces were not recognized and, therefore, not rendered.

    Now, here is a thought.

    Currently, I utilize a plugin (Exec-PHP) to allow PHP commands from within a post.

    I then utilize the following code (sufficiently modified so as not to execute a code in this post – at least I hope so) to include the content of an html file on a WordPress Page:
    “? php require (“http://locationoffile.html”); ?”
    This code is contained with “phpcode” tags.

    By previous experimentation, I learned that if I replace in the html file, the first leading space in any line with “&nbsp” all spaces which follow the leading space are rendered.

    So, here is what I am wondering. Is there a way through 1) modifying Exec-PHP, modifying the php command, using an additional php command, or even creating another plugin, to replace all occurrences of a ‘linebreak followed by a leading space’ with a ‘linebreak followed by “&nbsp”‘.

    I’m afraid I don’t have the knowledge to know how to make that happen, but I think that would do the trick.

    To see the results of what I have describe, please visit my test page at: http://cgi2.westmont.edu/blogs/athletics/mens-basketball/pre-test/

    Again, any help you can offer would be greatly appreciated.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Trouble using the HTML PRE tag’ is closed to new replies.