{"id":508,"date":"2011-06-25T19:10:29","date_gmt":"2011-06-25T09:10:29","guid":{"rendered":"http:\/\/howden.net.au\/thowden\/?p=508"},"modified":"2011-06-25T19:10:29","modified_gmt":"2011-06-25T09:10:29","slug":"oscmax-an-option-for-having-different-main_page-templates","status":"publish","type":"post","link":"https:\/\/howden.net.au\/thowden\/2011\/06\/oscmax-an-option-for-having-different-main_page-templates\/","title":{"rendered":"osCmax an option for having different main_page templates"},"content":{"rendered":"<p>I described the process I went through to have a <a href=\"http:\/\/howden.net.au\/thowden\/2011\/06\/oscmax-template-main-page-different-from-rest-of-site\/\">different osCmax home page template<\/a> from the rest of the site in another post.<\/p>\n<p>When I finished I realised that the method had a few issues and in particular it meant that the changes impacted the whole site not just that template.<\/p>\n<p>So my goal here is to provide an alternative method that moves some of the changes into the template to minimise the impact on the core files and to make the template switching option work even with these changes.<\/p>\n<p>The change I want to make is to move the decision process around the use of more than one main_page.tpl.php type file.<\/p>\n<p>Start in main_page.tpl.php lines 11 to 15:<\/p>\n<blockquote><p>\nrequire(DIR_WS_INCLUDES . &#8216;meta_tags.php&#8217;);<br \/>\n\/\/require(DIR_WS_INCLUDES . &#8216;counter.php&#8217;);<\/p>\n<p>$bts_php_array = bts_read_php();<br \/>\n$bts_html_array = bts_read_html($bts_php_array);\n<\/p><\/blockquote>\n<p>Change lines 14 &amp; 15:<\/p>\n<blockquote><p>\nrequire(DIR_WS_INCLUDES . &#8216;meta_tags.php&#8217;);<br \/>\n\/\/require(DIR_WS_INCLUDES . &#8216;counter.php&#8217;);<\/p>\n<p>$bts_php_array = bts_read_php($php_template);<br \/>\n$bts_html_array = bts_read_html($bts_php_array, $html_template);\n<\/p><\/blockquote>\n<p>Add in this section before line 14 so it looks like this:<\/p>\n<blockquote><p>\n\/\/ if there is an alternate file and if this is called from index.php<br \/>\nif ((file_exists(&#8216;main_index_page.code.php&#8217;)) ||<br \/>\n                (substr($_SERVER[&#8216;PHP_SELF&#8217;], -9) == &#8216;index.php&#8217;)) {<br \/>\n\t$php_template = &#8216;main_index_page.code.php&#8217;;<br \/>\n\t$html_template = &#8216;main_index_page.html&#8217;;<br \/>\n} else {<br \/>\n\t$php_template = &#8216;main_page.code.php&#8217;;<br \/>\n\t$html_template = &#8216;main_page.html&#8217;;<br \/>\n}\n<\/p><\/blockquote>\n<p>Then move down to what should now be line 41<\/p>\n<blockquote><p>\nfunction bts_read_php($php_template = &#8216;main_page.code.php&#8217;) {\n<\/p><\/blockquote>\n<p>Change this to<\/p>\n<blockquote><p>\nfunction bts_read_php($php_template) {\n<\/p><\/blockquote>\n<p>Next change the other function at line 60<\/p>\n<blockquote><p>\nfunction bts_read_html($php_code_array, $html_template = &#8216;main_page.html&#8217;) {\n<\/p><\/blockquote>\n<p>Change this to<\/p>\n<blockquote><p>\nfunction bts_read_html($php_code_array, $html_template) {\n<\/p><\/blockquote>\n<p>Close that file.<\/p>\n<p>Ok, so if we had done the earlier method then we need to undo the change to \/index.php<\/p>\n<p>Go back to the index.php file and change around line 335 is<\/p>\n<blockquote><p>\ninclude (bts_select(\u2018main_index\u2019)); \/\/ BTSv1.5\n<\/p><\/blockquote>\n<p>Change this back to<\/p>\n<blockquote><p>\ninclude (bts_select(\u2018main\u2019)); \/\/ BTSv1.5\n<\/p><\/blockquote>\n<p>Close index.php as this is finished with.<\/p>\n<p>Finally, create the main_index_page.code.php and main_index_page.html. Note that a main_index_page.tpl.php is not required in this method.<\/p>\n<p>So what does this do?  This allows us to add multiple main_page options (just add more if file_exists type options) and it means that the template switching option will still operate.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I described the process I went through to have a different osCmax home page template from the rest of the site in another post. When I finished I realised that the method had a few issues and in particular it meant that the changes impacted the whole site not just that template. So my goal [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-508","post","type-post","status-publish","format-standard","hentry","category-oscommerce-oscmax"],"_links":{"self":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/posts\/508","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/comments?post=508"}],"version-history":[{"count":0,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/posts\/508\/revisions"}],"wp:attachment":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/media?parent=508"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/categories?post=508"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/tags?post=508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}