Generator garbles PHP code #424

Closed
KAnoshkin opened this Issue Oct 23, 2011 · 5 comments

Projects

None yet

6 participants

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 blocks as is?

Thanks in advance.

Contributor

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.

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.

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");
?>

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 Mar 19, 2013

You could try this:
{% raw %}<?php echo("untoutched"); ?>{% endraw %}

@jekyllbot jekyllbot locked and limited conversation to collaborators Feb 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.