We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

email encoding and textile issue

Development and Programming

lithiumdave's avatar
lithiumdave
215 posts
17 years ago
lithiumdave's avatar lithiumdave

I’m surprised that only a few other people seem to have run into this issue…

I have Textile formatting set for a custom field. If I use the ‘email’ button to create an email address, the output to the page is rendered by Textile, showing entities for the opening and closing quote marks.

An example:

{encode="[email protected]" title="Email us"}

is output as:

“Email us”

Now if I manually remove the quote marks:

{[email protected] title=Email us}

then encoding still works and the quote mark entities aren’t displayed, which is great! Problem solved.

However, I can’t expect a client to do this unfortunately :(

I’ve scoured the core files to see if I can turn off the default quote marks appearing when using the ‘email’ button, but so far without success.

Can anyone help? I don’t mind hacking the CP files as long as I know where to do it : )

Thanks very much indeed

       
Derek Allard's avatar
Derek Allard
3,168 posts
17 years ago
Derek Allard's avatar Derek Allard

Since textile is third party, I’m going to move this to plugins for you and see if I can’t get some eyeballs on it for you.

       
lithiumdave's avatar
lithiumdave
215 posts
17 years ago
lithiumdave's avatar lithiumdave

Thanks Derek : )

       
stillmovingdesign's avatar
stillmovingdesign
35 posts
17 years ago
stillmovingdesign's avatar stillmovingdesign

Depending on whether you have your weblog field set to ‘textile’ or if you have your field wrapped {exp:textile}{/exp:textile}.

If your field is wrapped in your template you can exclude your email address in the entry like this:

==Email: {encode="[email protected]" title="[email protected]"}==

       
lithiumdave's avatar
lithiumdave
215 posts
17 years ago
lithiumdave's avatar lithiumdave

No, the field is set to Textile actually, and it’s not me who’ll be placing the email addresses into entries, it’s my clients who can just about manage to click the email button, I certainly can’t ask them to do anything else (hence why i can’t ask them to simply delete the double quotes).

Thanks for the suggestion tho 😊

       
lithiumdave's avatar
lithiumdave
215 posts
17 years ago
lithiumdave's avatar lithiumdave

There’s line 5568 of cp.publish.php which I’ve altered to:

var Link = ‘{' + 'encode=' + Email + ' title=' + Title + '}’;

basically removing the double quotes, but that doesn’t seem to have any effect, it’s still being output with double quotes.

Any help appreciated 😊

(By the way, I’m not sure this post is suitable for the plugins forum? Although it’s Textile that’s mangling the double quotes, it’s only doing its job. I’m happy to find a way to stop the double quotes from being output in the first place, which is an issue with the system itself, not a plugin. It’s a hack, but a hack I’m happy to perform in this case. Thanks.)

       
lithiumdave's avatar
lithiumdave
215 posts
17 years ago
lithiumdave's avatar lithiumdave

For posterity - the problem’s fixed. Turns out the reason my changes to cp.publish.php weren’t having any effect is due to a peculiarity with the client’s hosting set up (permissions I think…). With that fixed the problem is solved.

Cheers.

       
PhilBrienesse's avatar
PhilBrienesse
185 posts
16 years ago
PhilBrienesse's avatar PhilBrienesse

I’m actually haveing the same email encode and textile issue. Haven’t had this issue on any other site. What was the problem with the hosting setup that solved the problem?

       
lithiumdave's avatar
lithiumdave
215 posts
16 years ago
lithiumdave's avatar lithiumdave

If I remember rightly, it was simply that the changes I made to cp.publish.php actually weren’t being written to the server. I only had read only permissions with the FTP login I was given, or something like that. Once I actually managed to login with the ability to write (and thus make that change to that file) it all worked smoothly.

Having said that, I know that changes were made recently to the Typography class in EE (since version 1.6.5? Not sure…) which might be complicating the issue now. I know quite a few Textile-related issues have cropped up since then. I’m not able to comment on those unfortunately.

       
outline4's avatar
outline4
271 posts
16 years ago
outline4's avatar outline4

hi there,

I ran into some issues with email encoding and textile. some infos: - I’ve turned off the automatic link and email creation. - I’m on EE 1.6.7

I’ve set up a test weblog and it only happens on the textile fields (the ones surrounded by {exp: textile }): www.mountain-ranch.ch/test/

SUMMARY the summary field is xhtml -> everything works as expected

BODY this field is set to textile syntax in the publish form: [email protected]

EXTENDED 1 this field is set to textile syntax in the publish form: =={ encode="[email protected]" title="Email us"}==

EXTENDED 2 this field is set to textile syntax in the publish form: [email protected]==

EXTENDED 3 this field is set to textile syntax in the publish form: ==[email protected]==

I keep getting the “javascript must be enabled” text! please take a look at the source aswell… textile is killing the javascript!

please help! how should I proceed? I really like this textile thinggy…! and I’ve already set up the whole site with it!

cheers stefan

       
PhilBrienesse's avatar
PhilBrienesse
185 posts
16 years ago
PhilBrienesse's avatar PhilBrienesse

I am not sure I understand what your problem is exactly but here is what I have found is working awesome with textile. Get the TEH extension (textile editor helper). In the settings for the extension use the encode pmachine emails. Make sure you have the default formatting for the field set to textile. DO NOT use {exp:textile}{body}{/exp:textile} in your templates. This seems to cause some sort of conflict. If you have the formatting set to textile that is enough.

On a bonus side note the TEH bar is such a versatile extension that I have been able to add more buttons with it that do things like output code for links to open in new windows using javascript, have and image that the client can enter a small size for it then uses php thumb to create the small version and links it to the full size in a new window.

Hope that helps.

Ooops I forgot I usually hide the standard ee formating bar after that.

       
outline4's avatar
outline4
271 posts
16 years ago
outline4's avatar outline4
I am not sure I understand what your problem is exactly but here is what I have found is working awesome with textile. Get the TEH extension (textile editor helper). In the settings for the extension use the encode pmachine emails. Make sure you have the default formatting for the field set to textile. DO NOT use {exp:textile}{body}{/exp:textile} in your templates. This seems to cause some sort of conflict. If you have the formatting set to textile that is enough. On a bonus side note the TEH bar is such a versatile extension that I have been able to add more buttons with it that do things like output code for links to open in new windows using javascript, have and image that the client can enter a small size for it then uses php thumb to create the small version and links it to the full size in a new window. Hope that helps. Ooops I forgot I usually hide the standard ee formating bar after that.

you made my day man! after just elimenating the {exp:textile} tag everything worked as expected! I will shurely try out the TEH extention. thank for pointing me out..!

cheers stefan

       
PhilBrienesse's avatar
PhilBrienesse
185 posts
16 years ago
PhilBrienesse's avatar PhilBrienesse

I’ve received so much help and advice off of these forums that it’s about time I was able to help out someone else. Glad to hear it fixed the problem.

       
outline4's avatar
outline4
271 posts
16 years ago
outline4's avatar outline4
I’ve received so much help and advice off of these forums that it’s about time I was able to help out someone else. Glad to hear it fixed the problem.

hi again, would you mind sharing the code for making a link that opens a new window (target=” _blank”)… I didn’t really understand how to costomize the thing… otherwhise I really like TEH!

cheers stefan

       
PhilBrienesse's avatar
PhilBrienesse
185 posts
16 years ago
PhilBrienesse's avatar PhilBrienesse

The file you need to edit is in the TEH directory wherever you put that and is called textile-editor-config.js Please read the whole post before doing this and backup your file. Also I couldn’t get the onclick to show up in the code it was getting stripped out so i changed it to nclick where ever you see nclick in the below code change to onclick. I am by no means an expert on any of this stuff so please don’t ask me alot of complicated questions about how this works. I just saw a pattern in the code of the plugin and worked it to my advantage. The real credit goes to the extension author ImageHat

Open the file in your favorite editor.

near line 25 you will find this code.

// Add the new custom buttons
teButtons.push(new TextileEditorButtonSeparator(''));
teButtons.push("<button id=\"ed_link\" nclick=\"addLink(this, 'link');return false;\" class=\"standard\"><img src=\""+teh_options.image_path+"world_link.png\" title=\"Link\" alt=\"Link\" ></button>");

after that code and before the code regarding emails enter this addition

// phil added these popup buttons 
teButtons.push("<button id=\"ed_pop\" nclick=\"addLink(this, 'pop');return false;\" class=\"standard\"><img src=\""+teh_options.image_path+"world_link_new.png\" title=\"Link, opens in new window\" alt=\"Link\" ></button>");
teButtons.push("<button id=\"ed_popimage\" nclick=\"addLink(this, 'popimage');return false;\" class=\"standard\"><img src=\""+teh_options.image_path+"popupimage.png\" title=\"Thumbnail + Popup\" alt=\"Link\" ></button>");
//end addition

then look further down the code around line 110 you will find case ‘email’:

create some space before this and paste in the following

// Phil added this for pop up windows      
        case 'pop':
          var link = prompt("Enter a URL to open in a new window: ", "http://");
            if (link == "http://" || link == "" || link == null) return false;
            
            if (textSelected) {
                link = '<a href="http://%27+link+%27" title="opens in a new window">'+myField.value.substring(startPos, endPos)+'</a>';    
            } else {
                link = '<a href="http://%27+link+%27" title="opens in a new window">Link Text Goes Here</a>';    
            }
                
            break;    
            
        case 'popimage':
          var link = prompt("Enter the image code form the Grab Code Field: ", "");
            var size = prompt("Enter the size in pixels for the small image: ", "150");
            if (link == "http://" || link == "" || link == null) return false;
            
            if (size) {
                link = '<a href="http://%27+link+%27" title="full size image">/system/utilities/phpThumb/phpThumb.php?src=</a>';    
            } else {
                link = '<a href="http://%27+link+%27" title="full size image">/system/utilities/phpThumb/phpThumb.php?src=</a>';    
            }
                
            break;            
            
// end phils addition

These examples are also using a few other things to make them work. One is a small bit of script in the head of your template or in an external file to make the popup work. It is as follows…

<script type="text/javascript">

var newwindow;
function pop(url)
{
    newwindow=window.open(url,'name','toolbar=yes,scrollbars=yes,location=yes,status=yes,menubar=yes,resizable=yes,width1024,height=768');
    if (window.focus) {newwindow.focus()}
}

</script>

This makes the link or image open in a new window. You can change the attributes if you like.

The other things being used is phpthumb which allows the client to enter a size for the image and it will be dynamically resized from the stored version. I won’t give instructions here on how to use phpThumb since there is lots of info on the net. The last part is you will notice the prompt text says “Enter the image code from the Grab Code Field”. I use moxie codes file manager combined with Leevi Graham’s plugin to have a field that contains the location of the image they would like to use. If you are not using these you could change that to enter the url or location of image or something like that. Important part is they enter a full url to the image.

Also you will need to add a couple of graphics for the new buttons.

I think looking at those examples you can also see how you could manipulate this for your own needs.

Hope that helps.

If that is all too confusing, click on my profile link and email me what you want your button to do and I will send you a file to replace the config file with.

Phil

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.