Jump to content

Php automaticaly commented


ElFranchoute
 Share

Recommended Posts

Good morning,

I'm working about a website made with Processwire, I don't know a lot about this CMS 'cause it's the first time I'm working with it.

We have to change this website and when we try to use php in some template files (.php), it autocomment itself.

Anyone has a solution about this, please?

Thanks,

Have a nice day O0

Link to comment
Share on other sites

That's not a ProcessWire error. Maybe your hoser doesn't allow PHP or some kind of safe mode enabled?

Have a look at this: http://stackoverflow.com/questions/9368841/php-code-gets-turned-into-html-comments

Could you maybe post a bit more of your code?

Edit: This link looks better: http://stackoverflow.com/questions/12828163/why-are-my-php-tags-converted-to-html-comments

Edited by Nico Knoll
Link to comment
Share on other sites

In the same server we have a simple file (.php) and he works fine.

I'm making a form to upload file, this is my code:

<form class='forum-form' accept-charset="utf-8" action='./formrms' method='post' enctype='multipart/form-data' >
            <input type='file' id='attach' name='attach_file' multiple='multiple' accept='image/jpg,image/jpeg,image/gif,image/png' /> <!-- this is the input tag for the image attachment -->
            <input type='submit' name='add_file' value='Add file'/> <!--this is the submit to upload image attachment before submitting entire form -->
            <input type='submit' name='form_submit' value='Submit'/> <!-- this is the submit to send entire data -->
</form>
<?php
        if ($this->input->post->add_file){
            $this->uploadImage();
                $attached_file = $this->session->attach_markup;
        }
        ?>

And this is the result:

https://dl.dropboxusercontent.com/u/80634129/error.png
 

You're not putting it in the Body field in the admin are you? Because your PHP should be in the /site/templates/yourtemplate.php file.

I'm here "/site/templates/formrms.php", then I'm not in the admin templates.

  • Like 1
Link to comment
Share on other sites

Your PHP code isn't interpreted as PHP, but sent directly to browser. If another PHP file works fine, this does indeed sound strange.

Just to make sure, is this a Linux host, is the web server Apache and have you had any issues with .htaccess (or mod_rewrite) before on this server? What about PHP version, could you check that too, just to make sure that it meets the requirements?

Also: are you aware of anything else that could be somehow off with this host, i.e. safe mode turned on, suPHP in use or any other "non-typical" detail?

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...