[TYPO3-core] New TYPO3 Coding Guidelines

View: New views
12 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 - 3 | Next >

Parent Message unknown Re: [TYPO3-core] New TYPO3 Coding Guidelines

by Sebastian Gebhard-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

[sry for weired cross-posting]

Hey Guys,

thanks for the new CGL. The first thing I expected was an up-to-date
reference of how the new MVC-Extensions should be structured (recarding
directories and files) but it only contains a reference for old-style
extensions.
(http://typo3.org/documentation/document-library/core-documentation/doc_core_cgl/4.3.0/view/1/2/#id4631123)

Why?
_______________________________________________
TYPO3-dev mailing list
TYPO3-dev@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev

Re: [TYPO3-core] New TYPO3 Coding Guidelines

by Francois Suter-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

> thanks for the new CGL. The first thing I expected was an up-to-date
> reference of how the new MVC-Extensions should be structured (recarding
> directories and files) but it only contains a reference for old-style
> extensions.
> (http://typo3.org/documentation/document-library/core-documentation/doc_core_cgl/4.3.0/view/1/2/#id4631123)
>
> Why?

When the new CGLs were designed, ExtBase was not even on the radar yet.
Then, when they were near publishing we decided not to make heavy
modifications which would have caused yet more postponing.

But now that this new version has been released a first time it will
definitely get improved and expanded.

Cheers

--

Francois Suter
Cobweb Development Sarl - http://www.cobweb.ch
_______________________________________________
TYPO3-dev mailing list
TYPO3-dev@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev

Re: [TYPO3-core] New TYPO3 Coding Guidelines

by Benjamin Mack-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey,

On 10.07.2009 13:37 Uhr, Mathias Schreiber [wmdb >] wrote:
> $hello = 'This is ' . $name . ' Name' sucks to read from my point of view.
Hmm, that is interesting. I like that style... but I just wondered why.
then I got back to coding and found this piece of code in an extension
of mine:

$file = PATH_site . $this->uploadPath . $uploadedFile;

Well, this is way more readable than

$file = PATH_site.$this->uploadPath.$uploadedFile;

in my eyes. And, to be consistent to use white-spaces everywhere, it's
just natural to not have

$file = PATH_site.'uploads/tx_benni/'.$uploadedFile;

but to do

$file = PATH_site . 'uploads/tx_benni/' . $uploadedFile;

So, I now understand the reason for this in the guidelines (mainly
consistency) and thus, I'm 100% fine with this CGL.

But again, guys, it's just a guideline, not a rule. (well, maybe for the
core code it's a rule ;-)).

Plus: I hope not to see

$hello = 'This is ' . $name . ' Name';

but everything with a $GLOBALS['LANG']->getLL in your code, right ;-).

All the best,
Benni.

BTW: Francois, thanks for the clearing words, exactly my opinion.
_______________________________________________
TYPO3-dev mailing list
TYPO3-dev@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev

Re: [TYPO3-core] New TYPO3 Coding Guidelines

by Xavier Perseguers :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Benni,

> Plus: I hope not to see
>
> $hello = 'This is ' . $name . ' Name';
>
> but everything with a $GLOBALS['LANG']->getLL in your code, right ;-).

Big "bravo" for this perfect example that was the starting point of the
question about "to space or not to space" ;-)

--
Xavier Perseguers
http://xavier.perseguers.ch/en

One contribution a day keeps the fork away
_______________________________________________
TYPO3-dev mailing list
TYPO3-dev@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev

Re: [TYPO3-core] New TYPO3 Coding Guidelines

by Bastian Waidelich-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mathias Schreiber [wmdb >] wrote:

Hi!

> The new whitespace-after-everything style makes me wanna throw up

It took quite a while for me too to get used to all those spaces. But
now I wonder how I could be in doubt about the better readability in the
first place..

And one more thing about concatenation in general: It's mostly bad ;)
Instead of building HTML content in the PHP code for instance, one might
just use a template based approach.
And instead of
$message = 'This is '.$name.' Name';
I think
$message = sprintf('This is %s Name', $name);
Or (like Benni mentionend)
$message = sprintf($GLOBALS['LANG']->getLL('message'), $name)
is more readable (I know about the performance penalty, but if printf is
the bottleneck of your application there must be something wrong ;)

Having said that I know that we don't yet get around string
concatenations in lots of the core classes of course because there are
so many parts where HTML or XML is produced within PHP code..

Bastian
_______________________________________________
TYPO3-dev mailing list
TYPO3-dev@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev

Re: [TYPO3-core] New TYPO3 Coding Guidelines

by Dmitry Dulepov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

Bastian Waidelich wrote:
> And instead of
> $message = 'This is '.$name.' Name';
> I think
> $message = sprintf('This is %s Name', $name);
> Or (like Benni mentionend)
> $message = sprintf($GLOBALS['LANG']->getLL('message'), $name)

#1 is incorrect from the localization point of view. In different languages the included phrase can be in a different position. Only #3 is correct.

--
Dmitry Dulepov
LinkedIn: http://www.linkedin.com/in/dmitrydulepov
Twitter: http://twitter.com/dmitryd
Skype: liels_bugs
_______________________________________________
TYPO3-dev mailing list
TYPO3-dev@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev

Re: [TYPO3-core] New TYPO3 Coding Guidelines

by Mathias Schreiber [wmdb >] :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bastian Waidelich schrieb:
> $message = sprintf($GLOBALS['LANG']->getLL('message'), $name)
> is more readable (I know about the performance penalty, but if printf is
> the bottleneck of your application there must be something wrong ;)

a single printf ain't a problem.
Just like a single killed whale ain't a problem.

Never underestimate the wonder of addition.

Did you know what the two mostly called functions are in TYPO3 requests?
is_array() (which is ok) and strlen().

"One strlen can't hurt"

Think about it :)

cheers
Mathias

--
TYPO3 certified interogator
T3DD09 Entertainer
_______________________________________________
TYPO3-dev mailing list
TYPO3-dev@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev

Re: [TYPO3-core] New TYPO3 Coding Guidelines

by Bastian Waidelich-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mathias Schreiber [wmdb >] wrote:

Hi Mathias,

> Never underestimate the wonder of addition.

Never underestimate the amount of bugs introduced or not identified due
to bad readability ;)

But sure, you'll always have to weight performance off readability, off
features, off flexibility..


> Did you know what the two mostly called functions are in TYPO3 requests?
> is_array() (which is ok) and strlen().

No, I didn't know that - interesting!


> "One strlen can't hurt"

I would never claim this..
But.. Even though
if (!isset($text{5})) echo 'text too short';
is faster than
if (strlen($text) < 5) echo 'text too short';

I'd go for the strlen() variant unless it's a really critical part of
the code. Just because it's more readable and meaningful (In this case a
goo PHP optimizer will do the rewriting anyways).

Just my 2ct
Bastian
_______________________________________________
TYPO3-dev mailing list
TYPO3-dev@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev

Re: [TYPO3-core] New TYPO3 Coding Guidelines

by ries van Twisk-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Jul 13, 2009, at 12:18 PM, Bastian Waidelich wrote:

> Mathias Schreiber [wmdb >] wrote:
>
>
>> "One strlen can't hurt"
>
> I would never claim this..
> But.. Even though
> if (!isset($text{5})) echo 'text too short';
> is faster than
> if (strlen($text) < 5) echo 'text too short';
>
> I'd go for the strlen() variant unless it's a really critical part of
> the code. Just because it's more readable and meaningful (In this  
> case a
> goo PHP optimizer will do the rewriting anyways).
>
> Just my 2ct
> Bastian


You wouldn't want to go for critical parts aswell.
strlen will be multibyte in PHP6 and thus
much more compatible with PHP5,
trying to check if the 5th BYTE has something is dangerous
and might result in unexpected outcomes, specially for MB strings.

My advice, stick to standards and leave optimizations to the byte  
compiler.

Ries




_______________________________________________
TYPO3-dev mailing list
TYPO3-dev@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev

Possible IE bug in dam_frontend

by Jason Alexander-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello all,

I was just curious if anyone has had any problems using the  
dam_frontend in IE. The issue we are having is that when you try to  
download a file we get this error:

        Internet Explorer cannot download FILENAME from SITE
        Internet Explorer was not able to open this Internet Site. The  
requested site is either unavailable or cannot be found. Please try  
again later.

I have figured out that it is a known Microsoft bug when trying to  
download some file with IE. Here is Microsoft explanation:

In order for Internet Explorer to open documents in Office (or any out-
of-process, ActiveX document server), Internet Explorer must save the  
file to the local cache directory and ask the associated application  
to load the file by using IPersistFile::Load. If the file is not  
stored to disk, this operation fails.

When Internet Explorer communicates with a secure Web site through  
SSL, Internet Explorer enforces any no-cache request. If the header or  
headers are present, Internet Explorer does not cache the file.  
Consequently, Office cannot open the file.

If I go into the pushfile.php (within the extension) and edit the  
sendFile function by defining Pragma like so:

header("Pragma: private"); or header("Pragma: public");

(doesn't work with header("Pragma: no-cache"); )

then the file is allowed to be downloaded through IE. I was just  
curious as to why this may happen. I have the fix but unsure why this  
fix is working. Any comments, suggestion would be greatly appreciated.

Is this a DAM bug? Of this also happens in mm_dam_filelist as well.  
Can't find anything about this through Google.

Thanks in advance,

Jason



















_______________________________________________
TYPO3-dev mailing list
TYPO3-dev@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev

Re: Possible IE bug in dam_frontend

by Oliver Klee-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jason,

Jason Alexander schrieb:
> I was just curious if anyone has had any problems using the dam_frontend
> in IE.

For a new topic, please start a new thread by composing a completely new
posting from scratch instead of replying to an existing post.

(If you reply to a post, your post will contain a reference header to
the old post, causing it to get sorted in the existing thread. This
greatly reduces the chances for a reply, and your post also won't be
easily findable.)


Oliver
_______________________________________________
TYPO3-dev mailing list
TYPO3-dev@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev

Re: [TYPO3-core] New TYPO3 Coding Guidelines

by Ingo Renner-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Christopher Torgalson wrote:

> I thought the same. I don't think it's the RTE though--flow3 has no
> such problems in the docs.

FLOW3 doesn't use OOo, they use docbook. Hope we can find the time to
migrate to docbook some time, too.


best
Ingo

--
Ingo Renner
TYPO3 Core Developer, Release Manager TYPO3 4.2

_______________________________________________
TYPO3-dev mailing list
TYPO3-dev@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev
< Prev | 1 - 2 - 3 | Next >