1

I want to find if a string contains a word ot not? It is a pretty simple thing if i want to do it in php.But When it comes to EE you need some plugins to do the job of strpos.

I have two plugins streng and phpstringfun.

But both of them have terrible documentation.

{exp:phpstringfun function="strrpos" par1="videos"}Videos/blah/blah{/exp:phpstringfun}

or

{if "{exp:streeng find='this'}This is a test string{/exp:streeng}"}
match exist
{/if}

I get wrong results for both of them.My php stage is input.

1
  • Have you tried putting your PHP in an ExpressionEngine plugin? That would be my recommendation. Happy to write a solution for you, but it sounds like you are capable and just need a pointer to the plugin API. – Derek Jones May 13 '14 at 5:33
1

I ran into trouble with streeng as well on doing just a find in a conditional, but it worked well with find+replace (ee 2.8.1), maybe hit up the developer.

For phpstringfun, in the example you put up you're doing a search for string position that's case sensitive. Try strripos and it should work with your example:

{exp:phpstringfun function="strripos" par1="videos"}Videos/blah/blah{/exp:phpstringfun}

And for an add-on with more documentation try CE String.

2
  • ya i tried what you are saying..but the thing is i dont want to replace anything ...just want to find if it does not exist do something..I feel quite restricted and irritated when it comes to such easy task taking so much effort – user2133 Apr 11 '14 at 14:59
  • Did you see the comment about using strripos with phpstringfun? – Romans-8---31-39 Apr 11 '14 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy