Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: [MOD] Codetwist's - Adding additional form to sNews (1.6)  (Read 9446 times)

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
[MOD] Codetwist's - Adding additional form to sNews (1.6)
« on: May 23, 2007, 08:16:12 am »

sNews additional form modification Version 1.0 suited for snews version 1.6

Codetwist ran to my aid when I needed an additional form in my sNews project. I wanted to have an additional form on this site. That is a possibility to post an application online (in my case one should be able to apply for a space to keep one's horse ;)). And I needed an additional form rather than adding new fields to the existing contactform. So...

This MOD is based on his Contact form with custom fields (sNews 1.6), and it goes something like this:

Backity up

A "must do" before applying this MOD
1. For this MOD to function following functions should be added (either in snews.php or included from separate php file):
Code: [Select]
function get_contact_fields( $arrFields, &$code, $action ) {
   $strResult = '';
   $code = 0;
   switch ($action) {
      case 'output' :
         foreach ( $arrFields as $fieldDef ) {
            $fieldType    = $fieldDef[0];
            $fieldName    = $fieldDef[1];
            $fieldDefault = '';
            $fieldLabel   = ($fieldDef[3] == 'required') ? '* ' . $fieldDef[2] : $fieldDef[2];
            $fieldCSS     = $fieldType;
            $strResult .= html_input( $fieldType, $fieldName, $fieldName, $fieldDefault, $fieldLabel, $fieldCSS, '', '', '', '', '', '', '', '', '');
         }
         break;
      case 'submit' :
         foreach ( $arrFields as $fieldDef ) {
            $fieldName  = $fieldDef[1];
            $fieldValue = cleanText( $fieldName );
            $fieldLabel = $fieldDef[2];
            $minLength  = $fieldDef[4];
            if (!empty($fieldValue)) {
               if ( $minLength > 0 ) {
                  if ( strlen( $fieldValue ) < $minLength ) {
                     $strResult = '';
                     $code = 2;
                     break;
                  }
               }
               $strResult .= "$fieldLabel: $fieldValue\n\n";
            }
            else if ( $fieldDef[3] == 'required' ) {
               $strResult = '';
               $code = 1;
               break;
            }
         }
         break;
      default :
         break;
   }
   return $strResult;
}


function cleanText( $name ) {
   $str = trim($_POST[$name]);
   $str = clean( cleanXSS( $str ) );
   return $str;
}
Actual modification:
2.  Most modification are done by applying Codetwists new function contact(), so just copy this snippet below  which is that function although changed to fit this MOD (for usage instructions regarding this one, please read ):
Code: [Select]
// APPLICATION FORM
function applform() {
   //
   // Custom fields definition array
   $arrFields   = array();
   // Add custom fields using following definition:
   // $arrFields[] = array("<input type>", "<name>", "<label>", '<required/optional>', '<minlength/0>');
   //
   // Examples.
   // To add mandatory field with label Phone No without string length checking:
   //$arrFields[] = array('text', 'phone', 'Phone No', 'required', 0);
   // To add optional field with label City with checking for minimal string length of 4 symbols:
   //$arrFields[] = array('text', 'city', 'City', 'optional', 4);
   //
    if (!isset($_POST['applform'])) {
        // Display contact form
        echo '<div class="commentsbox"><h2>'.l('applform').'</h2>';
        echo '<p>'.l('required').'</p>';
        echo html_input('form', '', 'post', '', '', '', '', '', '', '', '', '', 'post', db('website'), '');
        echo html_input('text', 'name', 'name', '', '* '.l('name'), 'text', '', '', '', '', '', '', '', '', '');
        echo html_input('text', 'email', 'email', '', '* '.l('email'), 'text', '', '', '', '', '', '', '', '', '');
        echo html_input('text', 'weblink', 'weblink', '', l('url'), 'text', '', '', '', '', '', '', '', '', '');
      //
      // Get output for custom fields
      $strHTML = get_contact_fields( $arrFields, $code, 'output' );
      echo $strHTML;
      //
        echo html_input('textarea', 'message', 'message', '', '* '.l('message'), '', '', '', '', '', '5', '5', '', '', '');
      //
        echo mathCaptcha();
        //
        echo '<p>';
        echo html_input('hidden', 'ip', 'ip', $_SERVER['REMOTE_ADDR'], '', '', '', '', '', '', '', '', '', '', '');
        echo html_input('hidden', 'time', 'time', time(), '', '', '', '', '', '', '', '', '', '', '');
        echo html_input('submit', 'applform', 'applform', l('submit'), '', 'button', '', '', '', '', '', '', '', '', '');
        echo '</p></form></div>';
        $_SESSION[db('website').'applform'] = 0;
    }
    else {
        // Fetch and clean input data from default contact form
        $to = s('website_email');
        $subject = s('contact_subject');
        $name = trim($_POST['name']);
        $name = strlen($name) > 1 ? clean(cleanXSS($name)) : null;
        $mail = trim($_POST['email']);
        $mail = trim($_POST['email']);
        $mail = (strlen($mail) > 7 && preg_match( '/^[A-Z0-9._-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z.]{2,6}$/i' , $mail)) ? clean(cleanXSS($mail)) : null;
        $url = trim($_POST['weblink']);
        $url = (strlen($url) > 8 && strpos($url, '?') === false) ? clean(cleanXSS($url)) : null;
        $message = trim($_POST['message']);
        $message = strlen($message) > 9 ? stripslashes(cleanXSS($message)) : null;
        $message = strip_tags($message);
        $now = is_numeric($_POST['time']) ? $_POST['time'] : null;
        $ip = (strlen($_POST['ip']) < 16) ? clean(cleanXSS($_POST['ip'])) : null;
      //
      // Fetch and clean data from added custom input fields
      $validExtraFields = true;
      $code = 0;
      $strExtraFields = get_contact_fields( $arrFields, $code, 'submit' );
      if ( $code == 1 || $code == 2 ) { // Required fields values missing/invalid
         $validExtraFields = false;
      }
      //
        if($_SESSION[db('website').'applform'] == 0) {
         // Added $validExtraFields to if condition
            if ($ip == $_SERVER['REMOTE_ADDR'] && (time() - $now) > 4 && $name && $mail && $message && mathCaptcha($_POST['calc'], $_POST['sum']) && $validExtraFields) {
                $header = "MIME-Version: 1.0\n";
                $header .= "Content-type: text/plain; charset=".s('charset')."\n";
                $header .= "From: $name <$mail>\r\nReply-To: $name <$mail>\r\nReturn-Path: <$mail>\r\n";
                $addUrl = isset($url) ? l('url').': '.$url."\n\n" : '';
                $body = "Message from: ".$name." <$mail>\n".$addUrl.$strExtraFields.l('message').":\n".$message;
                mail($to, $subject, $body, $header);
                # notify of success
                echo notification(0,l('applform_sent'),'home');
                $_SESSION[db('website').'applform'] = 1;
            }
            else {echo notification(1,l('applform_not_sent'),'applform');}
}}}
3.  Add lang variables:
Quote
$l['applform'] = 'Application';
$l['applform_sent'] = 'Application form sent';
$l['applform_not_sent'] = 'Application form not sent';
4. Find this in lang variables:
Quote
$l['cat_listSEF'] = $l['home_sef'].',archive,contact,sitemap,rss-articles,rss-pages,rss-comments,login,administration,admin_category,admin_article,article_new,extra_new,page_new,categories,articles,extra_contents,pages,settings,files,logout'; //SEF links of the hardcoded categories
5. Add this right after the above:
Quote
$l['cat_listSEF'] .= ',applform'; - Yes, the dot before the = and the comma before applform is supposed to be there ;)
6. Find this in function center():
Quote
case isset($_POST['contactform']): contact(); return; break;
7. Add this right after the above:
Quote
case isset($_POST['applform']): applform(); return; break;
8. Find this in function center():
Quote
case 'contact': contact(); break;
9. Add this right after the above:
Quote
case 'applform': applform(); break;
10. And finally, in order to be able to have this as a page, add this in function pages():
Quote
$class = ($categorySEF == 'applform') ? ' class="current"': '';
echo '<li><a'.$class.' href="'.db('website').'applform/" title="'.l('applform').'">'.l('applform').'</a></li>';
Note:
If you do not want to use it as a page it's probably possible to use it as a function inside an article, but then you'll have to use Philmoz's MOD to accomplish this... And that is this one: [MOD] Function use in articles (snews1.6). However this isn't something I've tested myself, just a notion I got when thinking about it, so be my guest and try that out... ;)

Adding your own fields and stuff:
After applying changes as described above just add extra fields needed to the array $arrFields at the very beginning of modified function contact(). Examples are included in code comments.

And...:
And of course, it's ever so possible to use it as a function inside index.php aswell... Just make a div and place it inside it:
Quote
<div class="SOMEFORM">
<?php applform(); ?>
</div>
Thanks a bunch to Codetwist for his original MOD, and for his help on this one. All credit to him.

DEMO: (all design and layout things aside) http://fagereke.se/applform/ (please do not use it, you'll flood my inbox ;) )
« Last Edit: August 21, 2007, 08:05:23 pm by Phil Martin »
Logged
"It's only dead fish that goes with the flow... "
Updated

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
[MOD] Codetwist's - Adding additional form to sNews (1.6)
« Reply #1 on: May 23, 2007, 08:32:46 am »

Whoaaa ... my precious modie, thx Patric :D

Regarding usage in articles - If I recall right it should be possible to use it in article/page using default [include] tag without additional function call mod (it's not that I object to having function mod handy, too, philmoz).

Create file with following code:
Code: [Select]
<?php
applform
();
?>
Include it in text as usual - and have that form ready to go ;)
« Last Edit: August 21, 2007, 08:06:21 pm by Phil Martin »
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
[MOD] Codetwist's - Adding additional form to sNews (1.6)
« Reply #2 on: May 23, 2007, 08:36:37 am »

Okidoki... I have to try that out...
Logged
"It's only dead fish that goes with the flow... "
Updated

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
[MOD] Codetwist's - Adding additional form to sNews (1.6)
« Reply #3 on: May 23, 2007, 01:31:54 pm »

Yea, it includes alright, but it seems not to be working as it should. I get the error message... Mhm...
well, I was wrong.. You need to be very accurate when filling it in ;)
Logged
"It's only dead fish that goes with the flow... "
Updated

areyouami

  • Newbie
  • *
  • Karma: 3
  • Posts: 24
[MOD] Codetwist's - Adding additional form to sNews (1.6)
« Reply #4 on: August 16, 2007, 12:50:34 am »

Sorry for the double post, but I don't know where to put this:

I installed the contact form mod and another mod that allows for another form, like an application form. Both work great, but I'm not sure how to add new select, radio, and check box form fields. I think the mod(s) only support text and textarea. There's no instructions for adding select fields, radios, and check boxes,

Here's the instructions for adding an additional text field

  
Code: [Select]
$arrFields[] = array('text', 'phone', 'Phone', 'optional', '7');like this:

   // $arrFields[] = array('inputtype', "name-of-field", "label-for-field", 'required/optional', 'min-length>');

But where do I put the information for a select field, as well as check box and radio sets.

Code: [Select]
<label>Type of Project</label>
<select name="select" class="classname">
<option value="Project 1" selected="selected">Type of Project 1</option>
<option value="Project 2">Type of Project 2</option>
<option value="Project 3">Type of Project 3</option>
</select>
Thanks!
« Last Edit: August 21, 2007, 08:07:00 pm by Phil Martin »
Logged

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
[MOD] Codetwist's - Adding additional form to sNews (1.6)
« Reply #5 on: August 16, 2007, 09:22:46 am »

You should be able to add check and radio controls with this by default as this mod uses stock html_input() function ;) I've not tested it - thus, no examples - thus, Your chance to contribute :P

P.S.
As for select control - it's not supported by available html_input() version and if You'll look through snews.php You'll see that selects are built hard way ;)
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
Re: [MOD] Codetwist's - Adding additional form to sNews (1.6)
« Reply #6 on: October 10, 2007, 11:11:06 am »

Ok, a laymans view, and as a swede...

Ok... I have set this up with lang vars so that my labels in the additional form may be set with swedish words containing å ä ö and crap. My next problem here is when the actual mail is sent and it collects the lang vars in order to present the form result in the mail according to the formula:

lang var: inputed value

So, I'm a swede, and in this particular form the label of one inputfield is Hästens namn (the name of the horse), and that shows up as it should in the form (formatted in lang var as: H&#228;stens namn). But when form is submitted and the mail reaches me the result is:

H&#228:stens namn: Patric

That is, the actual lang var I've coded in to make the form show my language specific characters...

1. HOW can I get this to be shown as the actual character ?


Next issue is that all persons using this form might not have an email, nor feel obliged to admit an actual message in the form, so therefor I would like to make them two fields non-required, hehe... or optional, and still making the form send the information...

2. HOW do I make the email and message optional ?


Last, a overcourse (is that even a word in english ?) task... I would like for this application form to have another recipient than the original setting in contact in the administration area of sNews ? Is that possible, or a mear wish ?

3. Another recipient than the original snews contact form.


The actual form: http://fagereke.se/applform

« Last Edit: October 10, 2007, 04:50:29 pm by Patric Ahlqvist »
Logged
"It's only dead fish that goes with the flow... "
Updated

chiskop

  • Full Member
  • ***
  • Karma: 3
  • Posts: 152
    • http://www.chiskop.net
Re: [MOD] Codetwist's - Adding additional form to sNews (1.6)
« Reply #7 on: October 11, 2007, 08:47:23 am »

Hello pittepat :)

1. You need to decode the html special chars -> normal characters.
Have a look at html_entity_decode (for php < 4.3) or htmlspecialchars_decode if your php is greater than 5.0.

So, I guess that the way you'd do this would be to go to the lines:
Code: [Select]
        $message = trim($_POST['message']);
        $message = strlen($message) > 9 ? stripslashes(cleanXSS($message)) : null;
        $message = strip_tags($message);
And below that add
Code: [Select]
$message = html_entity_decode($message);
(Usual disclaimers apply, void where prohibited. Use at own risk etc etc.

2/3. Not sure that I unnerstand what you want to do here. Do you want the emails to get sent to an address other than the admin? Will it be the ssame address each time?
« Last Edit: October 11, 2007, 09:30:16 am by Patric Ahlqvist »
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
Re: [MOD] Codetwist's - Adding additional form to sNews (1.6)
« Reply #8 on: October 11, 2007, 09:24:41 am »

Thanks, Barrrr... But that did not work :( sorry if you've had a lot of thinking put into this, but, alas...

Regarding the 2/3, you're exactly right. I want another email, but the administrative one, and it will be the same all the time, yes.

And that is achieved by (Thanks, Barry) changing this line in the function applform():
Quote
mail($to, $subject, $body, $header);

to:

Quote
mail('anotheremail@adress.com', $subject, $body, $header);
« Last Edit: October 11, 2007, 10:13:42 am by Patric Ahlqvist »
Logged
"It's only dead fish that goes with the flow... "
Updated

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
Re: [MOD] Codetwist's - Adding additional form to sNews (1.6)
« Reply #9 on: October 11, 2007, 04:06:30 pm »

Sooo, number 3 is solved (Marked as red in the following snippet). I was able to get another reciepient for the additional form input, and that's great. Two things remain which I'm not able to solve... So if anyone have input which would make.

1. - The email (already optional btw, somehow) and message optional and not required.

2. - Getting the langvars language specific characters (showing like they should IN the form due to htmlchars in the langvars) to show as the characters they intend... IN the mail that is send from the form.

And if I might add a third thingy here... The Subject of this additional form is currently collected from the default snews contact form... I want to change that into "my own". I will present the entire new function below for more precise example (The line that effects the subject is marked in blue):
Quote

// APPLICATION FORM
function applform() {
   //
   // Custom fields definition array
   $arrFields[] = array('text', 'pers', l('label_pers'), 'required', 10);
   $arrFields[] = array('text', 'adress', l('label_adress'), 'required', 0);
   $arrFields[] = array('text', 'ponr', l('label_ponr'), 'required', 0);
   $arrFields[] = array('text', 'poort', l('label_poort'), 'required', 0);
   //$arrFields[] = array('text', 'tele', '* Hemtelefon  ', 'optional', 0);
   //$arrFields[] = array('text', 'tele', ' Mobiltelefon  ', 'optional', 0);
   $arrFields[] = array('text', 'horsename', l('label_horsename'), 'required', 0);
   $arrFields[] = array('text', 'contest', l('label_contest'), 'required', 0);
   $arrFields[] = array('text', 'horseclass', l('label_horseclass'), 'required', 0);
   $arrFields[] = array('text', 'kindhorse', l('label_kindhorse'), 'required', 0);
   $arrFields[] = array('text', 'tele', 'Betalningsform - Kontant eller Bankgiro  ', 'required', 0);
   // Add custom fields using following definition:
   // $arrFields[] = array("<input type>", "<name>", "<label>", '<required/optional>', '<minlength/0>');
   //
   // Examples.
   // To add mandatory field with label Phone No without string length checking:
   //$arrFields[] = array('text', 'phone', 'Phone No', 'required', 0);
   // To add optional field with label City with checking for minimal string length of 4 symbols:
   //$arrFields[] = array('text', 'city', 'City', 'optional', 4);
   //
    if (!isset($_POST['applform'])) {
        // Display contact form
          //echo '<p class="required">'.l('required').'</p>';
        echo '<div class="commentsbox"><h2>'.l('applform').'</h2>';
        echo '<p class="app_text"><strong>L&#228;s detta f&#246;rst.</strong><br /><br />Detta &#228;r ett standard formul&#228;r Fagereke.se anv&#228;nder sig av vid anm&#228;lning till de olika t&#228;vlingar vi anordnar. Du g&#246;r som f&#246;ljer: <br /><br />
Fyll i alla f&#228;lten om m&#246;jligt. De f&#228;lt som &#228;r angivna med ett * m&#229;ste fyllas i.

<br /><br /> Online anm&#228;lan kan ske fram till kl 16.00 vardagen f&#246;re t&#228;vlingsdagen.<br /><br />

 V&#228;ljer du att betala till v&#229;rt bankgiro (5610-1215), m&#229;ste du betala senast tv&#229; bankdagar innan t&#228;vlingsdagen. Kontant betalning erl&#228;ggs vid ankomst t&#228;vlingsdagen.
</p>';
echo '<p class="app_text"><strong>OBS !</strong> <br /><br />F&#246;r tillf&#228;llet m&#229;ste man dessv&#228;rre ange minst 4 tecken i meddelandef&#228;ltet f&#246;r att kunna
skicka anm&#228;lan, annars skickas inget och du f&#229;r b&#246;rja om. S&#229; se till att bara skriv n&#229;got litet i sista stora f&#228;ltet innan du trycker p&#229; skicka, s&#229; kan vi ta emot
din anm&#228;lan.</p>';

        echo html_input('form', '', 'post', '', '', '', '', '', '', '', '', '', 'post', db('website'), '');
        echo html_input('text', 'name', 'name', '', '* '.l('rider'), 'text', '', '', '', '', '', '', '', '', '');
        echo html_input('text', 'email', 'email', '', ''.l('email'), 'text', '', '', '', '', '', '', '', '', '');
        //echo html_input('text', 'weblink', 'weblink', '', l('url'), 'text', '', '', '', '', '', '', '', '', '');
      //
      // Get output for custom fields
      $strHTML = get_contact_fields( $arrFields, $code, 'output' );
      echo $strHTML;
      //
        echo html_input('textarea', 'message', 'message', '', '*'.l('message'), '', '', '', '', '', '5', '5', '', '', '');
      //
        echo mathCaptcha();
        //
        echo '<p>';
        echo html_input('hidden', 'ip', 'ip', $_SERVER['REMOTE_ADDR'], '', '', '', '', '', '', '', '', '', '', '');
        echo html_input('hidden', 'time', 'time', time(), '', '', '', '', '', '', '', '', '', '', '');
        echo html_input('submit', 'applform', 'applform', l('submit'), '', 'sendbutton', '', '', '', '', '', '', '', '', '');
        echo '</p></form></div>';
        $_SESSION[db('website').'applform'] = 0;
    }
    else {
        // Fetch and clean input data from default contact form
      // added email address - barry - 11.10.07
      // was: $to = s('website_email');
        $contactemail = 'MYEMAIL@DOMAIN.COM';
        $subject = s('contact_subject');
        $name = trim($_POST['name']);
        $name = strlen($name) > 1 ? clean(cleanXSS($name)) : null;
        $mail = trim($_POST['email']);
        $mail = trim($_POST['email']);
        $mail = (strlen($mail) > 7 && preg_match( '/^[A-Z0-9._-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z.]{2,6}$/i' , $mail)) ? clean(cleanXSS($mail)) : null;
        $url = trim($_POST['weblink']);
        $url = (strlen($url) > 8 && strpos($url, '?') === false) ? clean(cleanXSS($url)) : null;
        $message = trim($_POST['message']);
        $message = strlen($message) > 9 ? stripslashes(cleanXSS($message)) : null;
        $message = strip_tags($message);
      // decode html - added barry 11.10.07
      $message = html_entity_decode($message);
      // end
        $now = is_numeric($_POST['time']) ? $_POST['time'] : null;
        $ip = (strlen($_POST['ip']) < 16) ? clean(cleanXSS($_POST['ip'])) : null;
      //
      // Fetch and clean data from added custom input fields
      $validExtraFields = true;
      $code = 0;
      $strExtraFields = get_contact_fields( $arrFields, $code, 'submit' );
      if ( $code == 1 || $code == 2 ) { // Required fields values missing/invalid
         $validExtraFields = false;
      }
      //
        if($_SESSION[db('website').'applform'] == 0) {
         // Added $validExtraFields to if condition
            if ($ip == $_SERVER['REMOTE_ADDR'] && (time() - $now) > 4 && $name && $message && mathCaptcha($_POST['calc'], $_POST['sum']) && $validExtraFields) {
                $header = "MIME-Version: 1.0\n";
                $header .= "Content-type: text/plain; charset=".s('charset')."\n";
                $header .= "From: $name <$mail>\r\nReply-To: $name <$mail>\r\nReturn-Path: <$mail>\r\n";
                $addUrl = isset($url) ? l('url').': '.$url."\n\n" : '';
                $body = "Message from: ".$name." <$mail>\n".$addUrl.$strExtraFields.l('message').":\n".$message;
            // don't forget that I changed the var name $to -> $contactemail
            //was: mail($to, $subject, $body, $header);
                mail($contactemail, $subject, $body, $header);
             # notify of success
                echo notification(0,l('applform_sent'),'home');
                $_SESSION[db('website').'applform'] = 1;
            }
            else {echo notification(1,l('applform_not_sent'),'applform');}
}}}



Lang vars being used:
Quote
       
#Application
         $l['applform_not_sent'] = 'Intet skickat';
         $l['application'] = 'Box ans&#246;kan';
         $l['info'] = 'Annan information, nuvarande stall, vanor/ovanor os v';
         $l['applform'] = 'Anm&#228;lan till t&#228;vling';
         $l['applform_sent'] = 'T&#228;vlingsanm&#228;lan skickad...';
         $l['label_name'] = 'Kontaktar er om';
         $l['label_pers'] = 'Personnummer (skrivs: 1234560000)';
         $l['label_adress'] = 'Gatuadress';
         $l['label_ponr'] = 'Postnummer';
         $l['label_poort'] = 'Postort';
         $l['label_horsename'] = 'H&#228;stens namn';
         $l['label_horserase'] = 'H&#228;stras';
         $l['label_contest'] = 'T&#228;vlingsdag (ange datum)';
         $l['label_horseclass'] = 'Jag vill delta i klass/erna';
         $l['label_kindhorse'] = 'Vilken typ av h&#228;st ';
         $l['rider'] = 'Namn';
Logged
"It's only dead fish that goes with the flow... "
Updated

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
Re: [MOD] Codetwist's - Adding additional form to sNews (1.6)
« Reply #10 on: October 11, 2007, 05:29:53 pm »

Awsome, Bob. Thanks... imagen that it's so easy when you know stuff, eh ?
Logged
"It's only dead fish that goes with the flow... "
Updated

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Re: [MOD] Codetwist's - Adding additional form to sNews (1.6)
« Reply #11 on: October 11, 2007, 07:34:31 pm »

Why those characters should be encoded that way? Like the old plain utf-8 doesn't get through or what?
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
Re: [MOD] Codetwist's - Adding additional form to sNews (1.6)
« Reply #12 on: October 12, 2007, 07:56:26 am »

Hey, codie... Sorry, I don't get what you mean... But I'll give it a shot explaining my starting point.

- I have the index as utf-8 aswell as snews is doing utf-8.
- All language specific characters like å ä ö (and similar) I have to code like ä in the snews langvars in order for them to show up as å ä ö on the index.php (example is the <p> tags in the code above) or the characters end up like ?.

So far so good, but when, as now, I want to "re-get" those langvars, hehe... "re-get" a new english word. anyhow, when I have presented them on the index.php by adding a langvar coded with eg ä and I need this form to go get them again in order to present them in the sent email, the function applform() gets the actual langvar, as in "Hästens namn" instead of reading it like index do, and transform the langvar into the "correct" "Hästens namn".

Why this happens is not the issue to me right now. It has always been this way. Agent tried to convince me of the better in using the lang file, and make snews go get the swedish lang file if this was entered. but I never got that to work how hard I tried, so I'm currently stuck with coding HTMLchars whenever I need an å ä ö.
Logged
"It's only dead fish that goes with the flow... "
Updated

jlhaslip

  • Sr. Member
  • ****
  • Karma: 16
  • Posts: 374
    • My snews with AEF Forum site
Re: [MOD] Codetwist's - Adding additional form to sNews (1.6)
« Reply #13 on: October 12, 2007, 09:29:51 am »

Are the special characters being converted by the cleaning functions in the sNews.php?
Logged
Yes! I have no siggy.

Sven

  • ULTIMATE member
  • ******
  • Karma: 88
  • Posts: 2029
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
How would you?
« Reply #14 on: December 05, 2007, 11:54:50 am »

Hi dudettes and dudes,
I'm gonna implement (soon)  this needed Mod in both sNews versions (SU and MU).
I see a problem in the way I want to use it.
My goal is to display a quick contact form in the sideboxes column embedded into an extrabox. But I do need to keep the contact page, so, this is my question:
how can I avoid this quick form being displayed when on the contact page?
(as I won't need 2 forms on the same page where form elements gonna have same IDs)
Using an extra-template for this page?
What's the best solution you think?

Roger. ;)
Pages: [1] 2