Hello,
could you say wether the double colon (Paamayim Nekudotayim) would be supported (that means with auto complete) in Web Builder or Rapid PHP soon?
I need it for static access to functions of a class in a project.
Or is it still possible?????
Thanks
PHP - OOP - Paamayim Nekudotayim
Moderator: kfury77
Forum rules
Please follow these guidelines when posting feature requests. This will help to increase the value of your contribution.
Please follow these guidelines when posting feature requests. This will help to increase the value of your contribution.
- Do not create new topics for already requested features. Add your comments to the existing feature request topics instead;
- Create separate topic for each feature suggestion. Do NOT post a number of non-related feature suggestions in a single topic;
- Give your topic a meaningful title. Do NOT create topics with meaningless titles, such as "My Suggestion" or "My Problem".
Re: PHP - OOP - Paamayim Nekudotayim
Hi,
There is support for static functions. Bellow you can see a sample where this works:
There is support for static functions. Bellow you can see a sample where this works:
Code: Select all
<?php
class Foo
{
public static $my_static = 'foo';
const awaa= 2;
public function staticValue() {
return self::$my_static;
}
}
class Bar extends Foo
{
public function fooStatic() {
return parent::$my_static;
}
}
print Foo::
$foo = new Foo();
print $foo->staticValue() . "\n";
print Bar::$my_static . "\n";
$bar = new Bar();
print $bar->fooStatic() . "\n"; //Gatis: must not show $my_static
?>
Kind regards,
Gatis Avots
Gatis Avots
Re: PHP - OOP - Paamayim Nekudotayim
Here is an example how we (must) use it in the company i work for. There we work with eclipse - but i wont use it because eclipse often crashs...
It is just a example how we use it.
Of course we use this in other files that require a class too.
It is just a example how we use it.
Of course we use this in other files that require a class too.
Code: Select all
<?
class bandfunc
{
public static function showband($iBandId)
{
$rResult = mysql_query('SELECT * FROM lala WHERE band_id = '.$iBandId);
$mpBand = mysql_fetch_assoc($rResult);
if($mpBand['band_confirm'] == '1')
{
$mpReturn = array(
'BAND_NAME' => $mpBand['band_name'],
'BAND_TEXT' => nl2br($mpBand['band_text']),
'BAND_INTIS' => self::showBandInterviews($mpBand['band_id']) // <----------------------- call
);
}
return fgettemplate('shared/m_band/tmpl/bz_showband.html', $mpReturn);
}
public static function showBandInterviews($iBandID) // <----------------------- function
{
$qGetResult = mysql_query('
SELECT *
FROM bla
WHERE da = "'.$iBandID.'" AND inti_confirm = 1
ORDER BY inti_date DESC
');
if (mysql_num_rows($qGetResult) > 0)
{
while($rResult = mysql_fetch_assoc($qGetResult))
{
$mpLocal = array(
'INTI_TITEL' => $rResult['inti_titel'],
'INTI_ID' => $rResult['inti_id']
);
$sOut .= fgettemplate('shared/m_inti/tmpl/inti_list_row.html', $mpLocal);
}
return $sOut;
}
} // EOF showBandInterviews //
}
?>
Re: PHP - OOP - Paamayim Nekudotayim
Do you mean you need to see all static functions of the class after "self::"?
Kind regards,
Gatis Avots
Gatis Avots
Re: PHP - OOP - Paamayim Nekudotayim
Yes! In the best case not just self::AutoComplete but rather for all files. For example if I require the class bandfunc inside an other php file (of a project) I would call a function like this.
It is just an example. Of course I check variables before i use them 
Code: Select all
return bandfunc::showband($_GET['id']);
