Advertisement:

Author Topic: Come mettere gli annunci premium anche nella pagina iniziale (main.php) funziona  (Read 4321 times)

Bettalegend

  • Newbie
  • *
  • Posts: 36
Come mettere gli annunci premium anche nella pagina iniziale (main.php) funziona al 100%

Ciao a tutti ecco a voi il codice giusto per inserire gli annunci premium anche nella pagina principale di Osclass.

Per prima cosa aprite il file main.php e cercate la riga <div id="main">
copiate sotto tale riga il codice di seguito e avrete anche gli annunci premium in home page :)

se volte cambiare il numero degli annunci da visualizzare dovete sostituire il numero 12 alla 3° riga qui <?php osc_get_premiums(12);

Code: [Select]
          <div class="latest_ads"><br /><br />
                    <h1><strong><?php _e('Annunci Premium''italia') ; ?></strong></h1> 
                   
                    <?php osc_get_premiums(12);
if(
osc_count_premiums()>0?>

            <table border="0" cellspacing="0">
     <tbody>
        <?php $class "even" ?>
        <?php while(osc_has_premiums()) { ?>
            <tr class="premium_<?php echo $class?>">
                <?php if( osc_images_enabled_at_items() ) { ?>
                 <td class="photo">
                     <?php if(osc_count_premium_resources()) { ?>
                        <a href="<?php echo osc_premium_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') ; ?>" title="" alt="" />
                    <?php ?>
                 </td>
                 <?php ?>
                 <td class="text">
                     <h3>
                         <span style="float:left;"><a href="<?php echo osc_premium_url() ; ?>"><?php echo osc_highlightstrip_tagsosc_premium_title() ) ); ?></a></span><span style="float:right;"><?php _e("Sponsored ad""italia"); ?></span>
                     </h3>
                     <p style="clear: left;">
                         <strong><?php if( osc_price_enabled_at_items() ) { echo osc_premium_formated_price() ; ?> - <?php } echo osc_premium_city(); ?> (<?php echo osc_premium_region(); ?>) - <?php echo osc_format_date(osc_premium_pub_date()); ?></strong>
                     </p>
                     <p><?php echo osc_highlightstrip_tagsosc_premium_description() ) ) ; ?></p>
                 </td>
             </tr>
            <?php $class = ($class == 'even') ? 'odd' 'even' ?>
        <?php ?>
    </tbody>
</table></div>


Vi allego uno screenshot e il file txt col codice.
« Last Edit: March 19, 2013, 04:27:25 am by seocomo »

sirjones

  • Full Member
  • ***
  • Posts: 102
Could You let met know plz how to show Parent Category Name of Premiums ads?

by using your premium ads code

Quote
                    <?php osc_get_premiums(12);
if(osc_count_premiums()>0) ?>
            <table border="0" cellspacing="0">
     <tbody>
        <?php $class = "even" ; ?>
        <?php while(osc_has_premiums()) { ?>
            <tr class="premium_<?php echo $class; ?>">
                <?php if( osc_images_enabled_at_items() ) { ?>
                 <td class="photo">
                     <?php if(osc_count_premium_resources()) { ?>
                        <a href="<?php echo osc_premium_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') ; ?>" title="" alt="" />
                    <?php } ?>
                 </td>
                 <?php } ?>
                 <td class="text">
                     <h3>
                         <span style="float:left;"><a href="<?php echo osc_premium_url() ; ?>"><?php echo osc_highlight( strip_tags( osc_premium_title() ) ); ?></a></span><span style="float:right;"><?php _e("Sponsored ad", "italia"); ?></span>
                     </h3>
                     <p style="clear: left;">
                         <strong><?php if( osc_price_enabled_at_items() ) { echo osc_premium_formated_price() ; ?> - <?php } echo osc_premium_city(); ?> (<?php echo osc_premium_region(); ?>) - <?php echo osc_format_date(osc_premium_pub_date()); ?></strong>
                     </p>
                     <p>I want to show "Parent Category Name" at here</p>
                 </td>
             </tr>
            <?php $class = ($class == 'even') ? 'odd' : 'even' ; ?>
        <?php } ?>
    </tbody>
</table></div>

AVBestDeals

  • Full Member
  • ***
  • Posts: 121
Hello all

Has anyone use this or gotten this to work on the new OSClass 3.2 Bender theme template?

Code: [Select]
<div class="latest_ads"><br /><br />
                    <h1><strong><?php _e('Annunci Premium''italia') ; ?></strong></h1>                   
                    <?php osc_get_premiums(12);
if(
osc_count_premiums()>0?>

            <table border="0" cellspacing="0">
     <tbody>
        <?php $class "even" ?>
        <?php while(osc_has_premiums()) { ?>
            <tr class="premium_<?php echo $class?>">
                <?php if( osc_images_enabled_at_items() ) { ?>
                 <td class="photo">
                     <?php if(osc_count_premium_resources()) { ?>
                        <a href="<?php echo osc_premium_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') ; ?>" title="" alt="" />
                    <?php ?>
                 </td>
                 <?php ?>
                 <td class="text">
                     <h3>
                         <span style="float:left;"><a href="<?php echo osc_premium_url() ; ?>"><?php echo osc_highlightstrip_tagsosc_premium_title() ) ); ?></a></span><span style="float:right;"><?php _e("Sponsored ad""italia"); ?></span>
                     </h3>
                     <p style="clear: left;">
                         <strong><?php if( osc_price_enabled_at_items() ) { echo osc_premium_formated_price() ; ?> - <?php } echo osc_premium_city(); ?> (<?php echo osc_premium_region(); ?>) - <?php echo osc_format_date(osc_premium_pub_date()); ?></strong>
                     </p>
                     <p><?php echo osc_highlightstrip_tagsosc_premium_description() ) ) ; ?></p>
                 </td>
             </tr>
            <?php $class = ($class == 'even') ? 'odd' 'even' ?>
        <?php ?>
    </tbody>
</table></div>

Regards
AVBestDeals

bohrapar

  • Jr. Member
  • **
  • Posts: 51
Hi, I used the code provided, but i seem to have some spacing issue, which Im not sure how to resolve. Please see the site: http://www.test.bartrit.com/

The "Chennai Express" poster is meant to be in the carousel, on the right, like: www.bartrit.com.
This is how my code looks like:
Code: [Select]
<div class="latest_ads"><br /><br />
                  <h1><strong><?php _e('Premium Listings''modern') ; ?></strong></h1> 
                   
                    <?php osc_get_premiums(2);
if(
osc_count_premiums()>0?>

            <table border="0" cellspacing="0">
     <tbody>
        <?php $class "even" ?>
        <?php while(osc_has_premiums()) { ?>
            <tr class="premium_<?php echo $class?>">
                <?php if( osc_images_enabled_at_items() ) { ?>
                 <td class="photo">
                     <?php if(osc_count_premium_resources()) { ?>
                        <a href="<?php echo osc_premium_url() ; ?>"><img src="<?php echo osc_resource_thumbnail_url() ; ?>" width="120" height="100" 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>
                         <span style="float:left;"><a href="<?php echo osc_premium_url() ; ?>"><?php echo osc_highlightstrip_tagsosc_premium_title() ) ); ?></a></span><span style="float:right;"><?php _e("Sponsored ad""modern"); ?></span>
                     </h3>
                     <p style="clear: left;">
                         <strong><?php if( osc_price_enabled_at_items() ) { echo osc_premium_formated_price() ; ?> - <?php } echo osc_premium_city(); ?> (<?php echo osc_premium_region(); ?>) - <?php echo osc_format_date(osc_premium_pub_date()); ?></strong>
                     </p>
                     <p><?php echo osc_highlightstrip_tagsosc_premium_description() ) ) ; ?></p>
                 </td>
             </tr>
            <?php $class = ($class == 'even') ? 'odd' 'even' ?>
        <?php ?>
    </tbody>
</table></div>                     
<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="120" height="100" 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_highlightstrip_tagsosc_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>
            <div id="sidebar">
            <br>
                <div class="navigation">
                <a href="http://www.imdb.com/title/tt2112124/" target="_blank">
                <img width="100%" border="0" alt="bartrit.com" src="http://www.bartrit.com/oc-content/themes/modern/images/Chennai_Express.jpg">
                </a>
                   
                    <?php if(osc_count_list_regions() > ) { ?>
                    <div class="box location">
                        <h3><strong><?php _e("Location"'modern'); ?></strong></h3>
                        <ul>
                        <?php while(osc_has_list_regions() ) { ?>
                            <li><a href="<?php echo osc_list_region_url(); ?>"><?php echo osc_list_region_name(); ?></a> <em>(<?php echo osc_list_region_items(); ?>)</em></li>
                        <?php ?>
                        </ul>
                    </div>
                    <?php ?>
                </div>
            </div>
        </div>
        <?php osc_current_web_theme_path('footer.php'); ?>
       
    </body>
</html>

kosh_sh

  • Newbie
  • *
  • Posts: 5
Hello, thank you for this code, its working perfect for me, but anybody know how to fix this code that to get premium items on mainpage like this:

Category 1:
Premium items on this category.

Category 2:
Premium items on this category.

Category 3:
Premium items on this category.

etc..............

zombie

  • Sr. Member
  • ****
  • Posts: 376
Old thread but with good content. Could anyone suggest how to compare pub_date and mod_date and display this date on ad and also sort the premium list by most recent of both dates in descending order? osc_get_premiums() returns the array and the values of these keys could possibly be compared but how to compare it to the payment date from paypal_log table? That would make most sense for this option.

Regards!