{"id":1342,"date":"2018-01-19T19:22:43","date_gmt":"2018-01-19T19:22:43","guid":{"rendered":"http:\/\/goofy-trucks.flywheelsites.com\/php-enabled-stylesheets-page-4\/"},"modified":"2018-01-19T19:24:43","modified_gmt":"2018-01-19T19:24:43","slug":"php-enabled-stylesheets-page-4","status":"publish","type":"post","link":"https:\/\/phpbuilder.com\/php-enabled-stylesheets-page-4\/","title":{"rendered":"PHP enabled stylesheets Page 4"},"content":{"rendered":"<div class=\"phpbuilder-content\">\n<div class=\"phpbuilder-meta\">\n<div class=\"\">By Bertrand Potier<\/div>\n<div class=\"\">on November 24, 2002<\/div>\n<\/p><\/div>\n<div id=\"overflow-content\">\n<div class=\"articlePara\">\nThe first step is to retrieve the values that might have been passed to the<br \/>\n<code class=\"example\">_visuals.inc<\/code> file by one of the three ways variables can be passed<br \/>\nfrom one PHP script to another: <\/div>\n<div class=\"articleList\">\n<ol>\n<li>via the URL using an HTTP GET request (<code class=\"example\">myfile.php?key=value<\/code>); <\/li>\n<li>using an HTTP POST request; <\/li>\n<li>or including (via the <code class=\"example\">include()\/require()<\/code> function) the<br \/>\n  <code class=\"example\">visuals.inc<\/code> file so gaining visibility on the parent script<br \/>\n  variables. <\/li>\n<\/ol>\n<\/div>\n<div class=\"articlePara\">\nSince PHP 4.1, the way HTTP POST\/GET request variables are handled has also<br \/>\nchanged (we won&#8217;t discuss that here, refer to the <a href=\"http:\/\/www.php.net\/\" target=\"_blank\">PHP<\/a> web site) and that&#8217;s the reason why the first step in the<br \/>\nscript is, if the PHP version is not 4.1, creating and initialising a<br \/>\n<code class=\"example\">$_REQUEST<\/code> array (PHP 4.1 compliant behavior) containing the<br \/>\nHTTP_POST and GET arrays (used by former versions of PHP). This makes sure the<br \/>\nrest of the script can be developed following the latest recommendations of PHP<br \/>\nwhile still working fine on former versions (the test <code class=\"example\">!= '4.1'<\/code> is<br \/>\nnot fully correct as also returning true for higher versions of PHP). <\/div>\n<div class=\"articlePara\">The next step is making sure that whatever value passed to the<br \/>\n<code class=\"example\">visuals.inc<\/code> file in whatever way (see above) is always taken into<br \/>\naccount. The only value that we will use is the <code class=\"example\">$SkinID<\/code> that is<br \/>\nreferencing the id of the visual set to load. The code first checks if a value<br \/>\nis passed via HTTP POST or GET request (using the <code class=\"example\">$_REQUEST<\/code><br \/>\ninitialised sooner), if no checks that the variable is not yet defined by a<br \/>\nparent script (assuming <code class=\"example\">visuals.inc<\/code> might have been included or<br \/>\nrequired by another script) and if none of those scenarios are true, finally<br \/>\ngive the <code class=\"example\">$SkinID<\/code> variable a default value equal to 0. <\/div>\n<div class=\"articlePara\">Finally comes the definition of the visuals parameters and for this example I<br \/>\nlimited their number to four: font, font size, font unit and page background<br \/>\ncolor. I recommend that, when naming the first dimension of the<br \/>\n<code class=\"example\">$VISUALS<\/code> array, you link it to structural elements of your web<br \/>\npage. Let&#8217;s imagine that you define visual parameter for the footer section of<br \/>\nyour web then declare a <code class=\"example\">$VISUALS[0]['footer']<\/code> dimension. <\/div>\n<div class=\"articlePara\">The <code class=\"example\">visuals.inc<\/code> file is now ready; let&#8217;s move on to the<br \/>\nstylesheet. <\/div>\n<\/div>\n<p><\/p>\n<div style=\"float: left; padding:15px; color:#17AAF3\">\n<div style=\"float:left; padding:2px;\"><a class=\"paginationPageLink\" href=\"potier200211229ba9.html?page=3\">\u00ab Previous Page<\/a><\/div>\n<div style=\"float:left; padding:2px 4px 2px 4px;\"><a class=\"pageNumber\" href=\"potier20021122.html\">1<\/a> <\/div>\n<div style=\"float:left; font-size:16px; color:#FF7A22; padding:2px 2px 2px 2px; \">| <\/div>\n<div style=\"float:left; padding:2px 4px 2px 4px;\"><a class=\"pageNumber\" href=\"potier200211224658.html?page=2\">2<\/a> <\/div>\n<div style=\"float:left; font-size:16px; color:#FF7A22; padding:2px 2px 2px 2px; \">| <\/div>\n<div style=\"float:left; padding:2px 4px 2px 4px;\"><a class=\"pageNumber\" href=\"potier200211229ba9.html?page=3\">3<\/a> <\/div>\n<div style=\"float:left; font-size:16px; color:#FF7A22; padding:2px 2px 2px 2px; \">| <\/div>\n<div style=\"background-color:#B6E5FC; font-size:16px; margin-top:1px; padding:1px 4px 1px 4px; color:#000; font-style:bold; float:left;\">4<\/div>\n<div style=\"float:left; font-size:16px; color:#FF7A22; padding:2px 2px 2px 2px; \">| <\/div>\n<div style=\"float:left; padding:2px 4px 2px 4px;\"><a class=\"pageNumber\" href=\"potier20021122af4d.html?page=5\">5<\/a> <\/div>\n<div style=\"float:left; font-size:16px; color:#FF7A22; padding:2px 2px 2px 2px; \">| <\/div>\n<div style=\"float:left; padding:2px 4px 2px 4px;\"><a class=\"pageNumber\" href=\"potier20021122c575.html?page=6\">6<\/a> <\/div>\n<div style=\"float:left; font-size:16px; color:#FF7A22; padding:2px 2px 2px 2px; \">| <\/div>\n<div style=\"float:left; padding:2px 4px 2px 4px;\"><a class=\"pageNumber\" href=\"potier20021122235c.html?page=7\">7<\/a> <\/div>\n<div style=\"float:left; font-size:16px; color:#FF7A22; padding:2px 2px 2px 2px; \">| <\/div>\n<div style=\"float:left; padding:2px 4px 2px 4px;\"><a class=\"pageNumber\" href=\"potier20021122fdfa.html?page=8\">8<\/a> <\/div>\n<div style=\"float:left; font-size:16px; color:#FF7A22; padding:2px 2px 2px 2px; \">| <\/div>\n<div style=\"float:left; padding:2px 4px 2px 4px;\"><a class=\"pageNumber\" href=\"potier200211220b08.html?page=9\">9<\/a> <\/div>\n<div style=\"float:left; font-size:16px; color:#FF7A22; padding:2px 2px 2px 2px; \">| <\/div>\n<div style=\"float:left; padding:2px 4px 2px 4px;\"><a class=\"pageNumber\" href=\"potier200211221448.html?page=10\">10<\/a> <\/div>\n<div style=\"float:left; padding:2px;\"><a class=\"paginationPageLink\" href=\"potier20021122af4d.html?page=5\">Next Page \u00bb<\/a><\/div>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>From Perl scripts to PHP, a lot of technologies are today available to move HTML to the dynamic age but why not, going even further and do the<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1342","post","type-post","status-publish","format-standard","hentry","category-tutorials"],"_links":{"self":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1342","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/comments?post=1342"}],"version-history":[{"count":1,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1342\/revisions"}],"predecessor-version":[{"id":3228,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1342\/revisions\/3228"}],"wp:attachment":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/media?parent=1342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/categories?post=1342"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/tags?post=1342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}