如何知道哪个php文件生成的div?

如何知道哪个php文件生成的div?

问题描述:

i'm using Joomla. I've installed a module that show latest real estates added. it have a button-set div showing a button with "Read more" on it. i want to change "Read more" to "Go to House". i do it in a file called default.php in lines below:

<div id="buttonest">
    <a class="readon" href="<?php echo sefRelToAbs( $link1 ); ?>" target="_self">
    <input class="submit" type="submit" value="Go to House" /></a>
</div>

but when the page reloads it shows "Read more" button regardless of changes in this file. how can i know if this div is generated by default.php file or another file? generally is there any way to know a div is generated by which php file? like monitoring page load o etc.? p.s. : i have root access to host.

我正在使用Joomla。 我已经安装了一个显示最新房地产的模块。 它有一个按钮设置div,显示一个按钮,上面有“阅读更多”。 我想把“阅读更多”改为“去家”。 我在以下行中名为default.php的文件中执行此操作: p>

 &lt; div id =“buttonest”&gt; 
&lt; a class =“readon”href =  “&lt;?php echo sefRelToAbs($ link1);?&gt;”  target =“_ self”&gt; 
&lt; input class =“submit”type =“submit”value =“Go to House”/&gt;&lt; / a&gt; 
&lt; / div&gt; 
  code>  
 
 

但是当页面重新加载时,无论此文件发生什么变化,都会显示“Read more”按钮。 我怎么知道这个div是由default.php文件还是另一个文件生成的? 一般有没有办法知道div是由哪个php文件生成的? 比如监控页面加载等等。?np.s。 :我有root访问权限。 p> div>

It sounds like maybe that particular file is overwritten, probably in your template folder.

Try to look in

/templates/{name of template you are using}/html/{name of component that you found the first default.php file}/{path to default.php similar to the first default.php file you edited}

You can pass a value through the URL. On the PHP file, you can do :

<div id="buttonest">
    <a class="readon" href="<?php echo sefRelToAbs($link1)."?ref=default"; ?>" target="_self">
    <input class="submit" type="submit" value="Go to House" /></a>
</div>

Then, anywhere in between PHP tags, you can :

<?php
if (isset($_GET['ref']) && $_GET['ref'] == "default"){
  // you get here from the default page
}
?>

You could set an attribute on the actual div like

<div srcscript="<?php echo __FILE__?>">

But I'd remove them all before I went to production, maybe wrap them in an if debug==true condition or something.

To answer the actual question, no there is no default way to tell which parts of the output were generated by which included scripts.

There is no direct way to directly identify which file is the source of a generated div.

What you could do however is do a search for a discriminating element in the content of all the php files, in that case "Read more" or more relevant. From the root directory or subdirectory if you can narrow down grep -nR "Read more" *

Then you would have the whole list of the potential matching php files.

From this list, check them out one by one, or filtering more your search.

If multiple potential matches, add a temporary trace/log of some sort that would identify the file for you, using different texts or the constant __FILE__ that would directly give you the name of the file.

Also, try clearing the cache as well before, it might just be related to it.

This happens all the time when editing Drupal or WordPress themes. You want to "find in files" in your IDE or command-line and search for the identifiable information associated with the outputted markup in question.

Did you take a look at the language files (in case that model has one)? If it sticks to guidelines, it should use a language string (to be found in /languages/yourlanguage/mod_modulename.ini or similar). You could also take a look into the Joomla language manager (overrides section) - search for "read more" or "read_more".

In both cases, you could just try changing the values.