PHP is a server side language – but my current request is to have PHP at client (browser) side language. Let me explain – I will have a .html file which in some way have instruction to load a .php file. This .php file would interact with DB (or create a dynamic Java Script). Later this data would be dynamically displayed on the web html file using PHP functionality. Is the same possible? Can you please provide an example of same? What is the HTML include command to include a PHP files.
Is this possible – however if same is possible what is the HTML tags to do so?
Let me explain via some examples:
A.html
<html>
<head></head>
<body>
<ul>
inlude <--"phpfile.php"-->
</ul>
</body>
</html>
Now "phpfile.php" will have
<?php for($i=1;$i<=5;$i++){ ?>
<li>Menu Item <?php echo $i; ?></li>
<?php } ?>
So finally the HTML file would give to the user:
•Menu Item 1
•Menu Item 2
•Menu Item 3
•Menu Item 4
•Menu Item 5
Here is my real requirement. I have to implement HighChart Column Drill down chart in a web page. Now that is statically build using JS:
References:
I am trying to create a dynamic Nth level column drilldown Highchart. Since drilldown 'data' and its tags are suppose to be dynamic I need to generate a dynamic JS. Is the same possible via PHP
We have PHP installed in our web host and doing an AJAX call will not solve as I need HighChart JS script to be dynamic . AJAX call can give me data but can I have the JS script made as dynamic. Please see the example references in the question. It has a 'data' 'drilldown' JS array tags for your perusal.
For better clarity I am adding the HighChart data array that needs to be dynamic here:
var colors = Highcharts.getOptions().colors,
categories = ['MSIE', 'Firefox', 'Chrome', 'Safari', 'Opera'],
name = 'Browser brands',
level = 0,
data = [{
y: 55.11,
color: colors[0],
drilldown: {
name: 'MSIE versions',
categories: ['MSIE 8.0', 'MSIE 6.0', 'MSIE 7.0', 'MSIE 9.0'],
level: 1,
data: [{
y: 33.06,
drilldown: {
level: 2,
name: 'drilldown next level',
categories: ['a', 'b', 'c'],
data: [23,54,47],
color: colors[0]
}
}, 10.85, 7.35, 2.41],
color: colors[0]
}
}, {
y: 21.63,
color: colors[1],
drilldown: {
name: 'Firefox versions',
categories: ['Firefox 3.6', 'Firefox 4.0', 'Firefox 3.5', 'Firefox 3.0', 'Firefox 2.0'],
data: [13.52, 5.43, 1.58, 0.83, 0.20],
color: colors[1]
}
}, {
y: 11.94,
color: colors[2],
drilldown: {
name: 'Chrome versions',
categories: ['Chrome 10.0', 'Chrome 11.0', 'Chrome 8.0', 'Chrome 9.0', 'Chrome 12.0',
'Chrome 6.0', 'Chrome 5.0', 'Chrome 7.0'],
data: [9.91, 0.50, 0.36, 0.32, 0.22, 0.19, 0.12, 0.12],
color: colors[2]
}
}, {
y: 7.15,
color: colors[3],
drilldown: {
name: 'Safari versions',
categories: ['Safari 5.0', 'Safari 4.0', 'Safari Win 5.0', 'Safari 4.1', 'Safari/Maxthon',
'Safari 3.1', 'Safari 41'],
data: [4.55, 1.42, 0.23, 0.21, 0.20, 0.19, 0.14],
color: colors[3]
}
}, {
y: 2.14,
color: colors[4],
drilldown: {
name: 'Opera versions',
categories: ['Opera 11.x', 'Opera 10.x', 'Opera 9.x'],
data: [1.65, 0.37, 0.12],
color: colors[4]
}
}];
Also the final page would not be a .php page, I am looking for a way to make the 'data' array either of 1,2,3,4 ... Nth element JS array