开发者

Joomla backend, where are the articles and how can I embed php in it?

开发者 https://www.devze.com 2023-01-31 06:56 出处:网络
I have been trying to figure this out for a while now. I\'m the head of marketing for an insurance office and I also am in charge of the website. I have meager skills in C and Python, but was handed a

I have been trying to figure this out for a while now. I'm the head of marketing for an insurance office and I also am in charge of the website. I have meager skills in C and Python, but was handed a webpage with a Joomla backend. Simple enough, it wasn't any trouble. However, joomla doesn't support php in its articles and I have a php email form written I need to embed in an article for an application for insurance. Does anyone know how I could accomplish this? I searched all over the ftp server and there is no area for articles. All I can figure out is that to call the article it is ourwebsite/index.php?option=com_co开发者_运维技巧ntent&view=article&id=86&Itemid=98 Is there any way I can do this? The developer we paid to do the setup did this with a few articles but I need to get more in there. Any help is much appreciated.


Download this extension, and install it via the Extensions > Install link in the admin menu.

http://extensions.joomla.org/extensions/edition/custom-code-in-content/5051

This extension will add a button below the article editor. Clicking the 'Sourcer' button will allow you to paste in the php code. It will then insert the php code in the article.

Before inserting the code, make sure you click in the editor to place the cursor where you would like code to be placed.


There is an abundance of email form extensions available for Joomla! You can easily embed email/contact forms into articles. You will need to specify a position name for that extension and then use that token in the article content to embed it, like specified here.

The rest is the matter of configuring/customizing the extension/plugin itself.

Last but not least: az ircmaxell said: please don't enable php scripting for/within articles.

I hope this helps.


Depending on how extensive of an application form you need you have a few options. You can use Joomla!'s built in "Contact Form" on pages where the articles are. Or use a form extension. "AIContactSafe" which is listed in the Joomla! directory is one I use frequently.

Here is a brief description of how to put the form on pages with the articles.

First, you must create a "dummy" menu item to that article. "Dummy" simply means a menu that isn't published to any position. You do this so Joomla! creates a "page" for that article. Simply copy the link Joomla! generates for it. Then, whatever form you are using can be published to that "page" in the module administration page.

Hope this helps.


Good Day,

Most code is stripped from Articles them self (such as PHP or Javascript) for security reasons. If you let users enter in JS or PHP they could allow you site to break become hacked far more easily.

However you have plenty of options.

You can allow more code in articles themselves and restrict the privledge to just super administrators (yourself) for instance.

  1. Login to http://example.com/administrator
  2. Content > Article Manager (from the main menu)
  3. Select the "Parameters" icon (top right)
  4. Scroll to Filtering Options (at the bottom)
  5. Select Public Front-end then press shift then select Administrator. (this selects every group except Super Administrator.
  6. For Filter Type, select Blacklist (Default)

Now you should be able to save more code in your articles. However, if you use Editors such as JCE they may have their own security filters.

So go a step further and create a custom module to play your code in. For example you add an image map into an article which works perfectly. But then client Jane, edits the article with her editor on, an upon save all the javascript is gone. To get around this...

  1. Login to http://example.com/administrator
  2. Extensions > Module Manager (in the main menu)
  3. Select "New" icon (in the top right)
  4. Select Custom HTML (half way down the left list)
  5. Enter a title (ex. PHP Map Code)
  6. For Show Title select "No". (in this case it still wont show if you select yes either)
  7. For Enabled select "Yes"
  8. For postion, enter a unique position such as php-mapcode (anything but an existing one in that drop down list)
  9. Make Sure your WYSIWYG Editor is off. (done in your user settings)
  10. Paste in your PHP Code
  11. Select "Save" icon
  12. Find the article you wish to add the code (Content > Article Manager > Search)
  13. Whereever you wish to add the php code type {loadposition php-mapcode} (replace php-mapcode with position you choose in step 8. Note, the editor can be on while pasting in this code.
  14. Save.

And viola, you are all set. You can create as many custom modules as you would like this way. Alternatively, their are third party modules that do the same in fewer steps but the process is relatively the same. Remember only install third party modules when absolutely necessary. Most have security holes and you have to make sure you update everytime one is exploited.

Hope this helps.

Cheers, Christopher

0

精彩评论

暂无评论...
验证码 换一张
取 消