Joomla 模块在本地工作,但在托管时不显示任何内容

发布于 2024-08-10 21:36:03 字数 1017 浏览 3 评论 0原文

我是 joomla 新手,我需要为学校项目开发 joomla 网站。我修改了一个现有模块,使其显示特色项目,当我在本地测试该网站时,它完美地做到了这一点。但是,当我将文件上传到网站的托管副本时,该模块将加载但不显示任何内容。它只是加载 php 输出的标题和区域,但脚本没有返回任何内容。为什么会发生这种情况呢?我已经弄清楚了 joomla 的大部分情况,但当谈到这个问题时我很困惑。

据我所知,与该模块相关的所有文件都已成功复制,并且在模块管理器中已正确设置。我在托管副本上打开了调试模式,并在尝试加载带有此模块的另一个页面时收到此消息:

解析错误:语法错误,意外 T_STRING 在 /home/content/s/r/s/srsgdmnet/html/components/com_rbids/rbids.html.php 在第 1 行

我查看了该文件,但不知道它在说什么。第一行只是“”,这很好。它只是说第一行,但实际上指的是其他地方的问题吗?该文件是我的模块与之交互的反向拍卖组件的一部分。我没有修改该文件中的代码,除了使用正则表达式(使用“\n\s*(\n)”搜索,用“\n”替换)通过替换命令删除过多的空格在 Netbeans 中。这从文件中删除了大约 3200 行,使其更易于导航。我认为这不会改变代码方面的任何内容,因为它在本地使用时仍然可以正常工作。

我修改了本地configuration.php文件以使用与托管副本相同的数据库来查看是否是数据库问题,但它仍然工作正常,因此排除了这种情况。两个副本上的 php.ini 文件都是相同的,除了本地副本中的 Zend 内容被注释掉,这样我就可以使用 Xdebug(在问题发生后进行了此更改,试图找到它)​​。我已经使用 Xdebug 单步调试了代​​码,但无法找到问题所在,所以我认为这是一个配置问题。

我的本地副本也不会加载某些模块(例如主菜单),并且我无法导航到其他一些页面,不确定这是否相关。两个副本的代码相同,但每个副本的结果不同。我是否跳过了迁移代码的重要步骤?

我正在使用 Joomla 版本 1.5.9。请帮忙!

I am new to joomla and I need to work on a joomla website for a school project. I modified an existing module to make it display featured projects and it does that flawlessly when I test the site locally. However, when I uploaded my files to the hosted copy of the website, the module will load but does not display anything. It just loads the title and the area for the php output but there is nothing returned by the script. Why would this be happening? I have joomla mostly figured out but I'm stumped when it comes to this problem.

As far as I can tell, all files related to this module have been copied over successfully and it is setup properly in the module manager. I turned on debugging mode on the hosted copy and got this message when trying to load another page with this module on it:

Parse error: syntax error, unexpected
T_STRING in
/home/content/s/r/s/srsgdmnet/html/components/com_rbids/rbids.html.php
on line 1

I looked at the file and I don't have a clue what it's talking about. Line one is just "<?php" which is fine. Is it just saying line 1 but actually referring to a problem elsewhere? This file is part of a reverse auctions component that my module interacts with. I didn't modify the code in that file with the exception of using a regular expression (search using "\n\s*(\n)", replace with "\n") to remove excessive amounts of whitespace via the replace command in Netbeans. This cut roughly 3200 lines from the file, making it much easier to navigate. I assume this did not alter anything in terms of code because it still works fine when used locally.

I modified my local configuration.php file to use the same database as the hosted copy to see if it was a database issue but it still worked fine so that rules that out. The php.ini files are the same on both copies with the exception of the local one having the Zend stuff commented out so I could use Xdebug (made this change after the problem occurred in an attempt to locate it). I have stepped through the code with Xdebug and haven't been able to track the issue down so I'm thinking it's a configuration problem.

My local copy also does not load certain modules (main menu, for one) and I can't navigate to some of the other pages, not sure if that is related. The code is the same for both copies yet each one has different results. Am I skipping vital steps for migrating the code?

I am using Joomla version 1.5.9. Please help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我爱人 2024-08-17 21:36:03

您的问题已有十天了,所以也许您已经解决了。但我的建议是检查代码中的正斜杠和反斜杠。代码可能使用 \ ,它在本地工作,但在需要 / 的服务器上失败。在 Joomla 扩展中,您可以通过 DS 替换文件夹分隔,即“文件夹”.DS.“子文件夹”而不是“文件夹/子文件夹”。 API 将根据情况用 \ 或 / 替换 DS。

但是,您收到的解析错误表明您的代码语法中缺少某些内容。您只需要用放大镜仔细观察即可。有时,当错误涉及第一行时,缺少某些内容的影响会回到文件的开头。它可能是一个 ' 或 ;或者类似的小东西。

无论您的模块是什么,您都应该更新到 Joomla 版本 1.5.15,这是目前的最新版本。您比计划落后了 6 个安全版本!

Your question is ten days old, so perhaps you solved it already. But my suggestion would be to check the code for forward and back slashes. It might be that the code uses \ which works locally but fails on your server where it needs /. In Joomla extensions you can replace folder separations by DS, in the way of 'folder'.DS.'subfolder' instead of 'folder/subfolder'. The API will replace the DS by \ or / as appropriate.

However, the parse error you get indicates that something is missing in the syntax of your code. You will just have to go over it with a magnifyer glass. Sometimes when the error refers to the first line the impact of something missing works its way back to the beginning of the file. It could be a ' or ; or something small like that.

Regardless of your module, you should update to Joomla version 1.5.15 which at present is the latest version. you are 6 security releases behind schedule!

梦里兽 2024-08-17 21:36:03

我一直与之合作的小组得出的结论是,当我们编辑和保存某些文件时,Netbeans 弄乱了它们。我们的测试方法是从服务器获取文件,在 Netbeans 中打开并保存,然后上传回服务器。有时,这会产生显然没有任何换行符的文件,并导致 php 错误、破坏组件甚至关闭整个站点。

我们当前的解决方法是仅获取发生这种情况的文件,并在上传之前使用 notepad++ 进行更改。这是一个非常奇怪的问题,给我们带来了很多悲伤。希望 Netbeans 团队在未来的版本中解决这个问题。

感谢大家尝试帮助我解决这个问题。

The group I have been working with has come to the conclusion that somehow Netbeans is messing up some of the files when we edit and save them. We tested by taking files from our server, opening and then saving in Netbeans, and then uploading back to the server. Sometimes this produced files that apparently did not have any newlines in them and led to php errors, breaking components or even taking down the whole site.

Our current workaround for this is to just take the files this happens to and use notepad++ to make our changes before uploading. It's a very strange issue and caused us a lot of grief. Hopefully the Netbeans team fixes this in future releases.

Thank you all for your attempts to help me solve this problem.

音盲 2024-08-17 21:36:03

尝试以传统方式关闭 并查看它是否有效或错误行是否发生变化。

我记得在 Joomla 或 Fabrik 论坛上看到过类似的问题,但不记得确切的答案

Try closing your <?php the traditional way and see if it works or the error line changes.

I remember seeing a similar question either on Joomla or Fabrik forums but cannot remember precise answer

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文