Welcome to Geeklog, Anonymous Thursday, February 29 2024 @ 10:36 pm EST

Geeklog Forums

Template OverRide


Status: offline

kino

Forum User
Newbie
Registered: 06/14/06
Posts: 14
Location:Japan
Hello,I'm kino.

I make Template OverRide.
It is possible to download in the following URL.

http://www.geeklog.jp/filemgmt/index.php?id=207
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
So what exactly does it do? My Japanese is a little weak :wink:

bye, Dirk
 Quote

Status: offline

kino

Forum User
Newbie
Registered: 06/14/06
Posts: 14
Location:Japan
This correction can reduce a file.

At first, Geeklog processes functions.php.
set $_BASE_TEMPLATE
And execute functions.php in $_BASE_TEMPLATE .
Text Formatted Code

$_BASE_TEMPLATE = 'professional';
if(file_exists($_CONF['path_themes'] . $_BASE_TEMPLATE . '/functions.php'))
{
        require_once( $_CONF['path_themes'] . $_BASE_TEMPLATE . '/functions.php' );
}
 


Next, when new of Template is executed, the following code is executed.
Text Formatted Code

        function Template($root = ".", $unknowns = "remove") {
                global $_BASE_TEMPLATE;
               
                $this->set_base($_BASE_TEMPLATE);

                if ($this->debug & 4) {
                        echo "<p><b>Template:</b> root = $root, unknowns = $unknowns</p>\n";
                }
               
                $this->set_root($root);
                $this->set_unknowns($unknowns);        

        }

        function set_root($root) {
                global $_CONF;
                if ($this->debug & 4) {
                        echo "<p><b>set_root:</b> root = $root</p>\n";
                }
                if (substr ($root, -1) == '/') {
                        $root = substr ($root, 0, -1);
                }
                if (!is_dir($root)) {
                        $root = str_replace($_CONF['path_layout'],$this->base .'/',$root);
                        if (!is_dir($root)) {
                                $this->halt("set_root: $root is not a directory.");
                                return false;
                        }
                }

                $this->root = $root;
                return true;
        }
 


Next, when set_file of Template is executed, the following code is executed.
Text Formatted Code

        function filename($filename) {
                if ($this->debug & 4) {
                        echo "<p><b>filename:</b> filename = $filename</p>\n";
                }
                if (substr($filename, 0, 1) != "/"){
                        if (file_exists($this->root."/".$filename))     {
                                $filename = $this->root."/".$filename;                         
                        } else {
                                if (file_exists($this->base."/".$filename)) {
                                        $filename = $this->base."/".$filename;
                                }
                        }
                }
                if ($this->debug & 4) {
                        echo "<p><b>real filename:</b> filename = $filename</p>\n";
                }              
//              if (substr($filename, 0, 1) != "/") {
//                      $filename = $this->root."/".$filename;
//              }

//              if (!file_exists($filename)) {
//                      $this->halt("filename: file $filename does not exist.");
//              }
                return $filename;
        }
 


Was the following code better and this part is.

Text Formatted Code

        function filename($filename) {
                if ($this->debug & 4) {
                        echo "<p><b>filename:</b> filename = $filename</p>\n";
                }
                if (substr($filename, 0, 1) != "/"){
                        if (file_exists($this->root."/".$filename))     {
                                $filename = $this->root."/".$filename;                         
                        } else {
                                if (file_exists($this->base."/".$filename)) {
                                        $filename = $this->base."/".$filename;
                                }
                        }
                }
                if ($this->debug & 4) {
                        echo "<p><b>real filename:</b> filename = $filename</p>\n";
                }              

                if (!file_exists($filename)) {
                        $this->halt("filename: file $filename does not exist.");
                }
                return $filename;
        }
 
 Quote

All times are EST. The time is now 10:36 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content