Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2005-11-21 14:35:22

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: [wiki] Draft: Expanded zem_contact use/modification docs

Jeremie wrote: The best way to do this wouldn’t to post an updated version of the plugin, more accessible, bug free (hoping), and easily translatable ? So that anyone can begin working with it cleanly ?

You would think so, and the right place to be voicing it (as if I need to tell you) is there. The point of this thread is to to make it easier in the meantime…

However, zem_contact hasn’t changed in a while, so it’s necessary for new users of the plugin to squash a few bugs (or make a few modifications) before putting it to trouble-free use (or for using it in particular ways).” — first post

Offline

#14 2005-11-21 22:35:15

jdykast
Member
From: Tennessee
Registered: 2004-12-30
Posts: 119
Website

Re: [wiki] Draft: Expanded zem_contact use/modification docs

maniqui – I put those lines just beneath the area where the rest of the variables where set at about line 13. I don’t think it matters as long as it is posted before the new lines that actually do the work of either sending the visitor to the new location or parsing through the <code>thanksform</code>.

Offline

#15 2005-11-22 19:19:58

jdykast
Member
From: Tennessee
Registered: 2004-12-30
Posts: 119
Website

Re: [wiki] Draft: Expanded zem_contact use/modification docs

Keeping Checkboxes Checked

By default zem_contact does not mark a checkbox checked if there where errors when the form was processed. This can be a problem if people don’t think to re-check any boxes that had been previously selected. A website I was working with asked if I could fix that and here is the solution I worked up.

In the zem_contact_checkbox function, before the line that reads
<pre>$l = ($required ? “&lt;b&gt;$label&lt;/b&gt;” : $label);</pre>

add the following:
<pre> if (!$checked) $tagEnd = ($_REQUEST[$name]) ? ‘ checked=“checked” />’ : ‘ />’;
</pre>

Then replace
<pre>return ‘&lt;input type=“checkbox” name=”’.$name.’”’. ($checked ? ‘ checked=“true”’ : ‘’). ‘&gt;’. ‘&lt;label for=”’.$name.’”&gt;’.$l.’&lt;/label&gt;’. $break;
</pre>

With
<pre>return ‘&lt;input type=“checkbox” name=”’.$name.’” id=”’.$name.’”’. $tagEnd. ‘&lt;label for=”’.$name.’”&gt;’.$l.’&lt;/label&gt;’. $break;
</pre>

Also, this new code also makes checkboxes and their labels XHTML strict compliant because a label must point to a form element with an <code>id</code> attribute. If there is a better way of doing things I’m ready to listen.

As a side note, is there a better way to post code than what I’m doing? It took me 25 minutes to get a few lousy lines of code to show rather than what they code for (that is, the word “input” rather than an actual input element).

Last edited by jdykast (2005-11-22 19:30:09)

Offline

#16 2005-11-26 05:32:46

boblet
Member
Registered: 2005-08-08
Posts: 53

Re: [wiki] Draft: Expanded zem_contact use/modification docs

Excellent Destry! This is da bomb.

I’ll add info on how I’ve internationalized zem_contact when (if?) I can figure out my kanji and $name problem (basically just a bunch of additional variables for all the plugin’s messages)

peace – boblet

Offline

#17 2005-11-30 10:07:49

Finnish
Member
From: Russia, Vladivostok
Registered: 2005-11-02
Posts: 13

Re: [wiki] Draft: Expanded zem_contact use/modification docs

hi all. i’ve managed to solve some problem concerned with garbling non-english input.
just edit the plugins code and replace 2 occasions of “htmlentities(” with “htmlspecialchars(“. there’re only 2 of them in v.0.6
have a nice day.


have a nice day :)

Offline

#18 2005-12-02 12:29:41

boblet
Member
Registered: 2005-08-08
Posts: 53

Re: [wiki] Draft: Expanded zem_contact use/modification docs

OK I finished writing up how I butchered .. umm modified zem_contact for i18n among other things (pretty much everything above). It’s working for me, so I’ve added a link to my copy. Have fun!

peace – boblet

Offline

#19 2005-12-13 19:36:24

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: [wiki] Draft: Expanded zem_contact use/modification docs

In case you missed it, anyone, there’s zem_contact remodeling going on.

Offline

Board footer

Powered by FluxBB