dpauxqt1281 2014-12-22 05:55
浏览 86
已采纳

在joomla中找到php文件引用

what does $this variable in my edit.php file mean? there is no "include" or "require" in other files! I mean how can I find the class that $this is pointing. where is the main php file that contains classes which are using this edit.php file

edit.php

 <?php
/**
* @package RSForm! Pro
* @copyright (C) 2007-2014 www.rsjoomla.com
* @license GPL, http://www.gnu.org/copyleft/gpl.html
*/

defined('_JEXEC') or die('Restricted access'); 

JHtml::_('behavior.keepalive');
?>

<script type="text/javascript">
function directorySave(task) {
    var form = document.getElementById('directoryEditForm');
    form.task.value = task;
    form.submit();
}
</script>

<form action="<?php echo JRoute::_('index.php?     option=com_rsform&view=directory&layout=edit&id='.$this->app->input->getInt('id',0)); ?>"     method="post" name="adminForm" id="directoryEditForm" enctype="multipart/form-data">
    <table class="table table-condensed table-striped table-hover table-bordered category">
        <?php foreach ($this->fields as $field) { ?>
        <tr>
            <td width="200" style="width: 200px;">
            <?php echo $field[0]; ?> <?php echo $field[2]; ?>
        </td>
        <td>
            <?php echo $field[1]; ?>
        </td>
    </tr>
    <?php } ?>
   </table>

<div class="form-actions">
    <button type="button" onclick="directorySave('apply');" class="btn btn-primary button"><?php    echo JText::_('RSFP_SUBM_DIR_APPLY'); ?></button> 
    <button type="button" onclick="directorySave('save');" class="btn btn-primary button"><?php    echo JText::_('RSFP_SUBM_DIR_SAVE'); ?></button> 
    <button type="button" onclick="directorySave('back')" class="btn button"><?php echo     JText::_('RSFP_SUBM_DIR_BACK'); ?></button>
    <?php       /* <--! I am Ahmad Mobaraki     --> */?>
    <button type="button" onclick="directorySave('delete')" class="btn btn-primary button"><?php echo JText::_('RSFP_SUBM_DIR_DELETE'); ?></button>
    <?php      /*  end ahmad*/ ?>

</div>

<input type="hidden" name="option" value="com_rsform">
<input type="hidden" name="controller" value="directory">
<input type="hidden" name="task" value="">
<input type="hidden" name="id" value="<?php echo $this->app->input->getInt('id',0); ?>">
<input type="hidden" name="formId" value="<?php echo $this->params->get('formId'); ?>">
</form>
  • 写回答

1条回答 默认 最新

  • douzi2749 2014-12-22 06:16
    关注

    if its in the tmpl folder of a view folder it refers to a JView/JViewLegacy/JViewBase class or whatever you extended your view class to be. Usually that class will be defined in the parent folder in view.html.php or similarly named file.

    If you do a var_dump of $this it will tell you the class name

    For instance if I do

    var_dump($this); die;
    

    in one of my view template files i get

    object(VeteransViewVeterans)#190.....

    Where VeteransViewVeterans is my view class for my Veterans view of my Veterans component.

    $this holds the view class reference because its the class that includes/requires it

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥170 如图所示配置eNSP
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上