0

I have a channel for communities that stores community_name as the 2 letter abbreviation since it is part of the mailing address.

I am trying to build a filtered search but want to display the complete state name rather than its abbreviation.

Where in EE do you put helper functions? In CI, I would just add a file in the system/helpers folder that would hold all of my sitewide functions ( like formatPhone ).

Once I know where to place this very simple function, I also need to know how to display it. Right now I am using <span class="community_state webcam-caption">{community_state}</span> but that would, of course, be the abbreviation.

Thanks in advance, Jon

1 Answer 1

1

Jon,

In EE you can develop a small plugin to display the complete state name. You can have a guide from http://ellislab.com/expressionengine/user-guide/development/plugins.html

For example, you can have plugin tag as {exp:custom_plugin community_state="{community_state}"}

and the plugin code would be like:

class Custom_plugin
{
    public $return_data = "";
    public function __construct()
    {
        $community_state = ee()->TMPL->fetch_param('community_state');
        ########
        Code or query to fetch complete state name with $community_state as $complete_state_name
        ########
        $this->return_data = $complete_state_name;
    }
}

I hope, it would help you.

1
  • You are awesome! Works like a charm and now I know how to create a plug-in. THANKS!!!!!!!!!!
    – jgravois
    May 28, 2013 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.