Changeset 1589 for trunk


Ignore:
Timestamp:
Nov 1, 2006, 6:04:24 AM (18 years ago)
Author:
rvelices
Message:

fix: get_filename_wo_extension (check for ===false) and template make_filename
improvement: can retrieve template output outside the template

Location:
trunk/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions.inc.php

    r1578 r1589  
    185185function get_filename_wo_extension( $filename )
    186186{
    187   return substr( $filename, 0, strrpos( $filename, '.' ) );
     187  $pos = strrpos( $filename, '.' );
     188  return ($pos===false) ? $filename : substr( $filename, 0, $pos);
    188189}
    189190
  • trunk/include/template.php

    r1587 r1589  
    148148
    149149  /**
    150    * fills $output template var
    151    */
    152   function parse($handle)
     150   * fills $output template var by default or returns the content
     151   */
     152  function parse($handle, $return=false)
    153153    {
    154154      if (!$this->loadfile($handle))
     
    167167      $_str = '';
    168168      eval($this->compiled_code[$handle]);
     169      if ($return)
     170      {
     171        return $_str;
     172      }
    169173      $this->output.= $_str;
    170174
     
    303307    {
    304308      // Check if it's an absolute or relative path.
    305       if (substr($filename, 0, 1) != '/'
    306           and substr($filename, 0, 1) != '\\' //Windows UNC path
    307           and !preg_match('/^[a-z]:\\\/i', $filename) )
     309      // if (substr($filename, 0, 1) != '/')
     310      if (preg_match('/^[a-z_][^:]/i', $filename) )
    308311      {
    309312        $filename = $this->root.'/'.$filename;
Note: See TracChangeset for help on using the changeset viewer.