| [news.eclipse.tools.pdt] Re: Code Completion: <? rather than <?php |
Blah...just switch the XHTML and XSLT.
Actually, my preference being
Dave
If it's any consolation, I had a co-op student last year who thought I was a dinosaur / heathen for using echo instead of print in PHP scripts.
One coder's ambrosia will always be another's filth.
Seems we always have something to learn from others. :)
BTW, I haven't checked if PDT supports this in terms of proper colouration, but I've been using this type of syntax for embedding large chunks of HTML (optionally with embedded $variables) within PHP pages:
$branding = <<<EOHTML <div id="branding"> <img src="images/projectdash.gif" alt="Dash"/> </div> EOHTML;
IIRC, it works with print and echo, too, whether assigned to a variable first or not.
Doing tricks like this lets you easily have a single "<?php" on line one and single "?>" on the last line without having to break in and out of your <?php ?> tag to nest HTML blocks.
Cheers,
Nick
Daniel Dornhardt wrote:I'm grateful for both of your answers, thank you for your time and effort.
Ok, my complaint: <?= $something ?> against <?php echo $something; ?> makes it easier on the eyes for me, especially in tight html + javascript + url concatenating corners of my view code. That Eclipse doesn't wrap lines doesn't help either. It's nothing big, and I don't want to make a fuzz about it.
I try to keep my views pretty clean from logic, so I prefer to treat them like "HTML with some loops and variables" in contrast to "PHP with some string output". But when the future calls and tells me that I'm wrong, I'm probably on the wrong track.
I'm gonna use <?php echo 'stuff' ?> from now on. I'm still gonna miss my <?= ?>.
A toast to all those wonderful people who work on Eclipse and PDT, it's awesome and served me wonderfully in the last years and hopefully in years to come.
Best wishes:
Daniel Dornhardt
Nick Boldt wrote:
One might argue that either:
a) it's the tool's responsibility to enforce Best Practices, by inserting <?php ?> instead of the lazier <? ?>; or
b) it's the tool's responsibility to provide enough rope to people so they can hang themselves, like when they have to move up to PHP6 and discover the lazy tags are no longer supported.
Me, I'd say +1 for making tools enforce good behaviour in support of language standards and requirements. After all, the tool's doing codegen for you so you don't have to type "php" after the "?". So, other than personal preference and the inclusion of a few extra characters, what's the complaint? Will three extra bytes per <?php ?> tag adversely affect your website / application's performance?
Nick
Roy Ganor wrote:Hi,
in the Window -> Preferences -> PHP -> Editor -> Typing page you can set to NOT auto-complete the "php ?>".
I guess we should add the ability to configure the addition of the "php" as people tend (not recommended) to ignore them in some cases.
- Roy
Daniel Dornhardt wrote:
Hello,
Using "<? ?>" not recommended, in php6 short-tags are depreceated. And default php.ini have short-tags disabled
Previously (Not sure when, some time before the 2.x Release) code assist allowed the use of short tags. I like them, especially for using php in view files and inserting things like <?= $username ?> and alternative syntax - style <? foreach($articles as $article): ?><? endforeach; ?> blocks. It seems really simpler and less threatening to non-programmers who aren't used to curly braces and everything, and it helps me keep my views nice and clean.
A matter of taste probably, but as I am as eccentric as every other human being, I'd like to have my good old way back. It doesn't have to be the default, I'm only interested on where to switch it on again.
If anybody has some advice on how to plug eclipse back to the old way, I'd be delighted.
Best wishes:
Daniel Dornhardt
On 25.12.2008 21:20, Igor wrote:I like PDT. Thank you very much for a great work.
Question: When I type "<?" the IDE immediately completes the "php ?>" for me. Is there possibility to configure it, so that it appends just "?>" without "php"? (so I get "<??>" instead "<?php ?>")
Looked around the Google for and couldn't find anything. Much thanks for
any insight.