【问题标题】:Call a PHP code on form submit - BreezingForms 1.8.2 Joomla在表单提交上调用 PHP 代码 - BreezingForms 1.8.2 Joomla
【发布时间】:2013-06-12 09:18:12
【问题描述】:

我在 Joomla 中有一个注册页面。我使用 BreezingForms 扩展进行注册。一切正常。

现在,

我想包含我的自定义 PHP 代码并在表单提交时调用一个方法。关于如何做的任何建议?有一个扩展 Jumi 包含代码 sn-p。但是如何在表单提交上调用特定方法并继续现有的表单提交操作(保存在 DB 中)。

<?php function WriteContent() { //My Code } ?>

我想在表单提交时调用 WriteContent。

这里是 Joomla 的详细信息

构建于:Linux

PHP 版本 5.3.18

Joomla!版本 Joomla! 2.5.8 稳定

Joomla 平台 11.4.0

【问题讨论】:

    标签: php joomla


    【解决方案1】:

    我一直在这样做,基本上我将 php 代码粘贴到最后提交文本区域

    这是一个简单而复杂的代码,我用于站点根据表单发布的 k2 额外字段重定向表单。表单包括对 joomla 框架的调用。让我知道您可能需要什么,并将为此构建自定义代码。希望这是一个好的方向。

    require_once("configuration.php");
    $conf = new Jconfig ();
    $base_url = JURI::root();
    $this->execPieceByName('ff_InitLib');
    if(isset($_REQUEST['id'])){
        $state = JRequest::getVar('state');
        $id = JRequest::getVar('id'); 
    // Fetch k2 items extra fields
        $f_rows = ff_select("SELECT `extra_fields` FROM  `".$conf->dbprefix."k2_items` WHERE  `id` =".$id);
        $mfields = $f_rows[0];
        $dfields = $mfields->extra_fields;
        $fields =(array)json_decode($dfields,true);
    
    //Blind Method comented assumed item 2 thus in array position 1 is always the redirection link  
        if (isset($fields[1])) {
            $link = @$fields[1]['value'];
                    }
    
    
    
            $link = addhttp($link);
            if (url_exists($link)) {JFactory::getApplication()->redirect($link);}
    
    
        }// end if isset else go to page 2
    
    
    
    
    //header("location: /index.php?option=com_virtuemart&page=shop.cart");
    
    function addhttp($url) {
        if (!preg_match("~^(?:f|ht)tps?://~i", $url)) {
            $url = "http://" . $url;
        }
        return $url;
    }
    function url_exists($url) {
        if (!$fp = curl_init($url)) return false;
        return true;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-05-20
      • 2016-07-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-29
      • 2019-05-05
      相关资源
      最近更新 更多