lib/stc/PageWriter.php
private function make_data($file)
  {
    if (!array_key_exists('template', $file)) {
      throw new Exception('x> Current page: ' . $file['title'] . ' does not have a template.');
    }

    $t = Application::templates()->template($file['template']);

    $tmpl = $file;
    $tmpl['slug'] = $this->make_slug($file, $tmpl);

    $data_folder = Application::data_folder();
    $template_name = $data_folder . '/templates/' . $t;
    $content_template = $data_folder . '/' . $file['content'];

    $render_content_with = Application::renders()->select($content_template);
    $render_with = Application::renders()->select($template_name);

    $tmpl['html'] = $render_with->render($template_name, [
      'content' => $render_content_with->render($content_template, [
        'post'=> $file,
      ]),
      'post'=> $file,
    ]);

    if ($this->is_index($file['file'])) {
      $this->log_current_page('index', '');
    } else {
      $this->log_current_page($file['title'], $tmpl['slug']);
    }

    return $tmpl;
  }
private function make_data($file)
  {
    if (!array_key_exists('template', $file)) {
      throw new Exception('x> Current page: ' . $file['title'] . ' does not have a template.');
    }

    $t = Application::templates()->template($file['template']);

    $tmpl = $file;
    $tmpl['slug'] = $this->make_slug($file, $tmpl);

    $data_folder = Application::data_folder();
    $template_name = $data_folder . '/templates/' . $t;
    $content_template = $data_folder . '/' . $file['content'];

    $render_content_with = Application::renders()->select($content_template);
    $render_with = Application::renders()->select($template_name);

    $tmpl['html'] = $render_with->render($template_name, [
      'content' => $render_content_with->render($content_template, [
        'post'=> $file,
      ]),
      'post'=> $file,
    ]);

    if ($this->is_index($file['file'])) {
      $this->log_current_page('index', '');
    } else {
      $this->log_current_page($file['title'], $tmpl['slug']);
    }

    return $tmpl;
  }
private function make_data ( $ file ) { if ( ! array_key_exists ( 'template' , $ file ) ) { throw new Exception ( 'x> Current page: ' . $ file [ 'title' ] . ' does not have a template.' ) ; } $ t = Application :: templates ( ) -> template ( $ file [ 'template' ] ) ; $ tmpl = $ file ; $ tmpl [ 'slug' ] = $ this -> make_slug ( $ file , $ tmpl ) ; $ data_folder = Application :: data_folder ( ) ; $ template_name = $ data_folder . '/templates/' . $ t ; $ content_template = $ data_folder . '/' . $ file [ 'content' ] ; $ render_content_with = Application :: renders ( ) -> select ( $ content_template ) ; $ render_with = Application :: renders ( ) -> select ( $ template_name ) ; $ tmpl [ 'html' ] = $ render_with -> render ( $ template_name , [ 'content' => $ render_content_with -> render ( $ content_template , [ 'post' => $ file , ] ) , 'post' => $ file , ] ) ; if ( $ this -> is_index ( $ file [ 'file' ] ) ) { $ this -> log_current_page ( 'index' , '' ) ; } else { $ this -> log_current_page ( $ file [ 'title' ] , $ tmpl [ 'slug' ] ) ; } return $ tmpl ; }
Format a file to be rendered.
@param $template Template | A Template.
@param $file array | Json file as array.
@return array
Format a file to be rendered .