Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > de.comp.lang.php > #3587
| From | Jan Novak <repcom@gmail.com> |
|---|---|
| Newsgroups | de.comp.lang.php |
| Subject | private property |
| Date | 2015-12-10 13:06 +0100 |
| Organization | albasani.net |
| Message-ID | <n4bpsd$ous$1@news.albasani.net> (permalink) |
Hallo,
ich bin mir nicht sicher ob meine Vorgehensweise korrekt ist, wenn ich
die Eigenschaft auf public setze, weil ich sonst einen "Cannot access
private property" error bekomme.
Aufruf:
$archives = [ ... hole die daten aus der db ...]
$a = new ArchivListUi();
$a->setArchives($archives);
$a->show('/template/archiv_list_ui.html');
...
class ArchivListUi extends generalClassFunctions{
private $archives;
public function setArchives($archives){
$this->archives = $archives;
}
}
...
class generalClassFunctions{
public function show($htmlfile){
global $_lang;
global $_rootdir;
$file = $_rootdir. $htmlfile;
if (file_exists($file)){
ob_start();
include $file;
$output = ob_get_contents();
ob_end_clean();
echo $output;
}
else {
die ('could not find template: ' .$file);
}
}
}
Wenn in der Klasse "ArchivListUi" die Eigenschaft $archives als public
deklariert wird, funktiert es erwartungsgemäß.
Ist das die richtige Vorgehensweise, die Eigenschaft als public zu
deklarieren?
Jan
Back to de.comp.lang.php | Previous | Next — Next in thread | Find similar
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