| 5:09 pm on Jan 22, 2010 (gmt 0)|
Is $[BasePrice] and $[LowPrice] strings or numbers? As I understand it if adding string together you are effectively doing "27" - "16" which probably won't come out as expected.
| 2:24 am on Jan 23, 2010 (gmt 0)|
I did not write the code, and don't know how to check what type of variable they are, but as I stated above, my guess is they are strings.
If they are strings, that would explain the code breaking, but I didn't think types were normally used in PHP.
How would I check to answer your question?
| 4:50 am on Jan 23, 2010 (gmt 0)|
If you could copy and paste the code where baseprice and lowprice are declared, we might be able to offer a solution. There is nothing functionally wrong with the code you have posted above, so the root problem must lie elsewhere.
| 1:20 pm on Jan 23, 2010 (gmt 0)|
The custom plugin dynamically creates shortcodes to insert the variable into a wordpress page. I had it built so I could manage product pricing on any page in my site. For example, if I wanted to mention the base price of my product on 43 different pages, I could create a shortcode and raise or lower prices whenever I wanted and they would all be instantly updated.
Here is a link to download the full code.
Thanks for your interest.
[edited by: eelixduppy at 4:34 am (utc) on Jan. 25, 2010]
[edit reason] Please post relevant code to thread [/edit]
| 4:06 pm on Jan 24, 2010 (gmt 0)|
Any helpful ideas from that code?
| 12:03 pm on Jan 29, 2010 (gmt 0)|
|This breaks ... |
$firstnum = $[BasePrice];
$secnum = $[LowPrice];
echo $firstnum - $secnum;
When you say "this breaks" ... what do you mean, what error message do you receive? At first pass I would guess that BasePrice is a constant [php.net], as is LowPrice. But then the braces syntax doesn't make sense so these are more likely template variables that need to be parsed by WP instead.
Understanding PHP string [php.net] syntax will help clarify and perhaps point you in the right direction. I believe it's going to be the WP plug-in documentation.
| 2:33 pm on Jan 29, 2010 (gmt 0)|
When I say it "breaks," I am saying that the remainder of the WordPress page after where that code appears does not run. The page is rendered or shown on screen up until where the code appeared. After that there is blank page.
The brackets are standard WordPress formatting for "shortcode" variables which are parsed by various plugins. I had previously pasted a link to the zipped, but unencrypted plugin code, but it appears to have been deleted (I presume by an admin or moderator- see the <snip> in the prior post).
I do not know how to code, so me examining it is useless, which is why I tried to provide access to the code as a previous poster had suggested I paste it here. It seemed a bit long for that.