Web Analytics Made Easy -
StatCounter Custom php file extensions - CodingForum

Announcement

Collapse
No announcement yet.

Custom php file extensions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom php file extensions

    This thread probably needs to go in the server config section but since it has to do with php i thought i would put it here.

    So i have decided to try some custom file extensions to run as php files. I figured what better way to get back up to speed again on the topic (its been a long time) than to do this in my documentation section. Its a safe environment to get things dialed in correctly.

    Now the first step i suppose is to make sure that the server has the [mime module] enabled. And if i remember correctly then its just a matter of some htaccess commands.

    So for this section of the documentation i was considering the extension of wdp
    w for the first letter of the software
    d for documentation
    p for php file

    likewise a html file would be wdh

    im thinking there has to be a downside to this but since these files will only be on my server and never on the users server, there is no issue with the [mime module] being disabled.

    Are there any other downsides to this practice, other than remembering the file meanings?


    If a php file only has php code within it you do not need to use the closing php tag
    A good way to remember objects from arrays is you shoot objects with arrows Example: $name->id; then Arrays are $name['id'];
    durangod is short for durango dave

  • #2
    My question would be why? What is going to be better by doing that?
    Dave .... HostMonster for all of your hosting needs

    Comment


    • #3
      Pointless.
      To save time, lets just assume I am almost never wrong.

      The XY Problem
      The XY problem is asking about your attempted solution (X) rather than your actual problem (Y). This leads to enormous amounts of wasted time and energy, both on the part of people asking for help, and on the part of those providing help.

      Make A Donation https://www.paypal.me/KevinRubio

      Comment


      • #4
        I agree its not going to improve anything, and yes the downside is that it is pointless. However, if i ever see a site that does do this, i will just know that the only downside is that its pointless lol

        If a php file only has php code within it you do not need to use the closing php tag
        A good way to remember objects from arrays is you shoot objects with arrows Example: $name->id; then Arrays are $name['id'];
        durangod is short for durango dave

        Comment


        • #5
          I like the idea; adds a little variety to the internet. I can’t say much about technical benefits or downsides but I will say that it’s just as “pointless” as removing the file extensions completely, as is common practice with URL rewriting.
          Stop solving problems you don’t yet have!

          Comment


          • #6
            There are however upsides, if they are important to someone. If someone or something is browsing for php files they wont find them. And i guess if they want to run the file they wont know what type of file it is unless they can see its contents.
            If a php file only has php code within it you do not need to use the closing php tag
            A good way to remember objects from arrays is you shoot objects with arrows Example: $name->id; then Arrays are $name['id'];
            durangod is short for durango dave

            Comment


            • #7
              Originally posted by VIPStephan View Post
              I will say that it’s just as “pointless” as removing the file extensions completely, as is common practice with URL rewriting.
              Stephen, Stephen, Stephen,

              Clean URLs also do not contain implementation details of the underlying web application. This carries the benefit of reducing the difficulty of changing the implementation of the resource at a later date. For example, many URLs include the filename of a server-side script, such as example.php, example.asp or cgi-bin. If the underlying implementation of a resource is changed, such URLs would need to change along with it. Likewise, when URLs are not "clean", if the site database is moved or restructured it has the potential to cause broken links, both internally and from external sites, the latter of which can lead to removal from search engine listings. The use of clean URLs presents a consistent location for resources to user-agents regardless of internal structure. A further potential benefit to the use of clean URLs is that the concealment of internal server or application information can improve the security of a system.
              On the technical side, without URL Rewriting you are locked in to an exact physical mapping and naming of your files. With URL Rewriting and routing, your files, extensions and their physical location can be anywhere or anything.
              Last edited by benanamen; Jul 1, 2020, 01:13 PM.
              To save time, lets just assume I am almost never wrong.

              The XY Problem
              The XY problem is asking about your attempted solution (X) rather than your actual problem (Y). This leads to enormous amounts of wasted time and energy, both on the part of people asking for help, and on the part of those providing help.

              Make A Donation https://www.paypal.me/KevinRubio

              Comment


              • #8
                I put “pointless” in quotation marks because I meant it ironically, i. e. changing the file extension to any custom string is the same as removing it completely. You could change the underlying implementation from PHP to ASPX and still rewrite the file extensions to whatever you like.
                Stop solving problems you don’t yet have!

                Comment


                • #9
                  Originally posted by VIPStephan View Post
                  I put “pointless” in quotation marks because I meant it ironically
                  Lol, Ok
                  To save time, lets just assume I am almost never wrong.

                  The XY Problem
                  The XY problem is asking about your attempted solution (X) rather than your actual problem (Y). This leads to enormous amounts of wasted time and energy, both on the part of people asking for help, and on the part of those providing help.

                  Make A Donation https://www.paypal.me/KevinRubio

                  Comment


                  • #10
                    If they're PHP, call them .php. Otherwise you're just going to confuse other people who come along. ESPECIALLY if you start screwing around with this single letter nonsense instead of just using the flipping word.

                    That's why I use "extended extensions", aka using more than one period in a filename as the sub-type delimiter.

                    If it's a library file:
                    /libs/common.lib.php

                    if it's a template file:

                    /template/default/common.template.php

                    If it's the stylesheet put the media target in the filename

                    /template/default/common.screen.css
                    /template/default/common.print.css

                    if it's part of my documentation:
                    /docs/something.docs.php

                    That way you don't need to mess with the OS or apache handling, and it's clear as day exactly what the file is to EVERYONE, something short cryptic "pull some letters out your backside" isn't going to provide.
                    I'll kill you and your dreams tonight, begin new life.
                    Bleed your death upon me, let your bloodline feed my youth.
                    https://cutcodedown.com

                    Comment


                    • #11
                      thanks, yeah the more i looked at the idea the more it seemed it had too many dependencies so i backed off.
                      If a php file only has php code within it you do not need to use the closing php tag
                      A good way to remember objects from arrays is you shoot objects with arrows Example: $name->id; then Arrays are $name['id'];
                      durangod is short for durango dave

                      Comment

                      Working...
                      X