Forum

Support is provided free and on a “best endeavours” basis. This is usually daylight hours, UK time, Monday to Friday. At the time of this screen being refreshed it was Wednesday 3:08pm in the UK.

Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.





Pages: 1 [2]
AuthorTopic: php function call problem
David-
Artiss
Administrator
Posts: 553
Permalink
Post Re: php function call problem
on: July 16, 2012, 07:50
Quote

Ah yes - seen that now.

When you call mp_product_price then the first parameter defines whether you echo out the result or return it (the default is the former). Hence, if you modify my previous code so that mp_product_price() is now mp_produce_price(false) then it should work.

David.

decors
Newbie
Posts: 4
Permalink
Post Re: php function call problem
on: July 17, 2012, 02:45
Quote

Thanks David, but it didn't work.
When I echo each variable out, here's the finding:
$mp_price: RM 450.00
$currency: empty
$number: RM 450.00

if I change
$number = substr( $mp_price, strpos( $mp_price, ' ' ) + 1 );
to
$number = substr( $mp_price, strpos( $mp_price, ' ' ) - 1 );

which, a '+' to '-' and echo $number, I will get
"n class="mp_product_price"> RM 450.00"

I was thinking perhaps your function grab the last set of <space>xxx would work and filter everything else at the front, can it be done? For example the returned value could be <div whatever> RM 450, the function just grap the last set of the string by detecting the last space character?

Thanks so much Dave, hope to hear from you soon...

Quote from David Artiss on July 16, 2012, 07:50
Ah yes - seen that now.
When you call mp_product_price then the first parameter defines whether you echo out the result or return it (the default is the former). Hence, if you modify my previous code so that mp_product_price() is now mp_produce_price(false) then it should work.
David.

David-
Artiss
Administrator
Posts: 553
Permalink
Post Re: php function call problem
on: July 17, 2012, 07:53
Quote

Basically, it looks like there's a space at the beginning of the returned output. In that case change...

$mp_price = mp_product_price();

to

$mp_price = trim( mp_product_price() );

This will remove any spacing at the beginning and end of the output.

Pages: 1 [2]
Mingle Forum by cartpauj
Version: 1.0.34 ; Page loaded in: 0.022 seconds.
Loading Facebook Comments ...

2 Thoughts on “Forum

  1. Pingback: Artiss YouTube Embed » WordPress AddOns

  2. Pingback: Artiss YouTube Embed | Best Plugins - wordpress – widgets – plugin

2 Trackbacks for "Forum"
  1. [...] Although this document contains a lot of information more is available from a series of linked pages, plus as much information as possible is provided on the various administration pages. Whilst on the administration pages, click on the “Help” button in the top right for some useful tips and links. If anything isn’t covered and you’re unsure of what it does please ask on the forum. [...]

  2. Artiss YouTube Embed | Best Plugins - wordpress – widgets – plugin says:

    [...] Although this document contains a lot of information more is available from a series of linked pages, plus as much information as possible is provided on the various administration pages. Whilst on the administration pages, click on the “Help” button in the top right for some useful tips and links. If anything isn’t covered and you’re unsure of what it does please ask on the forum. [...]

Top
%d bloggers like this: