Search code examples
phposclass

osclass specific category at home page


I am using osclass 3.1.2 version with modern theme. I have created 2 main categories paid and free which also contains one subcategory each named as premium ads and free ads. now I want to display only premium ads on my sites home page so how can I do this?

I have found this code from http://doc.osclass.org/Display_only_certain_type_of_listings

But not able to merge with my code please help.


Solution

  • thanks for replies. finally i have found my answer.following code is perfect solution of my problem.

    <?php osc_query_item("category=99");
    if( osc_count_custom_items() == 0) { ?>
        <p class="empty"><?php _e('No Listings', 'modern') ; ?></p>
    <?php } else { ?>
        <table border="0" cellspacing="0">
             <tbody>
                <?php $class = "even"; ?>
                <?php while ( osc_has_custom_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() ) { 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 }; ?>