Einzelnen Beitrag anzeigen
  #1  
Alt 26.02.2018, 09:19:08
meckermohrli meckermohrli ist offline
Anfänger
 
Registriert seit: Feb 2018
Alter: 45
Beiträge: 5
meckermohrli befindet sich auf einem aufstrebenden Ast
Formular erweitern

Hallo,

ich hoffe hier Hilfe zu bekommen. Mit PHP bin ich leider nicht so bewandert, also ein Anfänger.
Ich möchte gern ein vorhandenes Formular um das Feld Anrede (Herr oder Frau) erweitern, weiß aber nicht so recht wie.
Könnt ihr mir bitte helfen ?

(wegen Größenbeschränkung leider in 2 Teilen)

PHP-Code:
<?php

/**
 * @package SP Page Builder
 * @author JoomShaper http://www.joomshaper.com
 * @copyright Copyright (c) 2010 - 2016 JoomShaper
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
 */
//no direct accees
defined('_JEXEC') or die('restricted aceess');

class 
SppagebuilderAddonAjax_contact extends SppagebuilderAddons {

    public function 
render() {

        
$class = (isset($this->addon->settings->class) && $this->addon->settings->class) ? $this->addon->settings->class '';
        
$title = (isset($this->addon->settings->title) && $this->addon->settings->title) ? $this->addon->settings->title '';
        
$heading_selector = (isset($this->addon->settings->heading_selector) && $this->addon->settings->heading_selector) ? $this->addon->settings->heading_selector 'h3';

        
// Addon options
        
$recipient_email = (isset($this->addon->settings->recipient_email) && $this->addon->settings->recipient_email) ? $this->addon->settings->recipient_email '';
        
$from_email = (isset($this->addon->settings->from_email) && $this->addon->settings->from_email) ? $this->addon->settings->from_email '';
        
$from_name = (isset($this->addon->settings->from_name) && $this->addon->settings->from_name) ? $this->addon->settings->from_name '';
        
$formcaptcha = (isset($this->addon->settings->formcaptcha) && $this->addon->settings->formcaptcha) ? $this->addon->settings->formcaptcha '';
        
$captcha_type = (isset($this->addon->settings->captcha_type)) ? $this->addon->settings->captcha_type 'default';
        
$captcha_question = (isset($this->addon->settings->captcha_question) && $this->addon->settings->captcha_question) ? $this->addon->settings->captcha_question '';
        
$captcha_answer = (isset($this->addon->settings->captcha_answer) && $this->addon->settings->captcha_answer) ? $this->addon->settings->captcha_answer '';
        
$button_text JText::_('COM_SPPAGEBUILDER_ADDON_AJAX_CONTACT_SEND');
        
$use_custom_button = (isset($this->addon->settings->use_custom_button) && $this->addon->settings->use_custom_button) ? $this->addon->settings->use_custom_button 0;
        
$button_class = (isset($this->addon->settings->button_type) && $this->addon->settings->button_type) ? ' sppb-btn-' $this->addon->settings->button_type ' sppb-btn-success';

        if (
$use_custom_button) {
            
$button_text = (isset($this->addon->settings->button_text) && $this->addon->settings->button_text) ? $this->addon->settings->button_text JText::_('COM_SPPAGEBUILDER_ADDON_AJAX_CONTACT_SEND');
            
$button_class .= (isset($this->addon->settings->button_size) && $this->addon->settings->button_size) ? ' sppb-btn-' $this->addon->settings->button_size '';
            
$button_class .= (isset($this->addon->settings->button_shape) && $this->addon->settings->button_shape) ? ' sppb-btn-' $this->addon->settings->button_shape ' sppb-btn-rounded';
            
$button_class .= (isset($this->addon->settings->button_appearance) && $this->addon->settings->button_appearance) ? ' sppb-btn-' $this->addon->settings->button_appearance '';
            
$button_class .= (isset($this->addon->settings->button_block) && $this->addon->settings->button_block) ? ' ' $this->addon->settings->button_block '';
            
$button_icon = (isset($this->addon->settings->button_icon) && $this->addon->settings->button_icon) ? $this->addon->settings->button_icon '';
            
$button_icon_position = (isset($this->addon->settings->button_icon_position) && $this->addon->settings->button_icon_position) ? $this->addon->settings->button_icon_position 'left';

            if (
$button_icon_position == 'left') {
                
$button_text = ($button_icon) ? '<i class="fa ' $button_icon '"></i> ' $button_text $button_text;
            } else {
                
$button_text = ($button_icon) ? $button_text ' <i class="fa ' $button_icon '"></i>' $button_text;
            }
        }

        
$output '<div class="sppb-addon sppb-addon-ajax-contact ' $class '">';

        if (
$title) {
            
$output .= '<' $heading_selector ' class="sppb-addon-title">' $title '</' $heading_selector '>';
        }

        
$output .= '<div class="sppb-ajax-contact-content">';
        
$output .= '<form class="sppb-ajaxt-contact-form">';

        
$output .= '<div class="sppb-row">';

        
$output .= '<div class="sppb-col-sm-6">';
        
$output .= '<div class="sppb-form-group">';
        
$output .= '<input type="text" name="name" class="sppb-form-control" placeholder="' JText::_('COM_SPPAGEBUILDER_ADDON_AJAX_CONTACT_NAME') . '" required="required">';
        
$output .= '</div>';
        
$output .= '</div>';

        
$output .= '<div class="sppb-col-sm-6">';
        
$output .= '<div class="sppb-form-group">';
        
$output .= '<input type="email" name="email" class="sppb-form-control" placeholder="' JText::_('COM_SPPAGEBUILDER_ADDON_AJAX_CONTACT_EMAIL') . '" required="required">';
        
$output .= '</div>';
        
$output .= '</div>';
        
$output .= '<div class="sppb-col-sm-12">';
        
$output .= '<div class="sppb-form-group">';
        
$output .= '<input type="text" name="subject" class="sppb-form-control" placeholder="' JText::_('COM_SPPAGEBUILDER_ADDON_AJAX_CONTACT_SUBJECT') . '" required="required">';
        
$output .= '</div>';
        
$output .= '</div>';

        
$output .= '</div>'//.row

        
if ($formcaptcha && $captcha_type == 'default') {
            
$output .= '<div class="sppb-form-group">';
            
$output .= '<input type="text" name="captcha_question" class="sppb-form-control" placeholder="' $captcha_question '" required="required">';
            
$output .= '</div>';
        }

        
$output .= '<div class="sppb-form-group">';
        
$output .= '<textarea name="message" rows="5" class="sppb-form-control" placeholder="' JText::_('COM_SPPAGEBUILDER_ADDON_AJAX_CONTACT_MESSAGE') . '" required="required"></textarea>';
        
$output .= '</div>';

        
$output .= '<input type="hidden" name="recipient" value="' base64_encode($recipient_email) . '">';
        
$output .= '<input type="hidden" name="from_email" value="' base64_encode($from_email) . '">';
        
$output .= '<input type="hidden" name="from_name" value="' base64_encode($from_name) . '">';

        if (
$formcaptcha && $captcha_type == 'default') {
            
$output .= '<input type="hidden" name="captcha_answer" value="' md5($captcha_answer) . '">';
        } elseif (
$formcaptcha && $captcha_type == 'gcaptcha') {
            
JPluginHelper::importPlugin('captcha''recaptcha');
            
$dispatcher JDispatcher::getInstance();
            
$dispatcher->trigger('onInit''dynamic_recaptcha_' $this->addon->id);
            
$recaptcha $dispatcher->trigger('onDisplay', array(null'dynamic_recaptcha_' $this->addon->id'class="sppb-dynamic-recaptcha"'));

            
$output .= (isset($recaptcha[0])) ? $recaptcha[0] : '<p class="sppb-text-danger">' JText::_('COM_SPPAGEBUILDER_ADDON_AJAX_CONTACT_CAPTCHA_NOT_INSTALLED') . '</p>';
        }

        
$output .= '<input type="hidden" name="captcha_type" value="' $captcha_type '">';
        
$output .= '<button type="submit" id="btn-' $this->addon->id '" class="sppb-btn' $button_class '"><i class="fa loading"></i> ' $button_text '</button>';

        
$output .= '</form>';

        
$output .= '<div style="display:none;margin-top:10px;" class="sppb-ajax-contact-status"></div>';

        
$output .= '</div>';

        
$output .= '</div>';

        return 
$output;
    }

    public static function 
getAjax() {

        
$input JFactory::getApplication()->input;
        
$mail JFactory::getMailer();

        
$showcaptcha false;
Mit Zitat antworten