ASP-Style Tags

software development

#1

I have a whole site I built from scratch that liberally uses ASP-style tags for php, e.g. <% and %>

This option can be enabled in php.ini, I’m pretty sure, without breaking anything. However, I have looked up, and it should be possible to (in an .htaccess file):

php_flag asp_tags On

But that doesn’t seem to fly on DH for some reason, can anyone help?


#2

That will work, but you can only use PHP options in .htaccess if PHP is running as an Apache module. The default is CGI.


If you want useful replies, ask smart questions.


#3

Good info to know!

Is there any way to accomplish this when run as CGI?

Jon


#4

W/out installing your own copy of PHP; No.


#5

Nothing as convenient, no, but you might find ini_set() to be useful. You could put this in your global header or library but, of course, you’d have to use regular PHP tags at the top of your file, up to the point where you call this function to make the change.

It would probably be easier to just change your tag style to the standard <?php ... ?>


If you want useful replies, ask smart questions.


#6

Don’t know if you know (I didn’t but found it useful) you can use <?=$user_name?> just like ASPs <%=user_name%> to print out variables. Very useful when just printing a few variables in a large part of HTML.