hi !
A very simple hack. It permit to make simple menu links
Add a directory "elements" in "administrator/components/com_chronocontact/"
Add the file "formname.php" in this directory
Add a file "chronocontact.xml" in "components/com_chronocontact/"
And then modify "chronocontact.php"
replace
by
Now you'll create menu link with a list of the elements !
Thanks to add it in the next release ;-)
A very simple hack. It permit to make simple menu links
Add a directory "elements" in "administrator/components/com_chronocontact/"
Add the file "formname.php" in this directory
<?php
// no direct access
defined('_JEXEC') or die('Restricted access');
/**
* Element Formname for Chronocontact
*
* @version $id$
* @package Joomla
* @subpackage Chronocontact
* @license Commercial License
* @author CNSX
*/
/**
* Element Formname
*
* @package Joomla
* @subpackage Chronocontact
*/
class JElementFormname extends JElement {
var $_name = 'Formname';
/**
* Make a param element
*
* @param string $name, element name
* @param string $value, element value
* @param unknown_type $node
* @param string $control_name, HTML name for the element
* @return string, the HTML element
*/
function fetchElement($name, $value, &$node, $control_name) {
$db = &JFactory::getDBO();
$query = "select name as value, name as text FROM #__chrono_contact";
$db->setQuery($query);
$options = $db->loadObjectList();
array_unshift($options, JHTML::_('select.option', '0', '- ' . JText::_('Select a form') . ' -', 'value', 'text'));
return JHTML::_('select.genericlist', $options, '' . $control_name . '[' . $name . ']', 'class="inputbox"', 'value', 'text', $value, $control_name . $name );
}
}
Add a file "chronocontact.xml" in "components/com_chronocontact/"
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="NOM_LAYOUT_CHRONOCONTACT">
<message>
<![CDATA[DESCRIPTION_LAYOUT_CHRONOCONTACT]]>
</message>
</layout>
<state>
<name>NOM_LAYOUT_CHRONOCONTACT</name>
<description>DESCRIPTION_LAYOUT_CHRONOCONTACT</description>
<url addpath="/administrator/components/com_chronocontact/elements">
<param name="chronoformname" type="formname" default="0" label="Sélection d'un formulaire" description="Un formulaire" />
</url>
<params>
</params>
</state>
</metadata>
And then modify "chronocontact.php"
replace
$formname = JRequest::getVar( 'chronoformname', '', 'get', 'string', '' );
by
// get components param
$formname = JRequest::getCmd('chronoformname');
Now you'll create menu link with a list of the elements !
Thanks to add it in the next release ;-)
And don't forget to add translations !
Hi Martin,
Thanks for the code, could you please give more details on the code above what will it do exactly ? a screenshot of the final result expected will be very helpful too!
Thanks!
Max
Thanks for the code, could you please give more details on the code above what will it do exactly ? a screenshot of the final result expected will be very helpful too!
Thanks!
Max
This topic is locked and no more replies can be posted.