Advertisement:

Author Topic: How to show all regions  (Read 4134 times)

Zoox

  • Newbie
  • *
  • Posts: 9
How to show all regions
« on: March 24, 2015, 09:19:03 pm »
Hello

I use modern theme. And i want to show all regions in Sweden on the right sidebar.
Including empty regions. I have searched here on forum and tried to edit main.php
But empty categories/regions are not showing in sidebar.

Please help

Thanks

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: How to show all regions
« Reply #1 on: March 24, 2015, 10:05:54 pm »
Hi,

Locate in main.php:

Code: [Select]
                <div class="navigation">
                    <?php if(osc_count_list_regions() > ) { ?>

Replace it with:

Code: [Select]
                <div class="navigation">
                    <?php View::newInstance()->_exportVariableToView('list_regions'Search::newInstance()->listRegions('%%%%''>=') ) ;
                    if(
osc_count_list_regions() > 0) {?>


Regards

Adyyda

  • Sr. Member
  • ****
  • Posts: 435
Re: How to show all regions
« Reply #2 on: August 23, 2015, 02:42:45 pm »
Hi,

Locate in main.php:

Code: [Select]
                <div class="navigation">
                    <?php if(osc_count_list_regions() > ) { ?>

Replace it with:

Code: [Select]
                <div class="navigation">
                    <?php View::newInstance()->_exportVariableToView('list_regions'Search::newInstance()->listRegions('%%%%''>=') ) ;
                    if(
osc_count_list_regions() > 0) {?>


Regards

Hello Teseo. Your code works but the order of regions in mixed. Can we have them in alphabetic order, staring from A? Thanks.

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: How to show all regions
« Reply #3 on: August 23, 2015, 04:43:17 pm »
Change the _exportvariabletoview to this one:
Code: [Select]
View::newInstance()->_exportVariableToView('list_regions', Search::newInstance()->listRegions('%%%%', '>=', 'region_name ASC') ) ;
Regards,
Eric

Adyyda

  • Sr. Member
  • ****
  • Posts: 435
Re: How to show all regions
« Reply #4 on: August 23, 2015, 04:44:52 pm »
Thanks

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: How to show all regions
« Reply #5 on: August 23, 2015, 05:06:41 pm »
You're welcome, if it's solved please change topic with -SOLVED- ;)

Regards,
Eric

Adyyda

  • Sr. Member
  • ****
  • Posts: 435
Re: How to show all regions
« Reply #6 on: August 23, 2015, 05:15:01 pm »
I am not the one that started the thread.

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: How to show all regions
« Reply #7 on: August 23, 2015, 06:20:50 pm »
LOL...you're right sorry, I guess this one will never be solved unless Zoox is still reading along....;)

MissTS

  • Newbie
  • *
  • Posts: 32
Re: How to show all regions
« Reply #8 on: September 10, 2015, 11:06:42 am »
i have done everything these pages say, and NO posting locations still show.
what am i doing wrong

Adyyda

  • Sr. Member
  • ****
  • Posts: 435
Re: How to show all regions
« Reply #9 on: September 10, 2015, 11:54:53 am »
i have done everything these pages say, and NO posting locations still show.
what am i doing wrong

use

Code: [Select]
                        <div class="regions">
                            <?php View::newInstance()->_exportVariableToView('list_regions'Search::newInstance()->listRegions('%%%%''>=''region_name ASC') ) ;?>
                            <div class="inner-container">
                                <ul>
                                    <?php while(osc_has_list_regions()) { ?>
                                        <li>
                                            <a href="<?php echo osc_search_url(array('sRegion' => osc_list_region_name()));?>"><?php echo osc_list_region_name();?></a>
                                        </li>
                                    <?php ?>
                                </ul>
                            </div>
                        </div>

MissTS

  • Newbie
  • *
  • Posts: 32
Re: still dont show locations. what am i doing wrong?
« Reply #10 on: September 11, 2015, 07:51:48 pm »
still does not work
do i have to do something to the sub domains maybe like add all the files to site in them? or all but admin?  or not anything cause i dont need to do that.
or what am i missing on the main.php script.

this is what i have:


<?php
    /*
     *      Osclass – software for creating and publishing online classified
     *                           advertising platforms
     *
     *                        Copyright (C) 2012 OSCLASS
     *
     *       This program is free software: you can redistribute it and/or
     *     modify it under the terms of the GNU Affero General Public License
     *     as published by the Free Software Foundation, either version 3 of
     *            the License, or (at your option) any later version.
     *
     *     This program is distributed in the hope that it will be useful, but
     *         WITHOUT ANY WARRANTY; without even the implied warranty of
     *        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     *             GNU Affero General Public License for more details.
     *
     *      You should have received a copy of the GNU Affero General Public
     * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
     */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="<?php echo str_replace('_', '-', osc_current_user_locale()); ?>">
    <head>
        <?php osc_current_web_theme_path('head.php'); ?>
        <meta name="robots" content="index, follow" />
        <meta name="googlebot" content="index, follow" />
    </head>
    <body>
        <?php osc_current_web_theme_path('header.php'); ?>
        <div class="form_publish">
            <?php osc_current_web_theme_path('inc.search.php'); ?>
        </div>
        <div class="content home">
            <div id="main" class="home-left-side">
                <?php osc_current_web_theme_path('inc.main.php') ; ?>
               <div class="latest_ads">
                    <h1><strong><?php _e('Latest Listings', 'modern'); ?></strong></h1>
                    <?php if( osc_count_latest_items() == 0) { ?>
                        <p class="empty"><?php _e('No Latest Listings', 'modern'); ?></p>
                    <?php } else { ?>
                        <table border="0" cellspacing="0">
                             <tbody>
                                <?php $class = "even"; ?>
                                <?php while ( osc_has_latest_items() ) { ?>
                                 <tr class="<?php echo $class. (osc_item_is_premium()?" premium":""); ?>">
                                        <?php if( osc_images_enabled_at_items() ) { ?>
                                         <td class="photo">
                                            <?php if( osc_count_item_resources() ) { ?>
                                                <a href="<?php echo osc_item_url(); ?>">
                                                    <img src="<?php echo osc_resource_thumbnail_url(); ?>" width="75" height="56" title="<?php echo osc_item_title(); ?>" alt="<?php echo osc_item_title(); ?>" />
                                                </a>
                                            <?php } else { ?>
                                                <img src="<?php echo osc_current_web_theme_url('images/no_photo.gif'); ?>" alt="" title="" />
                                            <?php } ?>
                                         </td>
                                        <?php } ?>
                                         <td class="text">
                                             <h3><a href="<?php echo osc_item_url(); ?>"><?php echo osc_item_title(); ?></a></h3>
                                             <p><strong><?php if( osc_price_enabled_at_items() && osc_item_category_price_enabled() ) { echo osc_item_formated_price(); ?> - <?php } echo osc_item_city(); ?> (<?php echo osc_item_region();?>) - <?php echo osc_format_date(osc_item_pub_date()); ?></strong></p>
                                             <p><?php echo osc_highlight( strip_tags( osc_item_description() ) ); ?></p>
                                         </td>
                                     </tr>
                                    <?php $class = ($class == 'even') ? 'odd' : 'even'; ?>
                                <?php } ?>
                            </tbody>
                        </table>
                        <?php if( osc_count_latest_items() == osc_max_latest_items() ) { ?>
                        <p class='pagination'><?php echo osc_search_pagination(); ?></p>
                            <p class="see_more_link"><a href="<?php echo osc_search_show_all_url();?>"><strong><?php _e("See all offers", 'modern'); ?> &raquo;</strong></a></p>
                   <?php } ?>
                    <?php View::newInstance()->_erase('items'); } ?>
                </div>
            </div>     
 <?php } ?>
                    <?php View::newInstance()->_erase('items'); } ?>
                </div>
            </div>

            <div id="sidebar" class="home-right-side">
                <div class="regions">
                            <?php View::newInstance()->_exportVariableToView('list_regions', Search::newInstance()->listRegions('%%%%', '>=', 'region_name ASC') ) ;?>
                            <div class="inner-container">
                                <ul>
                                    <?php while(osc_has_list_regions()) { ?>
                                        <li>
                                            <a href="<?php echo osc_search_url(array('sRegion' => osc_list_region_name()));?>"><?php echo osc_list_region_name();?></a>
                                        </li>
                                    <?php } ?>
                                </ul>
                            </div>
                        </div>
            <div class="clear"></div>
            <?php if( osc_get_preference('homepage-728x90', 'modern') != '') { ?>
            <!-- homepage ad 728x60-->
            <div class="ads_728">
                <?php echo osc_get_preference('homepage-728x90', 'modern'); ?>
            </div>
            <!-- /homepage ad 728x60-->
            <?php } ?>
        </div>
        <?php osc_current_web_theme_path('footer.php') ; ?>
    </body>
</html>

Adyyda

  • Sr. Member
  • ****
  • Posts: 435
Re: How to show all regions
« Reply #11 on: September 11, 2015, 09:51:46 pm »
That code works for me just fine and i am running it in a test subdomain. Sorry but i have no clue why is not working for you.

MissTS

  • Newbie
  • *
  • Posts: 32
Re: How to show all regions
« Reply #12 on: September 12, 2015, 04:58:04 am »
did you do anything else to any of the pages or create a sub domain or anything?
meaning.. are you using sub domains?  or working in just the normal site
« Last Edit: September 12, 2015, 04:59:41 am by MissTS »

davut_c20

  • Newbie
  • *
  • Posts: 13
Re: How to show all regions
« Reply #13 on: October 25, 2017, 12:56:56 am »
Thank you very much :)

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: How to show all regions [SOLVED]
« Reply #14 on: October 25, 2017, 12:24:26 pm »