PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Please help with preformatted text issue...

  1. RichardBest
    Member

    Hi Carl, Alex, Kevin

    As you probably know, I'm using the GF hooks to get content into posts depending on answers to various questions in forms. Right now I've come against a wall. I'm trying to include the following kind of code in my functions.php file:

    $post_data["post_content"] .= "<p><a rel='license' href='http://creativecommons.org/licenses/by/3.0/nz/'><img alt='Creative Commons License' style="border-width:0" src='http://i.creativecommons.org/l/by/3.0/nz/88x31.png' /></a><br /><span xmlns:dc='http://purl.org/dc/elements/1.1/' href='http://purl.org/dc/dcmitype/MovingImage' property='dc:title' rel='dc:type'>[Title of work]</span> by <a xmlns:cc='http://creativecommons.org/ns#' href='[Attribute work to URL]' property='cc:attributionName' rel='cc:attributionURL'>[Attribute work to name]</a> is licensed under a <a rel='license' href='http://creativecommons.org/licenses/by/3.0/nz/'>Creative Commons Attribution 3.0 New Zealand License</a>.<br />Based on a work at <a xmlns:dc='http://purl.org/dc/elements/1.1/' href='[Source work URL]' rel='dc:source'>[Source work URL]</a>.<br />Permissions beyond the scope of this license may be available at <a xmlns:cc='http://creativecommons.org/ns#' href='[More permissions URL]' rel='cc:morePermissions'>[More permissions URL]</a>.</p>";

    Unfortunately, this won't parse properly. I get the good old "unexpected T_STRING" error message. Do you know how I can include pre-formatted text/code like this please? I've tried using code tags but that doesn't work either. I'm sure everything else is fine as I've done a test with the word 'test' between the p tags and that works fine.

    I'm really hoping we can crack this one please.

    Many thanks
    Richard

    Posted 14 years ago on Monday June 28, 2010 | Permalink
  2. RichardBest
    Member

    Apologies for bothering you guys with this. After an hour of digging, I think I've figured out that (a) there was one instance in the above code of double quotes, which was causing the parse error, and (b) I can get the code into my post, unformatted, if I use the excellent WP Post Encode plugin (at http://darrinb.com/notes/2010/wp-post-encode/). The plugin seems to be WP3.0 compatible. A few tweaks to the CSS and, fingers crossed, that wall I mentioned above is all gone.

    Posted 14 years ago on Monday June 28, 2010 | Permalink
  3. style="border-width:0"

    Good catch. Very neat thing you're doing here. I like it.

    Posted 14 years ago on Monday June 28, 2010 | Permalink

This topic has been resolved and has been closed to new replies.