Forum Moderators: coopster

Message Too Old, No Replies

Editing .htaccess: php code in .tpl file as text

php code in .tpl file being displayed as text

         

milan oberoy

8:38 pm on Jun 4, 2009 (gmt 0)

10+ Year Member



hello, i have uploaded a php script on server. Problem is i am seeing two percentage signs (%%) before and after a sentence. While looking for solution, I landed upon this thread....http://www.webmasterworld.com/forum88/11899.htm

What i understand (I am not sure whether i understood correct) from the thread is I will have to either rename all .tpl file to .tpl.php or edit .htaccess file to handle the file the way I want it to be handled. Renaming is out of the question as there are more than 1000 such files.

So, what lines i am suppose to add in htaccess file? where to find httpd.conf file?

details:
server: 2.2.11 (Unix)
PHP version: 5.2.9

thank you.

penders

2:33 pm on Jun 5, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Problem is i am seeing two percentage signs (%%) before and after a sentence.

This sounds like a different problem to the problem in your thread title: (?)

php code in .tpl file being displayed as text

The link you give partly relates the problem in your thread title, not necessarily to double percent signs. That link talks about securing template files so that PHP code remains hidden if the template engine is bypassed, ie. the template files are accessed directly by the browser. If the site is accessed in the way it is intended then this is should not a problem (depending on how the templates are loaded by your script). Are you having fundamental problems with your PHP script, or are you trying to improve the security of your site?

%% are more likely to delimit fields in your template. Your template engine (ie. php script) would need to parse your template and replace these. PHP code is more usually delimited by <?php ... ?> Is this what you are seeing output to the browser?

milan oberoy

6:24 am on Jun 6, 2009 (gmt 0)

10+ Year Member



@Penders: Thanks for the reply. My problem is two percent signs (%%) which are not suppose to exsist. I don't know what the problem is (I am not programing guy). What I mentioned (editing htaccess or code as text etc) was just my assumption while to trying to solve problem.

Even after installtion percent signs still can be seen in template (before and after each visible text).

What do you think it should be?

penders

9:52 am on Jun 6, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It does sound as if there is a problem with your PHP script, in that it doesn't appear to be processing your templates correctly.

What does your PHP script expect the template variables to be delimited by? ie. %%VARIABLE%% (two percent signs)? This might be customisable in the script. What does your template source file look like at the point you are seeing "%%" in the output - perhaps you could post this?

Are other template variables being parsed/replaced OK? What is different about this one?

Presumably you don't get any errors output?

Unfortunately, without delving through the code and getting some idea of what's going on the problem could be anything!? Unless, by chance, someone reading this has used the same script and experienced the same problem...?