*

tomek

  • *
  • 2 posts
show only 10 items
« on: January 02, 2023, 07:03:14 AM »
helo :)
can anybody help me with this, i want to show only 10 item on this code :

<?php if (osc_count_list_countries()== 1 && osc_count_list_regions() > 1) { ?>
<?php View::newInstance()->_exportVariableToView('list_cities', CityStats::newInstance()->listCities("", ">", "items DESC")); ?>
 
<div class="ul_location_search">
<ul>
<?php while(osc_has_list_cities()) { ?>

<li><a href="<?php echo osc_search_url(array('sCity' => osc_list_city_name()));?>"><?php echo osc_list_city_name();?></a> <em>(<?php echo osc_list_city_items();?>)</em></li>
<?php } ?>


*

MB Themes

Re: show only 10 items
« Reply #1 on: January 02, 2023, 01:22:10 PM »
@tomek
Using code provided by you:
Code: [Select]
<?php if (osc_count_list_countries()== && osc_count_list_regions() > 1) { ?>
  <?php View::newInstance()->_exportVariableToView('list_cities'CityStats::newInstance()->listCities(""">""items DESC")); ?>
   
  <div class="ul_location_search">
  <ul>
  <?php $i 1?>
  <?php while(osc_has_list_cities()) { ?>
    <?php if($i 10) { break; } ?>
    <li><a href="<?php echo osc_search_url(array('sCity' => osc_list_city_name()));?>"><?php echo osc_list_city_name();?></a> <em>(<?php echo osc_list_city_items();?>)</em></li>
    <?php $i++; ?>
  <?php ?>
<?php ?>
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

tomek

  • *
  • 2 posts
Re: show only 10 items
« Reply #2 on: January 02, 2023, 01:59:07 PM »
Thank you for reply but it dosent works :(

I think o have some issue with this part of code :
<?php if($i > 10) { break; } ?>
« Last Edit: January 02, 2023, 02:01:03 PM by tomek »

*

MB Themes

Re: show only 10 items
« Reply #3 on: January 02, 2023, 03:12:03 PM »
@tomek
No, code looks OK.
If you have less entries, it will not do anything.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots