0

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

现在,

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

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

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

这是Joomla的详细信息

建立在:Linux

PHP 版本 5.3.18

Joomla!版本 Joomla!2.5.8 稳定

Joomla 平台 11.4.0

4

1 回答 1

0

I have been doing this and basically i paste the php code on end submit text area

Here is a simple and complex code i use for a site to redirect the form based on k2 extra field oon which the form was published.. The form includes a call to joomla framework. Let me know what you may need and will build you a custom code for that. Hope this is a good direction.

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;
}
于 2013-08-14T13:34:07.937 回答