How to include an external PHP file into a Joomla

2019-09-16 11:57发布

问题:

So basically, I have a single article that I would like to load a PHP file into. This PHP file has a bunch of PHP and Javascript, along with HTML.

I need to include this full PHP file into my article since it contains an application form that I need on my website.

I have tried the following:

  • Using an extension to allow PHP and Javascript code within an article. Although, this is extremely time consuming since all PHP and Javascript must be wrapped in some special tags for the extension to recognise it, therefore this would take me days.
  • I tried using the extension and then trying <?php include "form.php"; ?> within the special tags, although this returned a major error since I believe it is because the PHP code is not within the tags itself.

Does anyone have any suggestions to how I can accomplish this?

回答1:

Try this ,

Create a module that have your forms. For module development tutorial

And create an article and set the module inside that like.

{loadposition contact_form_pos}

Inside your article just mention the module position like above for more



回答2:

Using extensions is the only way to do that.
If you don't want to use a plugin that allows PHP into articles, you would have to write your own custom component to show that php page in your own menu item, out of an article.



回答3:

It's a little hard to answer when you haven't said if you want to just do this one time in one specific article or you want to be able to put it into any article.