Advertisement:

Author Topic: [TIP] Show regions for each country  (Read 916 times)

frosticek

  • Hero Member
  • *****
  • Posts: 3948
[TIP] Show regions for each country
« on: August 16, 2013, 09:55:09 pm »
Hi guys,

I would like to share idea how to show regions for each country (if this region has at least 1 listing) at main.php. There is the code, additional css formating is necessary:

Code: [Select]
              <ul>
              <?php while(osc_has_list_countries() ) { ?>
              <li class="country"><div style="float:left;clear:both;font-weight:bold"><a href="<?php echo osc_list_country_url();?>"><?php echo osc_list_country_name();?></a></div></li>
                 <?php View::newInstance()->_exportVariableToView('list_regions'Search::newInstance()->listRegions(osc_list_country_code(), '>''region_name ASC') ) ; ?>
                 <?php while(osc_has_list_regions()) { ?>
                    <li style="float:left;clear:both;font-weight:normal;padding-left:5px"><a href="<?php echo osc_search_url(array('sRegion' => osc_list_region_name()));?>"><?php echo osc_list_region_name();?></a></li>
                 <?php ?>
              <?php ?>
              </ul>