класс $this в дефолтном шаблоне joomla

Discussion in 'Создание шаблона' started by PR-NN, Mar 12, 2009.

  1. Offline

    PR-NN Недавно здесь

    Joined:
    Feb 26, 2009
    Messages:
    11
    Likes Received:
    0
    Привет всем!

    Есть вопрос от новичка который пытается познять все в joomla :)

    так вот есть например стандартный шаблон rhuk_milkyway. в данном шаблоне есть файл index.php.

    первые несколько строк:
    <?php
    /**
    * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
    * @license GNU/GPL, see LICENSE.php
    * Joomla! is free software. This version may have been modified pursuant
    * to the GNU General Public License, and as distributed it includes or
    * is derivative of works licensed under the GNU General Public License or
    * other free or open source software licenses.
    * See COPYRIGHT.php for copyright notices and details.
    */

    // no direct access
    defined( '_JEXEC' ) or die( 'Restricted access' );
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
    <head>
    <jdoc:include type="head" />

    <link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/system.css" type="text/css" />
    <link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/general.css" type="text/css" />
    <link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/rhuk_milkyway/css/template.css" type="text/css" />
    <link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/rhuk_milkyway/css/<?php echo $this->params->get('colorVariation'); ?>.css" type="text/css" />
    <link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/rhuk_milkyway/css/<?php echo $this->params->get('backgroundVariation'); ?>_bg.css" type="text/css" />


    а теперь вопрос: в шаблоне идет речь о классе $this скажите плиз что за класс скрывается в этой пременной какие у него есть методы какие есть члены-класса итд... или где это можно прочитать.
     
  2.  
  3. Offline

    _voland_ Местный => Cпециалист <=

    Joined:
    Apr 12, 2008
    Messages:
    2,171
    Likes Received:
    102
    Gender:
    Male
    по русски - нигде :(
    посмотреть можно например так
    Код (PHP):
    1. echo ('<pre>'.print_r($this).'</pre>');
     
  4. Offline

    PR-NN Недавно здесь

    Joined:
    Feb 26, 2009
    Messages:
    11
    Likes Received:
    0
    да мне по русски и не обязательно! можно и анг можно вообще просто исходник где этот класс описан...
     
  5. agruts
    Offline

    agruts Группа поддержки

    Joined:
    Mar 1, 2006
    Messages:
    609
    Likes Received:
    21
    Gender:
    Male
    Note that the $this object in the template is always the current instance of the JDocument object. Also note that $this->params is an object of type JParameter.

    For example, suppose your template has a parameter called templateColour which takes various string values which determine the colour scheme to be used. The colour schemes themselves are defined in CSS files which include the colour name as part of their file names. The following code retrieves the parameter then adds the appropriate stylesheet to render the page in the required colour scheme.
    Код (PHP):
    1. <?php
    2. $tplColour = $this->params->get( 'templateColour' );
    3. $this->addStyleSheet( $this->baseurl  . '/templates/'
    4.                     . $this->template . '/css/' . $tplColour .'.css' );
    5. ?>

    Retrieving parameter data in a template file

    Objects, methods and properties available from your template
     
  6. Offline

    _voland_ Местный => Cпециалист <=

    Joined:
    Apr 12, 2008
    Messages:
    2,171
    Likes Received:
    102
    Gender:
    Male
    Thanks, but last time i found info about it i couldn`t find something useful. May be the cause is my poor English.
    So can I ask U just a little gift - show me some exact ans useful links about classes and some practice for templates and plugins. Plus from me as a bonus ;)
     
  7. agruts
    Offline

    agruts Группа поддержки

    Joined:
    Mar 1, 2006
    Messages:
    609
    Likes Received:
    21
    Gender:
    Male
    _voland_, you needn`t write in english. I speak fluent enough russian.
    As for a little gift - I have to disappoint you. I do not have any useful links about J! classes exept those above. I`ve just opened joomla.org and found them under "developer" section of menu. The same could be done by yourself.
    Exuse me for my being using english, that was just a qoute from the official Joomla Wiki :)
     
  8. Offline

    PR-NN Недавно здесь

    Joined:
    Feb 26, 2009
    Messages:
    11
    Likes Received:
    0
    agruts, не подскажешь где можно про JDocument, JParameter почитать поподробнее ???
     
  9. chilly_bang
    Offline

    chilly_bang Недавно здесь => Cпециалист <=

    Joined:
    Apr 30, 2006
    Messages:
    1,541
    Likes Received:
    38
    Gender:
    Male
    Оффтопик (не в тему) - жми сюда!
     
    agruts likes this.
  10. agruts
    Offline

    agruts Группа поддержки

    Joined:
    Mar 1, 2006
    Messages:
    609
    Likes Received:
    21
    Gender:
    Male
    chilly_bang, +1

    PR-NN, кстати, там очень большой раздел документации
     

Share This Page

Loading...