Skip to content

Instantly share code, notes, and snippets.

@ribafs
Last active December 29, 2023 13:41
Show Gist options
  • Save ribafs/68d760e745d6c71521c0cf93be1499a2 to your computer and use it in GitHub Desktop.
Save ribafs/68d760e745d6c71521c0cf93be1499a2 to your computer and use it in GitHub Desktop.
Receive param value from xml in php component joomla 4
My XML
<?xml version="1.0" encoding="UTF-8"?>
<extension type="component" version="3.0" method="upgrade">
<name>testepar</name>
<creationDate>Outubro 2023</creationDate>
<author>Ribamar FS</author>
<authorEmail>ribafs@gmail.com</authorEmail>
<authorUrl>https://ribamar.net.br</authorUrl>
<copyright>Copyright (C) 2016 Ribamar FS. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<version>2.0</version>
<description>Componente de teste de envio de parametro Joomla</description>
<administration>
<menu>COM_TESTEPAR</menu>
<files folder="admin">
<filename>testepar.php</filename>
</files>
<config>
<fields name="params">
<fieldset name="backup">
<field name="testepar" default="none" />
</fieldset>
</fields>
</config>
</administration>
</extension>
My PHP
<?php
/**
* @author-name Ribamar FS
*/
defined('_JEXEC') or die('Restricted access');
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$param=JComponentHelper::getParams('com_teste')->get('testepar');
print "OK?";
print $param;
?>
Result
blank page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment