It would be a good thing that you had a userfriendly way to specify some styling, and this styling could be used by specifying a parameter.
You had a hook - style-hook.php
In this file you had sections with style settings. One style section should ( for a start ) be defined as a template for the user to edit and eventual copy.
[section for userstyle01]
$topnavbar = "Y"; // top navbar should be used (Y) or space should be free (N)
$bottomnavbar = "Y"; // bottom navbar should be used (Y) or space should be free (N)
$tablecolor = "#DDDED2"; //color used in tableview
$tablemargin = "300px"; //Size of the margin used in tableview
Some more settings of the most common things a user would want to specify, and then some code that make the settings operational.
The user could copy a section and this way have more stylings to choose from.
Like this
[section for userstyle02]
$topnavbar = "N"; // top navbar should be used (Y) or space should be free (N)
$bottomnavbar = "Y"; // bottom navbar should be used (Y) or space should be free (N)
$tablecolor = "#333333"; //color used in tableview
$tablemargin = "100px"; //Size of the margin used in tableview
When should these settings be used?
If a user never specifies a parameter in an url, then never.
But if a user has an application like : http://examplesite.com/firmaer/Firmaer_view.php
Then he could specify : http://examplesite.com/firmaer/Firmaer_ ... serstyle02"
And then the settings in the section userstyle02 would be used.
This would be useful, if you had a table shown in an iframe on a page. The url for the iframe could then contain the parameter for a style.
A style if shown stand-alone ( no parameter)
A style if shown in an iframe on page 1 ( parameter 1)
A style if shown in an iframe on page 45 (parameter 2)
This way you could have the same application to show up in different styles.
And - the settings is easy to handle even for a not so experienced user. Only skill the user should have is the ability to use an editor as Notepad++.
In a section could eventually also be specified some code as the quite brillant code supplied from a user to make the table be scrollable.
<style>
.table-responsive { overflow: auto; width: 100%; height: 50vh; }
.table th { background:#eef; }
</style>
<script>
$j('div.table-responsive').on('scroll', function() {
$j('thead', this).css('transform', 'translateY('+ this.scrollTop +'px)');
});
</script>
Parameter driven style hook.
Re: Parameter driven style hook.
Forget about the code. The code example is still a brillant code, but it could only be put in the footer-extras.php, as it is bound to a big number of records to be shown. Bad example.
The style-hook should only contain sections where a user in an easy way, can specify settings for styling the page.
And then the section "name" should/could be used as a parameter when "calling" the application.
The style-hook should only contain sections where a user in an easy way, can specify settings for styling the page.
And then the section "name" should/could be used as a parameter when "calling" the application.