•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 397,763 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,532 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Okay so I had this need to vary the template layout of an osCommerce theme using its BTS (basic template system) and noticed that unlike standard osCommerce where you can edit each and every individual page to have a unique layout, BTS uses a template system to generate its look. I've ran into this with designing open-realty templates and figured its time to come up with a solution.
The problem for me was that there were places I only wanted Two column layouts on my three column theme I designed and there were places where I wanted flash in the header on some pages but not others. Alternatively I also need some pages to load the third column WITH Ads and others without. Here is what I did;
So how do I solve this little dilemma? Well I had to resort to some PHP to kinda fake it and get the template layout to function as if it were a full blown CMS template engine where I could control how many columns or elements got displayed and where they got displayed. I wrote about doing this in my blog located at http://www.jaredritchey.com where you can download an example osCommerce template and an example Open-Realty template using the same type of configuration.
Here is the code in three parts;
A) Create a file called settings.php for example using the first block of code below. You can remove the (DIR_WS_CATALOG) . if not using this in an oscommerce template.
B) Add the second set of code to your template header.
C) Your files you wish to have loaded
Its that simple. I do provide examples and have no problems sharing it in other forums around the web.
Enjoy!
The problem for me was that there were places I only wanted Two column layouts on my three column theme I designed and there were places where I wanted flash in the header on some pages but not others. Alternatively I also need some pages to load the third column WITH Ads and others without. Here is what I did;
So how do I solve this little dilemma? Well I had to resort to some PHP to kinda fake it and get the template layout to function as if it were a full blown CMS template engine where I could control how many columns or elements got displayed and where they got displayed. I wrote about doing this in my blog located at http://www.jaredritchey.com where you can download an example osCommerce template and an example Open-Realty template using the same type of configuration.
Here is the code in three parts;
A) Create a file called settings.php for example using the first block of code below. You can remove the (DIR_WS_CATALOG) . if not using this in an oscommerce template.
B) Add the second set of code to your template header.
C) Your files you wish to have loaded
Its that simple. I do provide examples and have no problems sharing it in other forums around the web.
Enjoy!
#### 1 in a settings.php file or some other name of your choice <?php //echo (DIR_WS_TEMPLATES) . "example.php" ; // BTSv1.5 $P=$_SERVER['REQUEST_URI']; switch ($P) { // THESE ARE PLACES I WANT THREE COLUMNS WITH BANNERS case (DIR_WS_CATALOG) . "/login.php"; case (DIR_WS_CATALOG) . "/privacy.php"; $data = (DIR_WS_TEMPLATES) . 'threecolumnads.php'; break; // THESE ARE PLACES I WANT THREE COLUMNS WITH NO ADVERTISING //case (DIR_WS_CATALOG) . "/index.html" || $P == "/" || "$P" == "/index.php": case (DIR_WS_CATALOG) . "index.php": $data = (DIR_WS_TEMPLATES) . 'threecolumn.php'; break; // TWO COLUMNS EVERY WHERE ELSE default: $data = (DIR_WS_TEMPLATES) . 'twocolumn.php'; } ?> #### 2 in your header template somewhere <?php require(DIR_WS_TEMPLATES . 'settings.php'); ?> #### 3 Example threecolumn.php <div id="maincolumn" > <div class="inside"> <!-- content //--> <?php require (bts_select ('content')); // BTSv1.5 ?> <!-- content_eof //--> </div> </div> <div id="rightcolumn"> <div class="inside"> <!-- right_navigation //--> <?php require(bts_select('column', 'column_right.php')); // BTSv1.5 ?> <!-- right_navigation_eof //--> </div> <div class="adzone"> //advertisements here </div> </div>
Post Comment
•
•
•
•
DaniWeb Marketplace (Sponsored Links)