Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3593822
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:37:44+00:00 2026-05-18T19:37:44+00:00

So: I quite like using Haml in ruby projects, and was testing it out

  • 0

So:

I quite like using Haml in ruby projects, and was testing it out in PHP. I’ve been trying PhamlP because it looks like it’s not dead, whereas phpHaml and pHaml haven’t been updated in nearly 4 years.

Now, the problem I have is the php code that PhamlP is parsing is showing up as comments in HTML instead of executing. Here’s the test file, index.php:

include_once('haml/HamlParser.php');
$haml = new HamlParser(array('ugly'=>'false'));
$page = $haml->parse('test.haml');
echo $page;

Here’s the test.haml file:

!!!
- $foo = 'bar'
%h1 Foo this
.test= $foo

and here’s the output I get in the browser when I view source:

<?php
require_once '/Users/Andrew/Sites/eighty-b/_app/haml/HamlHelpers.php';
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php $foo = 'bar'; ?><h1>Foo this</h1><div class="bar">This better fooacross multiple lines butstill in the bar div!</div><div class="test"><?php echo $foo; ?></div>

So, for instance, the line - $foo = 'bar' isn’t being executed, it’s somehow passing through to the browser as a comment.

How the heck do you fix that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T19:37:45+00:00Added an answer on May 18, 2026 at 7:37 pm

    Don’t know it, but the obvious workaround would be to replace the echo $page with:

     eval("?".">".$page);    // oh nooooes, eval is evil!!!!!
    

    I’d assume ->parse does just a conversion, and the output is supposed to be stored in a new .php output/template/cache file usually.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've recently been trying out Ankhsvn and I quite like it, and more importantly,
I have been using git a lot recently and I quite like the concept
I quite like Rails' database migration management system. It is not 100% perfect, but
It's quite possible a question like this has been asked before, but I can't
I have quite a few RewriteRules in my .htaccess that looks like this RewriteRule
My site has quite a deep navigation structure and quite often it looks like
Watching SO come online has been quite an education for me. I'd like to
I am trying the db4o object databse and so far I quite like what
I've recently started working with RoR for some projects and I quite like the
I've been trying to find an easy way to write XML using the XmlReader/XmlWriter.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.