CB substitution in phpGraph

2 years 1 week ago - 2 years 1 week ago #328897 by galanopd
CB substitution in phpGraph was created by galanopd
Hi

I am using the following inside a custom HTML field.
<p>{rgraph title="PROJECT for" type="HBar" width="480" height="350" tooltip="<b>#label#</b><br /> #val# uasp" variant="3d" xaxisLabelsAngle="20" marginBottom="105"
data="database" sql="SELECT country_name, uasp, uasv, fosp, fosv, pdsp, pdsv, cIsp_ic, cIsv_ic, hosp, hosv, posp, posv, cIIsp_igc, cIIsv_igc, gesp, gesv, asp, asv
FROM jos_mytable
WHERE country_name='[cb_country]'"
marginLeft="85" draw_option="wave([frames:60])" tooltipsEvent="onmousemove" tooltipsEffect="slide" variantThreedOffsety="10" variantThreedOffsetx="15" truncate_label="15,..."}cvs{/rgraph}</p>

The problem is that the WHERE country_name='[cb_country]' doesn't seem to work although the error in the front-end shows the correct value: county_name='Brazil' which is the country of the specific user.

When I explicitly use county_name='Brazil' it works fine.

After posting this to their forum php-RGraph I got the following answer:

this problem has nothing to do with php-rgraph, as rgraph processes sql statements from plugin-parms. It seems for me that Community Builder should have replaced values <b>before</b> php-rgraph's processing.


Any ideas on how I could possibly overcome this?

Thanks

Please Log in to join the conversation.

2 years 1 week ago #328902 by krileon
Replied by krileon on topic CB substitution in phpGraph
Content plugins are applied before substitutions in Custom HTML fields so no that won't work. We can't change this behavior without causing a massive B/C break so it won't be changed until probably CB 3.x.

For now what I can do is add support for this to CB Code Field and you use a Code Field instead, which outputs results of custom PHP and supports substitutions and will soon support content plugins. An alternative is to try and use CB Content Bot and ensure it's ordered before your 3rd party content plugin to be sure it runs first, but am unsure if that will work.

forge.joomlapolis.com/issues/8895


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: galanopd

Please Log in to join the conversation.

2 years 1 week ago #328904 by galanopd
Replied by galanopd on topic CB substitution in phpGraph
Looking forward to a solution.
In the meantime I will test your suggestion.

Thanks

Please Log in to join the conversation.

2 years 1 week ago #328906 by krileon
Replied by krileon on topic CB substitution in phpGraph
A new CB Code Field build has been released. It now has a parameter under the Code input to toggle on support for content plugins. The way it will work is as follows Parse Substitutions > Parse Content Plugins > Run as PHP so keep in mind your content plugin should be returning a safe string value so you can echo/return the results.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: galanopd

Please Log in to join the conversation.

2 years 1 week ago #328908 by galanopd
Replied by galanopd on topic CB substitution in phpGraph
Fast!
I have downloaded the updates.
I will try to see if it works now.

Thank you.

Please Log in to join the conversation.

2 years 1 week ago - 2 years 1 week ago #328912 by galanopd
Replied by galanopd on topic CB substitution in phpGraph

An alternative is to try and use CB Content Bot and ensure it's ordered before your 3rd party content plugin to be sure it runs first, but am unsure if that will work.


Changing the order did the job, that was helpful!

Thank you

By the way are there any examples on how to use PHP within Code field?
For instance, is <?php necessary or it is added automatically?

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.201 seconds

Facebook Twitter LinkedIn