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

Help converting a single quote in an entry title

Development and Programming

summitpr's avatar
summitpr
24 posts
15 years ago
summitpr's avatar summitpr

I am trying to to convert the HTML Entity that is returned by the {title} variable back into the character it is supposed to be. I am rendering the template in plain text so it isn’t going to be converted by the browser. I am writing a plug-in that would do this conversion in the template but am having a hard time finding out how to convert the specific value for the single quote.

The following is the value coming back in the {title} variable and doesn’t convert back:

echo html_entity_decode("’",ENT_QUOTES);

This works:

echo html_entity_decode("'",ENT_QUOTES);

Moved to Development and Programming by Moderator

       
summitpr's avatar
summitpr
24 posts
15 years ago
summitpr's avatar summitpr

Is there a built in function available in EE to do this conversion back and forth? Is there kind of helper class I can load into my plugin to do this conversion?

       
John Henry Donovan's avatar
John Henry Donovan
12,339 posts
15 years ago
John Henry Donovan's avatar John Henry Donovan

summitpr,

Is there a built in function available in EE to do this conversion back and forth? Is there kind of helper class I can load into my plugin to do this conversion?

Take a look here system\codeigniter\system\helpers\typography_helper.php

Does that help?

       
summitpr's avatar
summitpr
24 posts
15 years ago
summitpr's avatar summitpr

I think this is exactly what I need, however it does lead me to another question. You’ll have to forgive me, I have yet to really develop any extensions for EE2 though I have done some with EE1.

My new question is now how do I go about using the CI code in my plugin? What is the proper way to leverage the CI helper inside my plugin? I have looked online, with little success, to find resources on how to do this. Thanks for all your help!

Jeremy

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
15 years ago
Sue Crocker's avatar Sue Crocker

Hi, Jeremy. This part of the question would be better suited in the Development forum.. moving there for additional community support.

       
summitpr's avatar
summitpr
24 posts
15 years ago
summitpr's avatar summitpr
summitpr, Take a look here system\codeigniter\system\helpers\typography_helper.php

This does look like what I need, but I don’t know how to call the entity_decode method in that file. I think that is my last little hang-up I try to do it using $this->EE-typography->entity_decode($str); but it errors and says that it isn’t a method the other methods work, but I am clearly not following this for some reason…

       
Greg Aker's avatar
Greg Aker
6,022 posts
15 years ago
Greg Aker's avatar Greg Aker

Jeremy,

Have you looked through any CI tutorials? You can think of your plugin as basically a CI controller with a few more restrictions. But, you can load any available CI helpers or libraries, etc, with $this->EE->load->helper(‘helper_name’); or $this->EE->load->library(‘library_name’); etc.

       
summitpr's avatar
summitpr
24 posts
15 years ago
summitpr's avatar summitpr

Ok, well I think that makes sense! I will work on getting this character converted back to its original self! Thanks for your help! I will post back with my results!

       

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.