Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Kohana]Zmiana kolejności title, framework kohana
badlalo
post
Post #1





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 3.04.2012

Ostrzeżenie: (0%)
-----


Witam,

Mam pewien problem, potrzebuje wprowadzić kilka zmian do storny, którą nie ja pisałem. Mianowicie w tym momencie tytul generwowany jest w tym miejscu(tak mi sie wydaje)
  1. public function before()
  2. {
  3. // Jeśli jest włączone automatyczne renderowanie - przerenderuj szablon.
  4. if ( $this->auto_render === TRUE )
  5. {
  6. $this->template = View::factory($this->template);
  7.  
  8. $serials = ORM::factory('serial')->find_all();
  9.  
  10. // Przyisanie globalnie seriali
  11. $this->template->serials = $serials;
  12. }
  13. $session = Session::instance();
  14.  
  15. if(Session::instance()->get('left') === NULL)
  16. {
  17. Session::instance()->set('left', 500);
  18. }
  19. Notices::init();
  20. Header::instance()->set( 'title', 'Online, Odcinki, Za darmo');
  21.  
  22. return parent::before();
  23. }


Później wyswietlany tutaj
  1. <title><?php echo Header::instance()->title;?></title>


CO chcialbym osiągnąć? Tytuł w tym momencie działa w ten sposób, że na początku jest tekst ONline, odcinki za darmo a pozniej dodawana jest nazwa podstrony. Chcialbym aby nazwa podstrony byla na przedzie a statyczny tytul byl zawsze na koncu, w jaki spososb moge to zrobic ? Albo napisać to w inny sposób bez uzycia tego Header::instance ?

Ten post edytował badlalo 13.08.2013, 14:26:44
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
badlalo
post
Post #2





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 3.04.2012

Ostrzeżenie: (0%)
-----


Oto chodzi ,ze to nie jest moje (IMG:style_emoticons/default/wink.gif)

Jest takie cos z afterkiem (IMG:style_emoticons/default/wink.gif) O to chodzilo ?

  1. public function after()
  2. {
  3. if ($this->auto_render === TRUE)
  4. {
  5. $this->response->body($this->template->render());
  6. }
  7.  
  8. return parent::after();
  9. }
  10. } // End Website


Dobra to raczej nie ten kawalek (IMG:style_emoticons/default/haha.gif) a bardziej ten ?

  1. public function action_show()
  2. {
  3. $uri = $this->request->param('id');
  4. $param = $this->request->param('param');
  5. $s = $this->request->param('season');
  6. $e = $this->request->param('episode');
  7.  
  8. // Jeśli nie przekazano parametru uri
  9. if(! $uri)
  10. {
  11. Notices::add('error', __('Serial nie został odnaleziony lub został usunięty'));
  12. $this->request->redirect();
  13. }
  14.  
  15. $serial = ORM::factory('serial')->where('uri', '=', $uri)
  16. ->find();
  17.  
  18. $seasons = ORM::factory('serial_season')->where('serial_id', '=', $serial->id)->and_where('season', '=', $s)->find();
  19.  
  20. // Jeśli nie znaleziono serialu w bazie
  21. if(! $serial->loaded())
  22. {
  23. Notices::add('error', __('Serial nie został odnaleziony lub został usunięty'));
  24. $this->request->redirect();
  25. }
  26.  
  27. Header::instance()->append('title', $serial->name);
  28.  
  29. $serial->views += 1;
  30. $serial->last_view = date('Y-m-d H:i:s');
  31. $serial->save();
  32.  
  33. if($param)
  34. {
  35. $episode = ORM::factory('serial_season_episode')->where('uri', '=', $param)->and_where('episode', '=', $e)->and_where('season_id', '=', $seasons->id)->find();
  36.  
  37. if( ! $episode->loaded())
  38. {
  39. $this->request->redirect(Route::get('serial')->uri(array(
  40. 'id' => $serial->uri
  41. )));
  42. }
  43. else
  44. {
  45. if(! Auth::instance()->logged_in())
  46. {
  47. $left = Session::instance()->get('left');
  48.  
  49. if($left === 0)
  50. {
  51. Notices::add('error', __('Przekroczyłeś limit oglądania bez rejestracji. Załóż darmowe konto i oglądaj bez limitu.'));
  52. $this->request->redirect('user/register');
  53. }
  54.  
  55. $left--;
  56.  
  57. if($left >= 0)
  58. {
  59. Session::instance()->set('left', $left);
  60. }
  61. }
  62. Header::instance()->append('title', $episode->name);
  63.  
  64. $this->template->content = View::factory('serials/show_player', array(
  65. 'serial' => $serial,
  66. 'episode' => $episode
  67. ));
  68. }
  69. }
  70. else
  71. {
  72. $this->template->content = View::factory('serials/show', array(
  73. 'serial' => $serial
  74. ));
  75. }
  76. }


Ten post edytował badlalo 14.08.2013, 09:25:16
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 8.10.2025 - 07:06