♥bruyndoncx Posted February 14, 2013 Posted February 14, 2013 I want the manufacturers box module only shown on the home page. I already have the customization that I can choose which pages a module should show up on but index.php is the same for the home page as the categories listing. I could code the manufacturers box to not return anything if not on the home page, but I feel it's kind of a dirty solution and am wondering if there isn't a more elegant way without having to add that logic to the getData function in the box module. Can you think of other more elegant coding solutions ? KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt
♥GLWalker Posted February 14, 2013 Posted February 14, 2013 Try to download the login_box for 2.3 contribution, it has a pretty good example of coding an array of pages to use for triggering where to display or not. Follow the community build: BS3 to osCommerce Responsive from the Get Go! Check out the new construction: Admin Gone to Total BS!
Juto Posted February 15, 2013 Posted February 15, 2013 Hi Carine, could something like this be of any help? <?php if ($current_page == FILENAME_DEFAULT) { include(DIR_WS_BOXES . 'manufacturers.php'); } ?> Sara Contributions: http://addons.oscommerce.com/info/8010 http://addons.oscommerce.com/info/8204 http://addons.oscommerce.com/info/8681
burt Posted February 15, 2013 Posted February 15, 2013 @@bruyndoncx - I don't think there is a more elegant way than some dirty code in the box file. function execute() { global $SID, $oscTemplate, $category_depth; if ((USE_CACHE == 'true') && empty($SID)) { $output = tep_cache_manufacturers_box(); } else { $output = $this->getData(); } switch ($category_depth) { case 'top': $show_man = true; break; case 'products': case 'nested': $show_man = false; break; } if ($show_man === true) $oscTemplate->addBlock($output, $this->group); }
♥bruyndoncx Posted February 15, 2013 Author Posted February 15, 2013 Hi Carine, could something like this be of any help? <?php if ($current_page == FILENAME_DEFAULT) { include(DIR_WS_BOXES . 'manufacturers.php'); } ?> Sara That is how I had it in 2.2, I'm trying to refactor my code to follow the boxes modules coding scheme KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt
♥bruyndoncx Posted February 15, 2013 Author Posted February 15, 2013 Try to download the login_box for 2.3 contribution, it has a pretty good example of coding an array of pages to use for triggering where to display or not. Yes, that is an example of how to make a particular php page specific (hardcoded in the module) I already have a configurable way of doing this through this other contribution, but I forgot how it is called KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt
♥bruyndoncx Posted February 15, 2013 Author Posted February 15, 2013 @@bruyndoncx - I don't think there is a more elegant way than some dirty code in the box file. function execute() { global $SID, $oscTemplate, $category_depth; if ((USE_CACHE == 'true') && empty($SID)) { $output = tep_cache_manufacturers_box(); } else { $output = $this->getData(); } switch ($category_depth) { case 'top': $show_man = true; break; case 'products': case 'nested': $show_man = false; break; } if ($show_man === true) $oscTemplate->addBlock($output, $this->group); } It looks like that is the way to go, just a little question, as the manufacturers box is the same always, why do I care about the $SID, and when exactly would I really need to care about $SID ? KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt
rpdesign Posted February 15, 2013 Posted February 15, 2013 Have you tryed <?php $page= htmlentities($_SERVER['PHP_SELF']); if ($page == '/index.php'){ include(DIR_WS_BOXES . 'manufacturers.php') } ?> Always backup your files! You will be glad you didMy add-ons :SSPP Seperate Shipping Per Product v2.5| SupportGift vouchers for SPPC 4.22 v2.1 | Support |Catalog Infobox v1.0 | Sorry no support for Catalog Infobox |HTML Mail v2.0 | Support |Upcoming Add ons:Addon Manager | Separate Pricing Per Product Qty |Coupon Populate | EZ-PDF Catalog
burt Posted February 16, 2013 Posted February 16, 2013 @@bruyndoncx I guess the SID is there for the purpose of caching [or not]?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.