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 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值