This topic is locked
[SOLVED]

 Condition for including a chart on the View page

1/8/2014 8:33:44 PM
PHPRunner General questions
D
dangdk author

Hi,
I am looking to include a number of pie charts on the view page of an item. However for some items there will be no data for one or more of the pie charts meaning that I do not want the chart(s) displayed. I also do not want a large blank box where that chart should be, I just want the next element in the page displayed neatly. How would I go about doing this? Would it be some code in the "before process" event?
Thanks

Sergey Kornilov admin 1/8/2014

If you switch to HTMl mode on chart page you will see the block similar to this one that is responsible for chart display:

{BEGIN chart_block}

<DIV id="chart_block{$id}">

{$Balance_Chart_chart 700 530}

</DIV>

{END chart_block}


If you do not this or any other chart to be displayed use the following code in BeforeProcess event:

$xt->assign("chart_block",false);


This, of course, can be changed to be conditional.
If you copy/paste more charts to this page make sure to enclose them into similar BEGIN/END blocks so you can also hide them conditionally.

D
dangdk author 1/9/2014

Works a treat, thanks!