简体   繁体   English

如何在Joomla中添加自定义PHP?

[英]How to add custom PHP in Joomla?

I'm having a very difficult time putting custom code into my first Joomla website. 我在将自定义代码放入我的第一个Joomla网站时非常困难。 Is Joomla seriously limited to only the extensions and modules that they already provide? Joomla是否严格限于仅已提供的扩展和模块? How can I customize it with my own PHP code? 如何使用自己的PHP代码自定义它?

Is joomla seriously limited to only the extensions and modules that they already provide. joomla严格限于仅它们已提供的扩展和模块。

Absolutely not. 绝对不。 Joomla is quite rich when it comes to customization. Joomla在定制方面非常丰富。 All those extensions and modules is something that people have created using the rich interfaces available. 人们使用丰富的可用接口创建了所有这些扩展和模块。

The wealth of information is here . 大量的信息就在这里

In terms of customization there are 3 main things to look at: 在定制方面,有3个主要方面需要考虑:

Plugins - event driven and fairly easy to do 插件 -事件驱动,很容易做到

Modules - where you put small capabilities across your website; 模块 -在您的网站上放一些小功能; very easy to do 很容易做

Components - definitely the most complex (don't start with this) but this will create the main functional unit. 组件 -绝对是最复杂的(不要以此为起点),但这将创建主要的功能单元。 I use this for more complex applications 我将其用于更复杂的应用程序

Your php experience will be put to good use. 您的php经验将得到很好的利用。

I've needed to do this multiple times with Joomla, so I always go for Sourcerer . 我需要多次与Joomla一起执行此操作,因此我总是选择Sourcerer It's a free Plugin that allows you to add custom code, such as CSS, Javascript and PHP to articles. 它是一个免费的插件,可让您向文章添加自定义代码,例如CSS,Javascript和PHP。 Below is an example of how easy it is to be done: 下面是一个简单的示例:

{source}
<?php
    echo '<p>';
    echo 'Hello';
    echo '</p>';
?>
{/source}

turn off the editor first -> goto module manager -> add customHTML module -> paste your code (php, html, javascript, css etc) and save... nastiest and quickest way of doing what you want. 首先关闭编辑器->转到模块管理器->添加customHTML模块->粘贴您的代码(php,html,javascript,css等)并保存...最讨厌,最快的方式来做您想要的事情。

editor off because otherwise it'll clean up your code... 编辑器关闭,因为否则它将清理您的代码...

after that, try to create your own module/plugin to suit your needs (see links above @Tom), then make a lite and pro version and make money... all it needs is a good idea xD 之后,尝试创建自己的模块/插件来满足您的需求(请参见@Tom上方的链接),然后制作精简版和专业版并赚钱...所有需要的都是xD的好主意

Based from my experience, Joomla is very powerful and everything that we want was provided because there are a lot of components and modules on the internet. 根据我的经验,Joomla非常强大,并提供了我们想要的一切,因为Internet上有很多组件和模块。 Sometimes I edit the component or the module that I downloaded. 有时,我编辑下载的组件或模块。 Just go to the folder and you will see the codes from there you can edit it. 只需转到该文件夹​​,您将在其中看到代码,您可以对其进行编辑。 Or you can create your own module or component based on the needs of your client 或者,您可以根据客户需求创建自己的模块或组件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM