Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > de.comp.lang.php > #3593

Re: private property

Path csiph.com!news.mixmin.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups de.comp.lang.php
Subject Re: private property
Date Thu, 10 Dec 2015 19:31:57 +0100
Organization PointedEars Software (PES)
Lines 33
Message-ID <2280823.oJgiztHiD9@PointedEars.de> (permalink)
References <n4bpsd$ous$1@news.albasani.net> <n4bvin$3e0$1@news.albasani.net> <n4c4ak$cd5$1@news.albasani.net>
Reply-To Thomas 'PointedEars' Lahn <php@PointedEars.de>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
X-Trace solani.org 1449772320 28898 eJwNysEBADEEBMCWCBbluEP/JSTzHhMwflcY1Nb2dBq8xUsCPiElHJvJ1Kee95yWx75sSp0LC50QsQ== (10 Dec 2015 18:32:00 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Thu, 10 Dec 2015 18:32:00 +0000 (UTC)
User-Agent KNode/4.14.2
X-User-ID eJwVy8EBwCAIA8CVoISg41SM+49g+7rXZdDZBSaRJ4/1EzL5GovQRpwFoxwImKqGfnuXab+zq33i2xLNOQwXTe0U+w==
Cancel-Lock sha1:mUXGEXF3cx+pXzYcHbyoNMubGoQ=
X-NNTP-Posting-Host eJwFwYEBwDAEBMCVIt5jHDT2H6F3phSOg0bY2kYIv3wKGU2yC+sReUr92KKnKx2RPnfB6h8K0xC+
Xref csiph.com de.comp.lang.php:3593

Show key headers only | View raw


Jan Novak wrote:

> Am 10.12.2015 um 14:43 schrieb Niels Braczek:
>>> class generalClassFunctions{
>>> public function show($htmlfile){
>>> global $_lang;
>>> global $_rootdir;
>>
>> *Never* use global!
>> Übergebe diese Daten explizit, entweder der Methode show() oder dem
>> Konstruktor.
> 
> Ist das nicht ein wenig aufwendig, das jeder Klasse jedesmal
> mitzuteilen? Es handelt sich um die Sprachdatei, ist überall gleich und
> unverändert (aber das nur am Rande).

Keine Regel ohne Ausnahme.  Nur: Weshalb muss die Klasse bzw. die Methode 
die Sprachdatei kennen?  Siehe hierzu auch:

>> Unabhängig davon: Entkopple die Ausgabe von der Datenstruktur. […]

Global verfügbare Information kannst Du auch in statischen Eigenschaften 
einer Verwaltungs-Klasse bzw. besser in dynamischen Eigenschaften ihrer 
Instanz (bei mir und Zend Framework: Application) speichern.  (Das 
Wurzelverzeichnis sollte man ohnehin nicht durch alle Klassen mitschleppen 
müssen; einmal chdir() in der index.php, dann nur noch relative Pfade 
verwenden.)

-- 
PointedEars
Zend Certified PHP Engineer
Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.

Back to de.comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

private property Jan Novak <repcom@gmail.com> - 2015-12-10 13:06 +0100
  Re: private property Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-10 14:09 +0100
  Re: private property Niels Braczek <nbraczek@freenet.de> - 2015-12-10 14:43 +0100
    Re: private property Jan Novak <repcom@gmail.com> - 2015-12-10 16:04 +0100
      Re: private property Niels Braczek <nbraczek@freenet.de> - 2015-12-10 16:25 +0100
        Re: private property Jan Novak <repcom@gmail.com> - 2015-12-11 08:06 +0100
      Re: private property Arno Welzel <usenet@arnowelzel.de> - 2015-12-10 16:31 +0100
        Re: private property Jan Novak <repcom@gmail.com> - 2015-12-11 08:04 +0100
          Re: private property Stefan+Usenet@Froehlich.Priv.at (Stefan Froehlich) - 2015-12-11 07:37 +0000
            Re: private property Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-11 16:23 +0100
              Re: private property Stefan+Usenet@Froehlich.Priv.at (Stefan Froehlich) - 2015-12-12 13:06 +0000
                Re: private property Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-12 16:32 +0100
                Re: private property Stefan+Usenet@Froehlich.Priv.at (Stefan Froehlich) - 2015-12-17 17:40 +0000
                Re: private property Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-17 20:02 +0100
                Re: private property Stefan+Usenet@Froehlich.Priv.at (Stefan Froehlich) - 2015-12-17 19:03 +0000
                Re: private property Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-17 20:52 +0100
      Re: private property Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-10 19:31 +0100
        Re: private property Jan Novak <repcom@gmail.com> - 2015-12-11 08:03 +0100
          Re: private property Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-11 13:17 +0100
            Re: private property Jan Novak <repcom@gmail.com> - 2015-12-14 08:06 +0100
    Re: private property Jan Novak <repcom@gmail.com> - 2015-12-11 11:29 +0100
      Re: private property Jan Novak <repcom@gmail.com> - 2015-12-11 11:39 +0100
        Re: private property Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-11 14:56 +0100
          Re: private property Jan Novak <repcom@gmail.com> - 2015-12-14 08:15 +0100

csiph-web