SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Mar 2005
    Location
    Toronto
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    <? ?> delimiter without 'php'

    Hi, I am still new to php, today I've just set up everything manually for the first time, however, I have noticed that my php scripts only work if I include 'php' in my delimiter like this - <?php ?>, how should I go about changing it so that it would work without the 'php' being there, so that my code would work with just <? ?>. Thanks
    In search of the clouds...and maybe some work

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you need to edit php.ini(or use a .htaccess file) and enable short_open_tag

    but i would recomend you just use the full <?php instead.

    you will not always have access to enable this setting, and if you make your code require it, then you scripts are useless when the setting is not enabled.

    its not much extra effort to type <?php instead of just <? and it will improve portability of your scripts. your host could change the settings one day and all of a sudden your scripts start spilling all your source code to your visitors, which also can be a huge security risk in addition to just breaking your website.

  3. #3
    SitePoint Addict
    Join Date
    Jul 2005
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to change the Configuration Settings into your PHP.ini file.

    There is a line: short_open_tag: On

    you need to turn that Off. However, many people believe the write way to code is to leave the Smart Tags Off

  4. #4
    SitePoint Addict
    Join Date
    Mar 2005
    Location
    Toronto
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your fast reply, and thanks for the suggestion as well, I think I'll just leave it so that I'll type <?php every time. I've never thought about the compatibility issue, thanks again for the pointer
    In search of the clouds...and maybe some work


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •