Code: Select all
<img src="file_with_graph_gen.php" />
Any ideas? Should I stick with the graph code in an external file, not manageable directly by cmsms?
Code: Select all
<img src="file_with_graph_gen.php" />
What code you put in UDT?lafayette wrote: while if I put the content of that php file in an UDT, and invoke it in the src attribute of img tag, I only get plain and raw text of the png image.
Code: Select all
<img src="phpMyGraph4.0.php" />
Code: Select all
header ('Content-type: image/png');
Code: Select all
header ('Content-type: image/png');
$graph->parseVerticalColumnGraph($data);
Code: Select all
{php}
$this->assign('data_array', array(
'Mon'=>10,
'Tue'=>20,
'Wed'=>30,
'Thu'=>100,
'Fri'=>20,
'Sat'=>10,
'Sun'=>100)); {/php}
<img src="{phpMyGraph file_name='uploads/testas.png' data=$data_array graph_background_color='FF0000'}" />
[The extension txt has been deactivated and can no longer be displayed.]
No, is same but it's a taglafayette wrote: or your file wasn't intended to be used as UDT?
Code: Select all
{php}
$this->assign("data_array", array(
"Mon"=>10,
"Tue"=>20,
"Wed"=>30,
"Thu"=>100,
"Fri"=>20,
"Sat"=>10,
"Sun"=>33));
{/php}
<img src='{phpMyGraph file_name="uploads/test.png" data=$data_array
type = "HorizontalColumnGraph"
file_name = "test_graph.png"
title = "test"
width = 200
height = 200
font_size = 2
background_color = "FFFFFF"
graph_background_color = "E2E1E2"
font_color = "006699"
column_font_color_q1 = "000000"
column_font_color_q2 = "000000"
border_color = "006699"
column_color = "0099CC"
column_shadow_color = "006699"
min_col_width = "32"
background_color_alpha = 0
graph_background_color_alpha = 0
font_color_alpha = 0
column_font_color_q1_alpha = 0
column_font_color_q2_alpha = 0
border_color_alpha = 0
column_color_alpha = 0
column_shadow_color_alpha = 0
transparent_background = 0
random_column_color = 0
disable_legenda = 0
disable_values = 0
}' />
Code: Select all
{php}
$this->assign('data_array', array(
'Mon'=>10,
'Tue'=>20,
'Wed'=>30,
'Thu'=>100,
'Fri'=>20,
'Sat'=>10,
'Sun'=>150));
{/php}
<img src="{phpMyGraph file_name='uploads/test.png' data=$data_array}" />
Take a look in the HTML source of your browser.rica_carv wrote:
I've try'ed the way it was stated here, but it just messes my css....
I'm not using it inside the template, i'm trying to use it inside the page content....Peciura wrote: Just tried it on CMSms 1.8.2 - it worked.Post your template to forum.Code: Select all
{php} $this->assign('data_array', array( 'Mon'=>10, 'Tue'=>20, 'Wed'=>30, 'Thu'=>100, 'Fri'=>20, 'Sat'=>10, 'Sun'=>150)); {/php} <img src="{phpMyGraph file_name='uploads/test.png' data=$data_array}" />
But that is not recomended, right?NaN wrote:...To use {php} ... {/php} you need to set $config['use_smarty_php_tags'] = true; in your config.php.rica_carv wrote:
I've try'ed the way it was stated here, but it just messes my css....
you can use it in page content or template - does not really matter.I'm not using it inside the template, i'm trying to use it inside the page content....
You could do other way if you likearray('column_name' => 'value',...)
or create UDT that assign values to variable {$data_array}. It is close to scenario when you retrieve data from DB or transform some sort of multidimensional array (or object) to associated array{assign var='keys' value=','|explode:'Mon,Tue,Wed,Thu,Fri,Sat,Sun'}
{assign var='values' value=','|explode:'10,20,30,100,20,10,150'}
{assign var='data_array' value=$keys|@array_combine:$values}
$smarty = cmsms()->GetSmarty(); // cms_utils :: get_smarty();
$smarty->assign('data_array', array(
'Mon'=>10,
'Tue'=>20,
'Wed'=>30,
'Thu'=>69,
'Fri'=>20,
'Sat'=>10,
'Sun'=>150));