Jump to content

Recommended Posts

If I normalically open a php file without extension,  not highlighted the syntax, autocomplete is not activated, etc.

If instead I try to open it with PHP Editor

https://pasteboard.co/Tak4RjzSpn7V.png

this appears to me

https://pasteboard.co/n57YsohIxuqy.png

Why?

Edited by rick645
Link to comment
https://forums.phpfreaks.com/topic/317105-eclipse-open-php-file-without-extension/
Share on other sites

Without a file extension, your system has to guess what type of file it is based on the data. Apparently, it guessed "map-path". And your PHP Editor doesn't know what to do with "map-path" files.

Give your PHP files the .php extension. It's what you're supposed to do.

19 hours ago, requinix said:

You're saying that you don't believe programmers should be using file extensions?

Programmers yes.
End users don't: they should have as simple an interface as possible, which hides unnecessary details.

16 hours ago, Strider64 said:

They don't have to if you design and develop the website correct.

websiite?

 

 

 

 

 

 

 

 

Strider is probably on the right subject.

URLs don't have to match files. You can have a file named "whatever.php" and show it in a URL as "whatever" - or anything else you want.
So keep the file extension, and if you want your URLs to look a certain way then make the URLs look the certain way.

Making a file without an extension work with any sort of serverside language, requires configuration to associate those files with the serverside language.  The same sort of association can be made in an editor, but as previously commented, using the rewrite capability in apache mod_rewrite or nginx is the best practice. 

17 hours ago, requinix said:

Strider is probably on the right subject.

URLs don't have to match files. You can have a file named "whatever.php" and show it in a URL as "whatever" - or anything else you want.
So keep the file extension, and if you want your URLs to look a certain way then make the URLs look the certain way.

...

16 hours ago, gizmola said:

Making a file without an extension work with any sort of serverside language, requires configuration to associate those files with the serverside language.  The same sort of association can be made in an editor, but as previously commented, using the rewrite capability in apache mod_rewrite or nginx is the best practice. 

...

You are taking for granted that he is writing a web app.
I thought you knew that, with php, can be write both web apps and cli apps :(

1 hour ago, rick645 said:

You are taking for granted that he is writing a web app.

Taking for granted who is writing a web app? Is it someone other than the person who started this thread?

 

1 hour ago, rick645 said:

I thought you knew that, with php, can be write both web apps and cli apps :(

What? Really? PHP can do other things than serve websites? I had no idea!

🙄

So if this isn't for a website then would you kindly explain what this is all about?

tmp.FdTgUEMZjh$ cat rsync-map-path
#!/bin/bash
rsync -n "$1" "$(./map-path "$1")"

tmp.FdTgUEMZjh$ cat map-path
#!/usr/bin/php
<?php
$paths = [
    'bin' => "remote:/bin",
    'lib' => "remote:/lib",
    'config' => "remote:/etc",
    'config2' => "remote:/config",
    //...
];
echo $paths[$argv[1]];

tmp.FdTgUEMZjh$ ./rsync-map-path lib
RSYNC OUTPUT...

 

35 minutes ago, rick645 said:
tmp.FdTgUEMZjh$ cat rsync-map-path
#!/bin/bash
rsync -n "$1" "$(./map-path "$1")"

tmp.FdTgUEMZjh$ cat map-path
#!/usr/bin/php
<?php
$paths = [
    'bin' => "remote:/bin",
    'lib' => "remote:/lib",
    'config' => "remote:/etc",
    'config2' => "remote:/config",
    //...
];
echo $paths[$argv[1]];

tmp.FdTgUEMZjh$ ./rsync-map-path lib
RSYNC OUTPUT...

 

RSYNC OUTPUT...

rsync -n ... it shouldn't produce output, I apologize

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.