Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Generator garbles PHP code #424

Closed
KAnoshkin opened this Issue · 4 comments

4 participants

@KAnoshkin

Sorry if I'm missing something obvious.

I need to have a contact form on my Octopress site, so I made a php page (with file name extension "php"). All is well except the php code in the generated php file is heavily escaped. Can I somehow configure Jekyll to leave <?php ... ?> blocks as is?

Thanks in advance.

@joshbrown

Have you tried using this at the top of your php file?

---
layout: nil
---

<?php...

Update
I tried it and it leaves the PHP code untouched.

@KAnoshkin

Maybe, my setup is wrong, but setting layout to nil only disables templates. I'd like to use a page template, though.

On second thought, it looks like a parser error. Consider the example:

$to = "\"Support Staff\" <support@example.com>";

The line gets escaped like this:

$to = "\"Support Staff\" <support@example.com>&#8221;;

The error makes the parser go crazy and it escapes the quote marks "inside out". However, if I omit the angle brackets, everything is fine:

$to = "\"Support Staff\" support@example.com";

Note that this is actual PHP code supposed to get executed and not just a code quote.

@KAnoshkin

This is by no means a fix, but I ended up working around the issue with the following code:

<?php
include("/path/outside/public/directory/script.php");
?>
@jeremyroman

I'm not seeing this issue. I can process the line you provided, and it goes through without any apparent escaping. Can you still reproduce it?

@parkr parkr closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.