Re: best practice
| From: | J. Nathan Matias | Date: | Mon, 22 Apr 2002 22:26:37 +0000 |
| Subject: | Re: best practice | ||
| References: | 1 2 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-1824@lists.php.net to get a copy of this message | ||
On Monday 22 April 2002 04:24, you wrote:
> Its one of those perplexing questions :) -
>
> I would probably go for the preloader
I have a preloader that reads the glade file and returns an array. This is a
tad more efficient in terms of PHP lines. The grabGlade takes a gladeObject
and the glade file and returns an associative array of widgets.
function make_array($array_of_items, &$gladeObject)
{
foreach($array_of_items as $item)
{
$returnVal[$item]=$gladeObject->get_widget($item);
//echo $item; echo "|";
}
return $returnVal;
}
function grabGlade(&$gladeObject, $gladeFile)
{
$theFile=fopen($gladeFile, "r");
$contents=fread($theFile, filesize($gladeFile));
fclose($theFile);
preg_match_all('|<name>(.*?)</name>|', $contents, $resultArray);
return make_array($resultArray[1], &$gladeObject);
}
-- Nate
------------The Rubber Paw--------------
"But without faith it is impossible to please Him: for he that cometh to
God must believe that He is, and that He is a rewarder of them that
diligently seek Him" --The Bible -- Hebrews 11:6
--------------------------------------
ruberpaw@ptdprolog.net www.rubberpaw.com
Learn Web Design! www.designharbor.org www.sitepoint.com
Use Free Software! www.linux.com www.gnu.org www.tuxedo.org/~esr/
Play Open Racer! openracer.worldforge.org
Lancaster PA Linux Users Group! www.lancaster-linux.org