[Wylug-help] vim line in PHP/HTML file

Martyn Ranyard ranyardm at gmail.com
Tue Apr 16 14:59:24 UTC 2013


Hi Gary,

Disclaimer: I am not a vim user (except when joe isn't installed and can't
be).

That said, short codes are BAD! the correct way to tell a php interpreter
that you want code to be interpreted is "<?php".  Perhaps vim is
discouraging this old bad practice, try the following :

<?php // vim: ft=php nowrap ai et ic

Also, worth noting that current best practice is to omit the final "?>" at
the end of the file, as that leads to random blank lines, which end up in
your output and causes output to happen often before headers are sent by
webservers.  Only saying this because we're talking about bad practice.

HTH,
--
Martyn


On 16 April 2013 14:54, Gary Stainburn <gary.stainburn at ringways.co.uk>wrote:

> Hi folks.
>
> On my old F9 server I have the following as the first line of every HTML
> file
> to force VIM into the right mode, and it works.
>
> <? // vim: ft=php nowrap ai et ic
>
> I have moved everything onto a new F18 server and have found that when I'm
> editing the files the VIM line is ignored and VIM treats the file as HTML
> not
> PHP, and doesn't use the correct syntax highlighting.
>
> Anyone got any ideas why?
>
> Gary
> --
> Gary Stainburn
> Group I.T. Manager
> Ringways Garages
> http://www.ringways.co.uk
>
> _______________________________________________
> Wylug-help mailing list
> Wylug-help at wylug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/wylug-help
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/wylug-help/attachments/20130416/890a17a3/attachment.html>


More information about the Wylug-help mailing list