phpgroupware-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-developers] fixed themes support and changing templates im


From: Dan Kuykendall (Seek3r)
Subject: [Phpgroupware-developers] fixed themes support and changing templates image/tpl loading
Date: Sat, 29 Dec 2001 01:56:23 -0800

I have finally fixed the problem with the loading of the themes files. I
kept having that blue bar in my footer when using idsociety/idsociety
and it finally bothered me enough to find out why it was doing that.
Apparently the whole way we were loading the template files didnt seem
to ever load up anything but default. Kinda weird.
Anyways thats fixed.

I am also going to make some changes to how we find the image files for
the navbar and such to improve performance and give us more flexibility
in giving a more dynamic interface with things such as
navbar_selected.gif.
The new method wont punish us in performance with all the disk reads
like our current method.

Basicly the plan is to stop doing all the file_exists() and instead
create an array with the list of files and store it as a class var in
the common class.
For example, I will do something like this:

$imagedir =
'/'.$appname.'/templates/'.$GLOBALS['phpgw_info']['server']['template_set'].'/images';
$imagedir_default = '/'.$appname.'/templates/default/images';
$imagedir_olddefault = '/'.$appname.'/images';

if (@is_dir($imagedir_olddefault))
{
  $d = dir($imagedir_olddefault);
  while (false !== ($entry = $d->read())) {
    if ($entry != '.' && $entry != '..')
    {
      $this->found_files['images'][$entry] = $imagedir_olddefault;
    }
  }
  $d->close();
}

if (@is_dir($imagedir_default))
{
  $d = dir($imagedir_default);
  while (false !== ($entry = $d->read())) {
    if ($entry != '.' && $entry != '..')
    {
      $this->found_files['images'][$entry] = $imagedir_default;
    }
  }
  $d->close();
}

if (@is_dir($imagedir))
{
  $d = dir($imagedir);
  while (false !== ($entry = $d->read())) {
    if ($entry != '.' && $entry != '..')
    {
      $this->found_files['images'][$entry] = $imagedir;
    }
  }
  $d->close();
}


What I did was get the file listing in reverse order so that the
priority files (the ones that best match what we want) will overwrite
the fallbacks. 

>From then on out I can just check to see if the
$this->found_files['images'] array exists and then do isset's for the
files I want and if it does the value of
$this->found_files['images'][$desired_image] will be the path to it.
This will cut down tons of file_exists() which will cut down on disk
reads and make this whole process perform ALOT better. The performance
increases will allow us to play with the file selection process without
much performance impact at all.

I think this method can be used throught our navbar code for finding the
fallback tpl files as well. For now I will try this out for images and
then move to the tpl files.

Seek3r



reply via email to

[Prev in Thread] Current Thread [Next in Thread]