AD

How is called the implementation module and rendering?

The previous article, about / index.php We have analyzed the finished $ mainframe-> dispatch () is the introduction of the component, and executed. We know for Joomla, a page can have only one or 0 components, while the upper and lower pieces are about module, module is an effective complement to rich pages. For instance, we know that the menu is the mod_mainmenu, the footer is mod_footer so, then the module is how to be introduced, and finally executed?

Secrets are $ mainframe-> render () this function, we look at the functions are done working.

The following is the render function of the content JSite

$ Document = & JFactory:: getDocument ();
$ User = & JFactory:: getUser ();

/ / Get the format to render
$ Format = $ document-> getType ();

switch ($ format)
(
case 'feed':
(
$ Params = array ();
) Break;

case 'html':
default:
(
$ Template = $ this-> getTemplate ();
$ File = JRequest:: getCmd ('tmpl', 'index');

if ($ this-> getCfg ('offline') & & $ user-> get ('gid') <'23 ') (
$ File = 'offline';
)
if (! is_dir (JPATH_THEMES.DS. $ template) & &! $ this-> getCfg ('offline')) (
$ File = 'component';
)
$ Params = array (
'Template' => $ template,
'File' => $ file. '. Php',
'Directory' => JPATH_THEMES
);
) Break;
)

$ Data = $ document-> render ($ this-> getCfg ('caching'), $ params);
JResponse:: setBody ($ data);

The important part is the introduction of the corresponding template file (template /***/ index.php), and call the JDocumentHtml the render function.

See here, we finally realized that the original template index.php to be introduced at this time.

We look JDocumentHtml the render function.

This function is the most important two procedures

$ Data = $ this-> _loadTemplate ($ directory.DS. $ Template, $ file); loading template file
$ Data = $ this-> _parseTemplate ($ data); Analysis Template

Continue to see what the template parsing process:

$ Replace = array ();
$ Matches = array ();
if (preg_match_all ('# # iU', $ data, $ matches))
(
$ Matches [0] = array_reverse ($ matches [0]);
$ Matches [1] = array_reverse ($ matches [1]);
$ Matches [2] = array_reverse ($ matches [2]);

$ Count = count ($ matches [1]);

for ($ i = 0; $ i <$ count; $ i + +)
(
$ Attribs = JUtility:: parseAttributes ($ matches [2] [$ i]);
$ Type = $ matches [1] [$ i];

$ Name = isset ($ attribs ['name'])? $ Attribs ['name']: null;
$ Replace [$ i] = $ this-> getBuffer ($ type, $ name, $ attribs);
)

$ Data = str_replace ($ matches [0], $ replace, $ data);
)

return $ data;
)

By the way, is this part of the template JDOC labels were resolved to obtain the corresponding module name and parameters, and call getBuffer function to perform.

To this call $ renderer-> render ($ name, $ attribs, $ result);
标签: lt, implementation, amp, array, params, template index, format document, default template, footer, complement, mainframe
分类: PHP
时间: 2010-04-22

相关文章

  1. Brew in the Implementation Module

    Provided we AEEModGen.c Module object used to create the external interface to start with, the function is as ...
  2. My FLASH Complex 2010 - and the start of FLASH WEB GAME

    Article Category: Flash programming ★ directory: → I → FLASH WEB GAME development process outlined in today's ...
  3. [Transfer] and start of FLASH WEB GAME

    ★ a long time to write something not that serious, and the 2010 New Year, sent a learned, I hope you can help. ...
  4. [Recommended] my FLASH Complex 2010 - and the business of FLASH WEB GAME (1)

    ★ directory: → I → FLASH WEB GAME development process outlined in today's FLASH WEB GAME game → entrepreneuria ...
  5. [Change] My FLASH Complex 2010 - and the start of FLASH WEB GAME

    ★ directory: → I → FLASH WEB GAME development process outlined in today's FLASH WEB GAME game → entrepreneuria ...
  6. Turn - volcanic "flash web game" experience article

    ★ my FLASH WEB GAME development process → 2007 In the summer, braving scorching sun, I went directly from scho ...
  7. Summary of design

    Abstract: This article is a summary of the design at the practice and study some of the experiences with the s ...
  8. Personal java web framework, Chuan-up study and communicate with everyone.

    I spent a lot of time pondering the web framework for java, but few have fully satisfied with the framework ma ...
  9. Ajax Integration and Support in the ArcGIS Java We

    http://edndoc.esri.com/arcobjects/9.2/Java/java/server/web_adf/ajax/ajax_integration.html Introduction ArcGIS ...
  10. The preparation of outline design specification document

    The preparation of outline design specification document Reprinted from: wader Original Source: http://blog.51 ...
  11. Digital Project Management Best Practice II

    1. Accurate project estimation is a prerequisite for IT project management services to enterprises, the projec ...
  12. The basic principles of database connection pool

    Traditional database connection (refer to the basic realization through DriverManager and DataSource to connec ...
  13. EXT novice learning materials

    EXT Introduction Whether you are new to Ext library, or people who want to learn Ext, the contents of this pap ...
  14. How you learn faster extjs, (including 1.0,2.0,3.0.3 version)

    Chapter 1 flashing it! Look at those beautiful example extjs 1.1. All release packages start from extjs very f ...
  15. Three Realms of communications software white box

    Communication software is widely considered the most difficult to implement white box area, on the one hand, c ...
  16. Layer Programming with Quartz Core

    "Reproduced" 2009/6/25 I come from a dinosaur egg Abbreviations: dinosaur egg or konglongdan. Please ...
  17. Liang Yang: [performance optimization field] ESI of

    ESI introduced the principle ESI stands for Edge Side Includes, is an XML-based markup language, the aim is to ...
  18. [Kingsoft source] of vulnerability scanners

    Analysis of vulnerability scanners [email protected]> From local send time 12:07 (GMT +08:00). Sent to the cur ...
  19. [Transfer] AS code optimization and Flex application performance (transfer)

    http://nianshi.javaeye.com/blog/7627066 Have to admit that a strong expression in the flash under the performa ...