| 49 | | public function archive($build = FALSE) |
| 50 | | { |
| 51 | | if ($build === 'build') |
| 52 | | { |
| 53 | | // Load archive |
| 54 | | $archive = new Archive('zip'); |
| 55 | | |
| 56 | | // Download the application/views directory |
| 57 | | $archive->add(APPPATH.'views/', 'app_views/', TRUE); |
| 58 | | |
| 59 | | // Download the built archive |
| 60 | | $archive->download('test.zip'); |
| 61 | | } |
| 62 | | else |
| 63 | | { |
| 64 | | echo html::anchor(Router::$current_uri.'/build', 'Download views'); |
| 65 | | } |
| 66 | | } |
| 67 | | |
| 68 | | /** |
| 69 | | * Demonstrates how to use views inside of views. |
| 70 | | */ |
| 71 | | function template() |
| 72 | | { |
| 73 | | $data = array |
| 74 | | ( |
| 75 | | 'title' => 'View-in-View Example', |
| 76 | | 'content' => 'This is my view-in-view page content.', |
| 77 | | 'copyright' => '© 2007 Kohana Team' |
| 78 | | ); |
| 79 | | |
| 80 | | $view = new View('viewinview/container', $data); |
| 81 | | $view->header = new View('viewinview/header', $data); |
| 82 | | |
| 83 | | $view->render(TRUE); |
| 84 | | } |
| | 49 | /** |
| | 50 | * Demonstrates how to archive a directory. First enable the archive module |
| | 51 | */ |
| | 52 | //public function archive($build = FALSE) |
| | 53 | //{ |
| | 54 | // if ($build === 'build') |
| | 55 | // { |
| | 56 | // // Load archive |
| | 57 | // $archive = new Archive('zip'); |
| | 58 | |
| | 59 | // // Download the application/views directory |
| | 60 | // $archive->add(APPPATH.'views/', 'app_views/', TRUE); |
| | 61 | |
| | 62 | // // Download the built archive |
| | 63 | // $archive->download('test.zip'); |
| | 64 | // } |
| | 65 | // else |
| | 66 | // { |
| | 67 | // echo html::anchor(Router::$current_uri.'/build', 'Download views'); |
| | 68 | // } |
| | 69 | //} |
| 424 | | $cal = new Calendar(5, 2007); |
| 425 | | |
| 426 | | echo $cal->render(); |
| 427 | | } |
| 428 | | |
| | 409 | $calendar = new Calendar(8, 2008); |
| | 410 | $calendar->attach($calendar->event() |
| | 411 | ->condition('year', 2008) |
| | 412 | ->condition('month', 8) |
| | 413 | ->condition('day', 8) |
| | 414 | ->output(html::anchor('http://forum.kohanaphp.com/comments.php?DiscussionID=275', 'Learning about Kohana Calendar'))); |
| | 415 | |
| | 416 | echo $calendar->render(); |
| | 417 | } |
| | 418 | |
| | 419 | /** |
| | 420 | * Demonstrates how to use the Image libarary.. |
| | 421 | */ |
| 448 | | echo Kohana::debug($image); |
| 449 | | } |
| 450 | | |
| | 444 | //echo Kohana::debug($image); |
| | 445 | } |
| | 446 | |
| | 447 | /** |
| | 448 | * Demonstrates how to use vendor software with Kohana. |
| | 449 | */ |
| | 450 | function vendor() |
| | 451 | { |
| | 452 | // Let's do a little Markdown shall we. |
| | 453 | $br = "\n\n"; |
| | 454 | $output = '#Marked Down!#'.$br; |
| | 455 | $output .= 'This **_markup_** is created *on-the-fly*, by '; |
| | 456 | $output .= '[php-markdown-extra](http://michelf.com/projects/php-markdown/extra)'.$br; |
| | 457 | $output .= 'It\'s *great* for user <input> & writing about `<HTML>`'.$br; |
| | 458 | $output .= 'It\'s also good at footnotes :-) [^1]'.$br; |
| | 459 | $output .= '[^1]: A footnote.'; |
| | 460 | |
| | 461 | // looks in system/vendor for Markdown.php |
| | 462 | require Kohana::find_file('vendor', 'Markdown'); |
| | 463 | |
| | 464 | echo Markdown($output); |
| | 465 | |
| | 466 | echo 'done in {execution_time} seconds'; |
| | 467 | } |