Advertisement:

Author Topic: trying to apply Ad Management to other themes  (Read 2921 times)

Offline cambob22

  • Newbie
  • *
  • Posts: 3
trying to apply Ad Management to other themes
« on: December 23, 2008, 02:52:52 PM »
I would like to apply ad management to other themes (other then the default).  I have tried to make the same changes to the files within the theme that I would like to change (in this instance, I would like to use ad manager with classic YaBB theme), and I was not able to find all of the changes that would need to be made.  Any suggestions?

Just as a note, I was trying to make the changes to ./Themes/default/index.template.php in /themes/classic/index.template.php as per the install directions.  I was unable to find  <div class="windowbg2 clearfix">'; within the body of the index.template.php file in the classics sub folder.  Has anyone made this modification successfully? Thanks in advance for any help.
« Last Edit: December 23, 2008, 04:16:08 PM by cambob22 »

Offline sherpa サイバー侍

  • Sophist Member
  • *****
  • Posts: 1,057
  • Gender: Male
    • Bridge to Nepal and Nepali
Re: trying to apply Ad Management to other themes
« Reply #1 on: December 23, 2008, 07:32:31 PM »
Why dont you try Package Parser

Offline cambob22

  • Newbie
  • *
  • Posts: 3
Re: trying to apply Ad Management to other themes
« Reply #2 on: December 23, 2008, 08:58:10 PM »
The issue is not with the installation of ad management.  It works with the default theme.  The problem is with making the proper changes to the files for other themes to get it to work with them

Offline ѕησω

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,432
  • Gender: Male
  • Nisi credideritis, non intelligetis.
    • wade.poulsen93 on Facebook
    • acans on GitHub
    • https://www.linkedin.com/profile/view?id=145186638 on LinkedIn
    • @imacans on Twitter
    • Acans
Re: trying to apply Ad Management to other themes
« Reply #3 on: December 24, 2008, 01:39:14 AM »
http://custom.simplemachines.org/mods/index.php?mod=255

Select Manual Install Instructions for SMF make shore its set your your version and select Submit
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not dead yet, the time was soon to come to pass when mysql_query shall be gone and no more."

Offline cambob22

  • Newbie
  • *
  • Posts: 3
Re: trying to apply Ad Management to other themes
« Reply #4 on: December 24, 2008, 09:02:23 AM »
Okay, here's the problem.  I have done the manual install steps, and as I stated before, they do work for the default theme.  But when I attempted to adjust the following lines of scripts for the classic theme:

./Themes/default/index.template.php
Find: [Select]

<body>';

Add After: [Select]

   
   //Display ads on the top of the page
   if (function_exists("show_topofpageAds"))
   {
      $ads = show_topofpageAds();   
      if(!empty($ads))
         if($ads['type']==0)
            echo $ads['content'];
         else
            eval($ads['content']);   
      unset($ads);
   }


Find: [Select]

         <div class="windowbg2 clearfix">';

Replace With: [Select]

         <div class="windowbg2 clearfix floatleft">';


Find: [Select]

   echo '
         </div>

Add After: [Select]

';
                     echo '<div class="windowbg2 clearfix" align="right">';
                     //Welcome Ads
                     if (function_exists("show_welcomeAds"))
                     {
                        $ads = show_welcomeAds();
                        if(!empty($ads))
                        {
                           echo '<td class="windowbg2">';
                           if($ads['type']==0)
                              echo $ads['content'];
                           else
                              eval($ads['content']);
                        }
                        unset($ads);
                     }
                     echo '</div>';
                  echo '


Find: [Select]

   template_menu();

Add After: [Select]


   //Below the menu ads
   if (function_exists("show_indexAds") && function_exists("show_towerleftAds") && function_exists("show_towerrightAds"))
   {
      $ads = show_indexAds();   
      if(!empty($ads))
         if($ads['type']==0)
            echo $ads['content'];
         else
            eval($ads['content']);
      unset($ads);

      //Tower left Ads
      $ads = show_towerleftAds();
      if(!empty($ads))
         echo '<table><tr><td valign="top">', $ads['type']==0 ? $ads['content'] : eval($ads['content']) ,'</td><td width="100%" valign="top">';

      unset($ads);
      //Tower Right Ads
      $ads = show_towerrightAds();   
      if(!empty($ads))
         echo '<table><tr><td width="100%" valign="top">';
      unset($ads);
   }   


Find: [Select]

   // Show the "Powered by" and "Valid" logos, as well as the copyright. Remember, the copyright must be somewhere!

Add Before: [Select]

   
   //Close table for towerright ads
   if (function_exists("show_towerrightAds") && function_exists("show_towerleftAds") && function_exists("show_bottomAds"))
   {
      $ads = show_towerrightAds();   
      if(!empty($ads))
         echo '</td><td valign="top">', $ads['type']==0 ? $ads['content'] : eval($ads['content']) ,'</td></tr></table>';

      unset($ads);
      //Close table for towerleft ads
      $ads = show_towerleftAds();   
      if(!empty($ads))
         echo '</td></tr></table>';
      unset($ads);

      //Show ads on the bottom of the page
      $ads = show_bottomAds();
      if(!empty($ads))
         if($ads['type']==0)
            echo $ads['content'];
         else
            eval($ads['content']);
      unset($ads);
   }


./Themes/default/BoardIndex.template.php
Find: [Select]

   // Show some statistics if stat info is off.

Add Before: [Select]


   //Display ads on the board index
   if (function_exists("show_boardAds"))
   {
      $ads = show_boardAds();
      if(!empty($ads))
         if($ads['type']==0)
            echo $ads['content'];
         else
            eval($ads['content']);
      unset($ads);
   }


Find: [Select]

      echo '
   </div>';

Add After: [Select]


   //Display ads Between cats
   if (function_exists("show_category"))
   {
      $ads = show_category($category['id']);
      if(!empty($ads))
         if($ads['type']==0)
            echo $ads['content'];
         else
            eval($ads['content']);
      unset($ads);
   }


./Themes/default/Display.template.php
Find: [Select]

global $context, $settings, $options, $txt, $scripturl, $modSettings;

Add After: [Select]


   //Display ads on the thread page
   if (function_exists("show_threadAds"))
   {
      $ads = show_threadAds();   
      if(!empty($ads))
         if($ads['type']==0)
            echo $ads['content'];
         else
            eval($ads['content']);
      unset($ads);
   }


Find: [Select]

   // Get all the messages...
   while ($message = $context['get_message']())
   {

Replace With: [Select]

   //Ad Counter
   $adcounter =0;
   // Get all the messages...
   while ($message = $context['get_message']())
   {
      $adcounter++;


Find: [Select]

      </div>';
   }

Replace With: [Select]

      </div>';
if (function_exists("show_posts"))
{
   if ($adpost = show_posts($adcounter))
   {
      if($modSettings['ads_lookLikePosts'])
      {
         echo '
         <div class="bordercolor">
            <div class="clearfix windowbg3 largepadding">';
   
         // Show information about the poster of this message.
         echo '
               <div class="floatleft poster">
                  <h4>', $context['forum_name'], '</h4>';
   
         // Done with the information about the poster... on to the post itself.
         echo '
               </div>
               <div class="postarea">
                  <div class="keyinfo">
                     <h5 id="subject_', $message['id'], '">
                        <a href="', $message['href'], '" rel="nofollow">', $message['subject'], '</a>
                     </h5>
                     <div class="smalltext">« <strong>', !empty($message['counter']) ? $txt['reply'] . ' #' . $message['counter'] : '', ' ', $txt['on'], ':</strong> ', $message['time'], ' »</div>
                     <div id="msg_', $message['id'], '_quick_mod"></div>
                  </div>';
   
         // If this is the first post, (#0) just say when it was posted - otherwise give the reply #.
         echo '
                  <ul class="smalltext postingbuttons">';
   
         // Can they reply? Have they turned on quick reply?
         if ($context['can_reply'] && !empty($options['display_quick_reply']))
            echo '
                     <li>', $reply_button, '</li>';
   
         // So... quick reply is off, but they *can* reply?
         elseif ($context['can_reply'])
            echo '
                     <li>', $reply_button, '</li>';
   
         // Can the user modify the contents of this post?
         if ($message['can_modify'])
            echo '
                     <li>', $modify_button, '</li>';
   
         // How about... even... remove it entirely?!
         if ($message['can_remove'])
            echo '
                     <li>', $remove_button, '</li>';
   
         // What about splitting it off the rest of the topic?
         if ($context['can_split'])
            echo '
                     <li>', $split_button, '</li>';
   
         // Can we restore topics?
         if ($context['can_restore_msg'])
            echo '
                     <li>', $restore_message_button, '</li>';
   
         // Show the post itself, finally!
         echo '
                  </ul>
                  <div class="post" id="msg_', $message['id'], '"', '>
                     ', $adpost['type'] == 0 ? $adpost['content'] : eval($adpost['content']) ,'
                  </div>

               </div>
            </div>
         </div>';
      }
      else
         echo '
            <div class="bordercolor">
               <div class="clearfix windowbg3 largepadding">', $adpost['type'] == 0 ? $adpost['content'] : eval($adpost['content']) ,'</div>
            </div>';
   }
}
   }
   
if(function_exists("show_lastpostAds") && function_exists("show_posts"))
{
   if(($adpost = show_lastpostAds()) && !show_posts($adcounter))
   {
      if($modSettings['ads_lookLikePosts'])
      {
         echo '
         <div class="bordercolor">
            <div class="clearfix windowbg3 largepadding">';
   
         // Show information about the poster of this message.
         echo '
               <div class="floatleft poster">
                  <h4>', $context['forum_name'], '</h4>';
   
         // Done with the information about the poster... on to the post itself.
         echo '
               </div>
               <div class="postarea">
                  <div class="keyinfo">&nbsp;
                     <div id="msg_', $message['id'], '_quick_mod">&nbsp;</div>
                  </div>';
   
         // If this is the first post, (#0) just say when it was posted - otherwise give the reply #.
         echo '
                  <ul class="smalltext postingbuttons">';
   
         // Can they reply? Have they turned on quick reply?
         if ($context['can_reply'] && !empty($options['display_quick_reply']))
            echo '
                     <li>', $reply_button, '</li>';
   
         // So... quick reply is off, but they *can* reply?
         elseif ($context['can_reply'])
            echo '
                     <li>', $reply_button, '</li>';
   
         // Show the post itself, finally!
         echo '
                  </ul>
                  <div class="post" id="msg_', $message['id'], '"', '>
                     ', $adpost['type'] == 0 ? $adpost['content'] : eval($adpost['content']) ,'

               </div>
            </div>
         </div>';
      }
      else
         echo '
            <div class="bordercolor">
               <div class="clearfix windowbg3 largepadding">', $adpost['type'] == 0 ? $adpost['content'] : eval($adpost['content']) ,'</div>
            </div>';
   }
}
echo '</div>';


./Themes/default/MessageIndex.template.php
Find: [Select]

global $context, $settings, $options, $scripturl, $modSettings, $txt;

Add After: [Select]


   //Display Ads on the Message index
   if (function_exists("show_threadindexAds"))
   {
      $ads = show_threadindexAds();
      if(!empty($ads))
         if($ads['type']==0)
            echo $ads['content'];
         else
            eval($ads['content']);
      unset($ads);
   }


Find: [Select]

      echo '
      </table>
   </div>';

Add After: [Select]

   //Display Ads on the Message index
   if (function_exists("show_underchildren"))
   {
      $ads = show_underchildren();
      if(!empty($ads))
         if($ads['type']==0)
            echo $ads['content'];
         else
            eval($ads['content']);
      unset($ads);
   }
   

To the files located in /themes/classic/(filename to be changed), I cannot find all of the lines that need to be changed.  I cannot find the following in /Themes/classsic/index.template.php:

<div class="windowbg2 clearfix">';

or

echo '
         </div>

Or the following in /Themes/classic/BoardIndex.template.php:

// Show some statistics if stat info is off.

or

      echo '
   </div>';

Or the following in /Themes/default/Display.template.php:

      </div>';
   }

Or the following in /Themes/default/MessageIndex.template.php:

      echo '
      </table>
   </div>';

I was able to find some of the spots in the code that need to be changed in each of the files, but not all of them.

Offline sherpa サイバー侍

  • Sophist Member
  • *****
  • Posts: 1,057
  • Gender: Male
    • Bridge to Nepal and Nepali
Re: trying to apply Ad Management to other themes
« Reply #5 on: December 24, 2008, 07:49:05 PM »
My friend
what you need to know is those are just a hint
you are modifying your themes mean you know what those cods ment to say!

Find: [Select]

         
Code: [Select]
<div class="windowbg2 clearfix">';Replace With: [Select]

       
Code: [Select]
<div class="windowbg2 clearfix floatleft">';
New change giving absolute path for user avatar and information to show in left

Find: [Select]

 
Code: [Select]
echo '
         </div>

Add After: [Select]

   
Code: [Select]
echo '
         </div>

Add After: [Select]

';
                     echo '<div class="windowbg2 clearfix" align="right">';
                     //Welcome Ads
                     if (function_exists("show_welcomeAds"))
                     {
                        $ads = show_welcomeAds();
                        if(!empty($ads))
                        {
                           echo '<td class="windowbg2">';
                           if($ads['type']==0)
                              echo $ads['content'];
                           else
                              eval($ads['content']);
                        }
                        unset($ads);
                     }
                     echo '</div>';
                  echo '

giving absolute path for add to show in right

From looks you may have realize classic doesnt shows user avatar mean we need to put your add between Hey, SMF, you have 2 messages, 0 are new. 2008-12-25, 09:00:07 and forum nav bar right?

Find
Code: [Select]
<tr class="windowbg2">
<td colspan="2" valign="middle" align="center" class="tborder" style="border-width: 1px 0 0 0; font-size: smaller;">';

// Show the menu here, according to the menu sub template.
template_menu();

echo '
</td>
</tr>';

add before

Code: [Select]
<tr class="windowbg2">
<td colspan="2" valign="middle" align="center" class="tborder" style="border-width: 1px 0 0 0;">';

//Welcome Ads
                     if (function_exists("show_welcomeAds"))
                     {
                        $ads = show_welcomeAds();
                        if(!empty($ads))
                        {
                           echo '<td class="windowbg2">';
                           if($ads['type']==0)
                              echo $ads['content'];
                           else
                              eval($ads['content']);
                        }
                        unset($ads);
                     }

</td>
</tr>


Offline sherpa サイバー侍

  • Sophist Member
  • *****
  • Posts: 1,057
  • Gender: Male
    • Bridge to Nepal and Nepali
Re: trying to apply Ad Management to other themes
« Reply #6 on: December 25, 2008, 08:02:20 PM »
Hello
did you fix your problem? If dont know how to work with it please attach the file here

Offline greyknight17

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 14,890
  • Gender: Male
    • Kevin's Resource Center
Re: trying to apply Ad Management to other themes
« Reply #7 on: January 16, 2009, 07:24:16 PM »
Is this issue resolved now?

If not, attach the file in question here as requested earlier.