Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MVC] fuzja Joomla + Smarty = MVC
atomp3
post
Post #1





Grupa: Zarejestrowani
Postów: 126
Pomógł: 1
Dołączył: 31.03.2006

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


Witam


Jest to dość dziwne połączenie. Pytałem na innych forach (joomla, smarty) ale nikt nie potrafi odpowiedzieć.

Jak połączyć model MVC z Joomla używając smarty? Udało mi się ogolnie odpalić Smarty w Joomla, ale wersja 1.5 używa MVC. Wiem że jest dużo przeciw ale mimo wszystko lubie uzywac smarty (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) Jest czytelny i przejrzysty.

Przykladowy controler z joomla:

  1. <?php
  2. // no direct access
  3. defined( '_JEXEC' ) or die( 'Restricted access' );
  4.  
  5. jimport('joomla.application.component.controller');
  6.  
  7. /**
  8.  * Greetings Component Controller
  9.  */
  10. class GreetingsController extends JController
  11. {
  12.  
  13.  /**
  14.  * Method to display the view
  15.  *
  16.  * @access public
  17.  */
  18. function display()
  19. {
  20.  $viewName= JRequest::getVar( 'view', 'list' ); //This sets the default view (second argument)
  21.  $viewLayout= JRequest::getVar( 'layout', 'listlayout' ); //This sets the default layout/template for the view
  22.  
  23.  $view = & $this->getView($viewName);
  24.  
  25. // Get/Create the model
  26.  if ($model = & $this->getModel(&#8216;greetings’)) {
  27. // Push the model into the view (as default)
  28.  $view->setModel($model, true);
  29.  }
  30.  
  31.  $view->setLayout($viewLayout);
  32.  $view->display();  
  33. }
  34. }
  35. ?>


tutaj jest tutorial http://www.joomladevuser.com/tutorials/com...-i-the-frontend



Dzieki za wszelka pomoc!

Ten post edytował atomp3 3.07.2008, 11:26:39
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: 23.08.2025 - 11:50