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

Plugin development

Development and Programming

Crnaovca's avatar
Crnaovca
627 posts
about 17 years ago
Crnaovca's avatar Crnaovca

I am trying something so I am interested if somebody knows answer. I am developing plugin that is currently calling hello_world 😊 because it is just a test.

So, problem is here. Can I do this in template?

{exp:hello_world:search tekst={maintext}}

so to have plugin that checks text of weblog that is currently displaying…

and to get that text and find some specific string in it … for example “””

any idea? can it be done this way? is there a better way? Since, data are displayed already, it seems stupid to do SQL query based on data to get that text from database, since it is already done ….

P.S.: anyone have any simple plugin that works? I need the most basic one, like hello world.

       
fostermade's avatar
fostermade
97 posts
about 17 years ago
fostermade's avatar fostermade

Here’s a super simple plugin: http://expressionengine.com/downloads/details/word_limiter/

       
Derek Jones's avatar
Derek Jones
7,561 posts
about 17 years ago
Derek Jones's avatar Derek Jones

The example in the user guide is also very straightforward, and discusses what each portion of a plugin class is for. ExpressionEngine also comes with 4 very simple plugins pre-installed: Character Limiter, Randomizer, Word Limit, and XML Encode.

       
Crnaovca's avatar
Crnaovca
627 posts
about 17 years ago
Crnaovca's avatar Crnaovca

{exp:hello_world:search tekst={maintext}} and what about this ? can this be done in such way?

       
Derek Jones's avatar
Derek Jones
7,561 posts
about 17 years ago
Derek Jones's avatar Derek Jones

All attributes must be quoted:

{exp:hello_world:search tekst="{maintext}"}

However, if that content could contain quotes itself, say if {maintext} were that’s “super”!, then you’d end up with an invalid tag:

{exp:hello_world:search tekst="that's "super"!"}

When processing content from custom fields, it’s best to not use single-tag plugins, and to use paired tags and access the tagdata.

{exp:hello_world:search}{maintext}{/exp:hello_world}

The full contents of {maintext} would then be available to your template with $TMPL->tagdata.

       

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.