here are the steps to display in joomla 1.5
hello.php includes the controller.php and invokes its execute() method. This method will invoke the task handling method() depending on the task passed from the request (in the link).
The default task is display().
The display() method is built into the JController class. The controller class name is HelloController. The view name is Hello. The display() method will take the Hello off the front of the controller class name, append View to it, and then add the view name, which is Hello, thus HelloViewHello. It will look for this in the directory views/{viewname}, so in this case, views/hello. It will look for a file called view.html.php.
So, here are the steps:
1. hello.php
2. HelloController->execute()
3. HelloController->display()
4. JController->display()
5. HelloViewHello->display()
Good to hear you've had some success, and hopefully I can help you out with things you're still working on.
What you have hit is one of the limitations of doing a Hello World example. It really isn't real world. But you have the general idea - each 'page' (or I'd rather, screen), has its own view. It isn't as clear in this example perhaps because the only difference between hello and goodbye is the message, nothing else. In our example, you could extract hello and goodbye as messages, and simply have one view, which would be message. But then you would have just one view.
Basically, for every set of data you want to display, you have a view. So for com_content, you have five views: archive, article, category, frontpage, section. This is one view for each set of data that is displayed.
But look at the templates in each of these directories:
archive
default.php
default_items.php
article
default.php
form.php
pagebreak.php
category
blog.php
blog_item.php
blog_links.php
default.php
default_items.php
frontpage
default.php
default_item.php
default_links.php
section
blog.php
blog_item.php
blog_links.php
default.php
You will see that each view displays a different set of data. There is one view to display a section, one view to display a category, one view for the frontpage, etc...
You will see templates broken up two different ways. You can see in a number of the views that there are different templates. As an example, in the section view, you have blog.php and default.php. These are different templates. They take the same information, but display them in different ways. These are called layouts. So you can have a blog layout, or you can have the default layout.
You'll see the same thing in the article view. In the article view, there are two possible layouts: default, and form. The default displays the article as the site visitor would see it when viewing the site. The form layout displays the information in a form that can be edited by the user.
Layouts can be selected using the setLayout() method.
The other breakdown of layouts can be seen in the category view. There are two files:
default.php
default_items.php
These aren't separate layouts, rather, default_items is a sub layout of default.php. So, default.php will specify where the items are displayed within the component, and then defaults_items.php specifies how the items in the category are displayed. This allows for greater flexibility and more modular modifications. This enables, for example, a Joomla! site template designer to override only the way the items are displayed and not have to write a whole new layout file for categories.
Hope this help explains things a little bit, and feel free to ask more questions!
The default task is display().
The display() method is built into the JController class. The controller class name is HelloController. The view name is Hello. The display() method will take the Hello off the front of the controller class name, append View to it, and then add the view name, which is Hello, thus HelloViewHello. It will look for this in the directory views/{viewname}, so in this case, views/hello. It will look for a file called view.html.php.
So, here are the steps:
1. hello.php
2. HelloController->execute()
3. HelloController->display()
4. JController->display()
5. HelloViewHello->display()
Good to hear you've had some success, and hopefully I can help you out with things you're still working on.
What you have hit is one of the limitations of doing a Hello World example. It really isn't real world. But you have the general idea - each 'page' (or I'd rather, screen), has its own view. It isn't as clear in this example perhaps because the only difference between hello and goodbye is the message, nothing else. In our example, you could extract hello and goodbye as messages, and simply have one view, which would be message. But then you would have just one view.
Basically, for every set of data you want to display, you have a view. So for com_content, you have five views: archive, article, category, frontpage, section. This is one view for each set of data that is displayed.
But look at the templates in each of these directories:
archive
default.php
default_items.php
article
default.php
form.php
pagebreak.php
category
blog.php
blog_item.php
blog_links.php
default.php
default_items.php
frontpage
default.php
default_item.php
default_links.php
section
blog.php
blog_item.php
blog_links.php
default.php
You will see that each view displays a different set of data. There is one view to display a section, one view to display a category, one view for the frontpage, etc...
You will see templates broken up two different ways. You can see in a number of the views that there are different templates. As an example, in the section view, you have blog.php and default.php. These are different templates. They take the same information, but display them in different ways. These are called layouts. So you can have a blog layout, or you can have the default layout.
You'll see the same thing in the article view. In the article view, there are two possible layouts: default, and form. The default displays the article as the site visitor would see it when viewing the site. The form layout displays the information in a form that can be edited by the user.
Layouts can be selected using the setLayout() method.
The other breakdown of layouts can be seen in the category view. There are two files:
default.php
default_items.php
These aren't separate layouts, rather, default_items is a sub layout of default.php. So, default.php will specify where the items are displayed within the component, and then defaults_items.php specifies how the items in the category are displayed. This allows for greater flexibility and more modular modifications. This enables, for example, a Joomla! site template designer to override only the way the items are displayed and not have to write a whole new layout file for categories.
Hope this help explains things a little bit, and feel free to ask more questions!
Nhận xét
Đăng nhận xét