| View previous topic :: View next topic |
| Author |
Message |
leon_pegg
Joined: 12 Jun 2006 Posts: 113 Location: hemel / UK
|
Posted: Thu Jun 15, 2006 8:54 pm Post subject: gladexml extention |
|
|
here is a very small extention i made for gladexml
it adds load_remote this alows you to load a glade file from the web;
<?php
class gladexml_ext extends gladexml{
public static function load_remote($url){
$file = file_get_contents($url);
return parent::new_from_buffer($file);
}
}
?>
useage:
$glade = gladexml_ext::load_remote('http://btarchives.com/glade/login.glade');
hope this helps some one
regards leon pegg |
|
| Back to top |
|
 |
leon_pegg
Joined: 12 Jun 2006 Posts: 113 Location: hemel / UK
|
Posted: Thu Jun 15, 2006 9:01 pm Post subject: |
|
|
<?php
class gladexml_ext extends gladexml{
public function __construct($url){
$file = file_get_contents($url);
parent::new_from_buffer($file);
}
}
?>
this is an updated version acts much more like the old but now alows you to load ether a local glade file or remote glade file.
usage
$glade = new gladexml_ext('login.glade');
or
$glade = new gladexml_ext('http://btarchives.com/glade/login.glade');
Last edited by leon_pegg on Fri Jun 16, 2006 5:51 pm; edited 1 time in total |
|
| Back to top |
|
 |
Osiris
Joined: 17 Dec 2005 Posts: 65
|
Posted: Fri Jun 16, 2006 11:05 am Post subject: |
|
|
btw.:
a) this subforum is for pear compatible Packages, yours isn't it
b) you can't return anything from a constructor, because it returns nothing.
take a look at the php docs
regards
Osiris |
|
| Back to top |
|
 |
leon_pegg
Joined: 12 Jun 2006 Posts: 113 Location: hemel / UK
|
Posted: Fri Jun 16, 2006 5:57 pm Post subject: |
|
|
| sorry about posting here you are right about the return i just forgot to remove it when i change it to a constructor. hva ealtered the code acordingly |
|
| Back to top |
|
 |
|