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: PHPStringFun

Development and Programming

Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

Hi Andy,

Just gave it a try here and couldn’t get it to work but I am wondering looking at the documentation page on php.net for money_format and seeing these notes :

Note: The function money_format() is only defined if the system has strfmon capabilities. For example, Windows does not, so money_format() is undefined in Windows. Note: The LC_MONETARY category of the locale settings, affects the behavior of this function. Use setlocale() to set to the appropriate default locale before using this function.

Wonder if those have anything to do with it at all? There is at least one other function in this plugin which I couldn’t get to work some time back. Can’t quite remember which one it was now but overall this really is a fantastic plugin. I see the way it works so I am thinking that this is probably more a server issue than the plugin. I could be wrong on that though.

Don’t know if that helps at all?

Best wishes,

Mark

       
jasonjulien's avatar
jasonjulien
19 posts
16 years ago
jasonjulien's avatar jasonjulien

Will this work within a weblog tag? I’m able to get it to work on hard-coded text, but that seems kinda pointless, I need it to work on the fly for a weblog:entries tag, kinda like so:

{exp:weblog:entries weblog="default"}
     {exp:phpstringfun function="ltrim" par1="status:"}{body}{/exp:phpstringfun}

{/exp:weblog:entries}

So basically, if I was pulling in a list of items from a weblog, any items that had the text “status:”, would have that part trimmed.

The above code works if I replace {body} with hard-coded text (i.e. “Status: blah blah”) and would return just the “blah blah” portion. As soon as I go back to the {body} tag it doesn’t work.

Any ideas? Thanks!

       
jasonjulien's avatar
jasonjulien
19 posts
16 years ago
jasonjulien's avatar jasonjulien

…and to make matters slightly more confusing…the above works when I use {title} tag, just not {body} tag. Like so:

{exp:weblog:entries weblog="default"}
     {exp:phpstringfun function="ltrim" par1="status:"}{title}{/exp:phpstringfun}

{/exp:weblog:entries}
       
jasonjulien's avatar
jasonjulien
19 posts
16 years ago
jasonjulien's avatar jasonjulien

I figured it out! When I was trying to get {body} it had a tag by default at the start, so doing a ltrim failed since the first item was the tag. I created a custom field for this instance so that I could set it as an input field vs. a text area so that it wouldn’t be wrapped by a tag….that did the trick.

       
lukemcr's avatar
lukemcr
154 posts
16 years ago
lukemcr's avatar lukemcr

I see no obvious reason why this would not work:

{exp:magpie url="http://feeds2.feedburner.com/fitsugar" limit="1" refresh="720"}
{items}
{exp:phpstringfun function="html_entity_decode" par1="{description}"}
{description}{/exp:phpstringfun}
{/items}
{/exp:magpie}

unless the Magpie tags aren’t being parsed when they’re in the {exp:phpstringfun} tags. Any ideas? This particular blog’s RSS feed converts all of its < and > carrots to their respective HTML entities. It’s a pain in the butt.

       
Matt Weinberg's avatar
Matt Weinberg
489 posts
16 years ago
Matt Weinberg's avatar Matt Weinberg

Did you try adding parse=”inward” to the magpie tag?

       
lukemcr's avatar
lukemcr
154 posts
16 years ago
lukemcr's avatar lukemcr

Yeah, still no luck. With or without parse=”inward”, the plugin gives the following error:

Warning: html_entity_decode() expects parameter 2 to be long, string given in /home/indigo/public_html/new/admin/plugins/pi.phpstringfun.php on line 34.

Defining par2=”{description}” doesn’t help.

       
zachini's avatar
zachini
3 posts
about 16 years ago
zachini's avatar zachini

Bravo on the fantastic plugin…

       
leadsuccess's avatar
leadsuccess
408 posts
15 years ago
leadsuccess's avatar leadsuccess

Has anyone got the explode function to work?

       
Laisvunas's avatar
Laisvunas
879 posts
15 years ago
Laisvunas's avatar Laisvunas

Hi,

I released a fork of PHPStringFun plugin, called String Mill.

The difference between these two plugins is the following: in order to have more power over parse order String Mill supports variable pair {string_mill_area}{/string_mill_area}

       
1 2

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.