Back to top

Autore Topic: Agg. Parametro Campo testo nel modulo  (Letto 2892 volte)

Offline vincenzo

  • Nuovo arrivato
  • *
  • Post: 5
    • Mostra profilo
Agg. Parametro Campo testo nel modulo
« il: 12 Apr 2008, 20:36:24 »
Ho creato un modulo che si collega a MyShoutBox
e ho la necessità di inserire un campo nei parametri
di amministratore, memorizzarlo e utilizzaro al posto
nel file al posto delle XXXX

 function getMyShoutBox( $params )
    {
          return '<iframe src="http://'.XXXX.'.myshoutbox.com/" width="160" height="600" frameborder="1" allowTransparency="true"></iframe>';
    }
Mi date una mano, vi posto i tre files

helper.php
<?php
/**
 * Helper class for Hello World! module
 *
 * @package    Joomla.Tutorials
 * @subpackage Modules
 * @link http://dev.joomla.org/component/option,com_jd-wiki/Itemid,31/id,tutorials:modules/
 * @license        GNU/GPL, see LICENSE.php
 * mod_helloworld is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 */
class modMyShoutBoxHelper
{
    /**
     * Retrieves the hello message
     *
     * @param array $params An object containing the module parameters
     * @access public
     */   
    function getMyShoutBox( $params )
    {
          return '<iframe src="http://xxxxx.myshoutbox.com/" width="160" height="600" frameborder="1" allowTransparency="true"></iframe>';
    }
}

mod_myshoutbox.php
<?php
/**
 * Hello World! Module Entry Point
 *
 * @package    Joomla.Tutorials
 * @subpackage Modules
 * @link http://dev.joomla.org/component/option,com_jd-wiki/Itemid,31/id,tutorials:modules/
 * @license        GNU/GPL, see LICENSE.php
 * mod_helloworld is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 */

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

// Include the syndicate functions only once
require_once( dirname(__FILE__).DS.'helper.php' );

$hello = modMyShoutBoxHelper::getMyShoutBox( $params );
require( JModuleHelper::getLayoutPath( 'mod_myshoutbox' ) );

mod_myshoutbox.xml
<?xml version="1.0" encoding="utf-8"?>
<install type="module" version="1.5.0">
    <name>MyShoutBox!</name>
    <author>Enzo</author>
    <version>1.5.0</version>
    <description>MyShoutBox</description>
    <files>
        <filename module="mod_myshoutbox">mod_myshoutbox.php</filename>
        <filename>index.html</filename>
        <filename>helper.php</filename>
        <filename>tmpl/default.php</filename>
        <filename>tmpl/index.html</filename>
    </files>
    <params>
    </params>
</install>

Grazie a Tutti
« Ultima modifica: 12 Apr 2008, 21:40:18 da vincenzo »

Offline vincenzo

  • Nuovo arrivato
  • *
  • Post: 5
    • Mostra profilo
[RISOLTO] Agg. Parametro Campo testo nel modulo
« Risposta #1 il: 12 Apr 2008, 21:25:28 »
Ci sono riuscito, ecco come, ma se voglio passare più parametri come faccio?

mod_myshoutbo.xml
<?xml version="1.0" encoding="utf-8"?>
<install type="module" version="1.5.0">
    <name>MyShoutBox!</name>
    <author>Enzo</author>
    <version>1.5.0</version>
    <description>MyShoutBox</description>
    <files>
        <filename module="mod_myshoutbox">mod_myshoutbox.php</filename>
        <filename>index.html</filename>
        <filename>helper.php</filename>
        <filename>tmpl/default.php</filename>
        <filename>tmpl/index.html</filename>
    </files>
    <params>
       <param name="mycode" type="text" default="" label="Code" description="PARAMTEXT" />
    </params>
</install>

mod_myshoutbo.php
<?php
/**
 * Hello World! Module Entry Point
 *
 * @package    Joomla.Tutorials
 * @subpackage Modules
 * @link http://dev.joomla.org/component/option,com_jd-wiki/Itemid,31/id,tutorials:modules/
 * @license        GNU/GPL, see LICENSE.php
 * mod_helloworld is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 */

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

// Include the syndicate functions only once
require_once( dirname(__FILE__).DS.'helper.php' );

$mycode             = $params->get('mycode', JText::_('search...'));
$myshoutbox = modMyShoutBoxHelper::getMyShoutBox( $mycode );
require( JModuleHelper::getLayoutPath( 'mod_myshoutbox' ) );

default.php su cartella tmpl
<?php // no direct access
defined( '_JEXEC' ) or die( 'Restricted access' ); ?>
<?php echo $myshoutbox; ?>

helper.php
<?php
/**
 * Helper class for Hello World! module
 *
 * @package    Joomla.Tutorials
 * @subpackage Modules
 * @link http://dev.joomla.org/component/option,com_jd-wiki/Itemid,31/id,tutorials:modules/
 * @license        GNU/GPL, see LICENSE.php
 * mod_helloworld is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 */
class modMyShoutBoxHelper
{
    /**
     * Retrieves the hello message
     *
     * @param array $params An object containing the module parameters
     * @access public
     */   
    function getMyShoutBox( $mycode )
    {     
          // Test Parametro  echo "eeee".$mycode;
          return '<iframe src="http://'.$mycode.'.myshoutbox.com/" width="160" height="600" frameborder="1" allowTransparency="true"></iframe>';
    }
}
« Ultima modifica: 12 Apr 2008, 21:40:48 da vincenzo »

 



Web Design Bolzano Kreatif