News:

Version 3.5 has been released. Visit https://custom.simplemachines.org/mods/index.php?mod=255 to get the most up to date version.

Main Menu
Coinbase

Edits for ad_mod_1-1-1_v2-3

Started by bigguy, January 11, 2007, 07:42:32 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bigguy

These are the edits for the ad mod version 2.3

In index.php look for:

'trackip' => array('Profile.php', 'trackIP'),

Before that add:

'admod' => array('Ads.php', 'Ads'),

In the same file search for:

require_once($sourcedir . '/Security.php');

Before that add:

if (file_exists($sourcedir . '/LoadAds.php'))
require_once($sourcedir . '/LoadAds.php');


In the same file search for:

loadPermissions();

Before that add:

// Load all the ads up
if (function_exists("loadAds"))
loadAds();


Save and upload after backing up the original.
NOTE: Only do this edit if installing manually



In your Sources Directory find and open Subs.php, Search for:

loadLanguage('Admin');

Before that add:

loadLanguage('Ads');

In the same file search for:

'manage_themes' => '<a href="' . $scripturl . '?action=theme;sa=admin;sesc=' . $sc . '">' . $txt['theme_admin'] . '</a>',

Before that add:

'edit_addmod' => '<a href="' . $scripturl . '?action=admod">' . $txt['ad_management'] . '</a>',

Save and upload after backing up the original.
NOTE: Only do this edit if installing manually



In your theme directory find and open index.template.php and search for:

<body>';

After that add:

//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);
}


In the same file find:

</td>

After that add:

';
//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']);
echo '</td>';
}
unset($ads);
}
echo '


In the same file find:

template_menu();

After that add:

//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);
}


In the same file find:

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

Before that add:

//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);
}




In BoardIndex.template.php find:

// Show some statistics next to the link tree if SP1 info is off.

Before that add:

//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);
}


In the same file find:

echo '
</div>';


After that add:

//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);
}




In Display.template.php find:

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

After that add:

//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);
}


In the same file find:

// Get all the messages...

And replace with:

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


In the same file find:

</td></tr>';
}


And replace with:

</td></tr>';
if (function_exists("show_posts"))
{
if ($adpost = show_posts($adcounter))
{
if($modSettings['ads_lookLikePosts'])
{
echo '

<tr><td style="padding: 1px 1px 0 1px;">
<table width="100%" cellpadding="3" cellspacing="0" border="0">
<tr><td class="windowbg3">
<table width="100%" cellpadding="5" cellspacing="0" style="table-layout: fixed;">
<tr>
<td valign="top" width="16%" rowspan="2" style="overflow: hidden;">
<b>', $context['forum_name'], '</b>
<div class="smalltext">
</div>
</td>
<td valign="top" width="85%" height="100%">
<table width="100%" border="0"><tr>
<td valign="middle"><img src="', $message['icon_url'] . '" alt="" border="0" /></td>
<td valign="middle">
<div style="font-weight: bold;" id="subject_', $message['id'], '">
<a href="', $message['href'], '">', $message['subject'], '</a>
</div>
<div class="smalltext">&#171; <b>', !empty($message['counter']) ? $txt[146] . ' #' . $message['counter'] : '', ' ', $txt[30], ':</b> ', $message['time'], ' &#187;</div></td>
<td align="', !$context['right_to_left'] ? 'right' : 'left', '" valign="bottom" height="20" style="font-size: smaller;">';
if ($context['can_reply'] && !empty($options['display_quick_reply']))
echo '
', $reply_button, '';

// So... quick reply is off, but they *can* reply?
elseif ($context['can_reply'])
echo '
', $reply_button, '';

// Can the user modify the contents of this post?
if ($message['can_modify'])
echo '
', $modify_button, '';

// How about... even... remove it entirely?!
if ($message['can_remove'])
echo '
', $remove_button, '';

// What about splitting it off the rest of the topic?
if ($context['can_split'])
echo '
', $split_button, '';
echo '
</td>
</tr></table>
<hr width="100%" size="1" class="hrcolor" />
<div class="post">', $adpost['type'] == 0 ? $adpost['content'] : eval($adpost['content']) , '</div>
</td>
</tr>
<tr>
<td valign="bottom" class="smalltext" width="85%">
<table width="100%" border="0" style="table-layout: fixed;"><tr>
<td colspan="2" class="smalltext" width="100%">
</tr><tr>
<td valign="bottom" class="smalltext" id="modified_', $message['id'], '">
</td>
<td align="', !$context['right_to_left'] ? 'right' : 'left', '" valign="bottom" class="smalltext">
<img src="', $settings['images_url'], '/ip.gif" alt="" border="0" />&nbsp;', $txt[511], '
</td>
</tr></table>
</tr>
</table>
</td></tr>
</table>
</td></tr>';
}
else
echo '
<tr><td style="padding: 1px 1px 0 1px;">
<table width="100%" cellpadding="3" cellspacing="0" border="0">
<tr>
<td class="windowbg3">', $adpost['type'] == 0 ? $adpost['content'] : eval($adpost['content']) , '</td>
</tr>
</table>
</td></tr>';
}

}

}

if(function_exists("show_lastpostAds") && function_exists("show_posts"))
{
if(($ads = show_lastpostAds()) && !show_posts($adcounter))
{
if($modSettings['ads_lookLikePosts'])
{
echo '

<tr><td style="padding: 1px 1px 0 1px;">
<table width="100%" cellpadding="3" cellspacing="0" border="0">
<tr><td class="windowbg3">
<table width="100%" cellpadding="5" cellspacing="0" style="table-layout: fixed;">
<tr>
<td valign="top" width="16%" rowspan="2" style="overflow: hidden;">
<b>', $context['forum_name'], '</b>
<div class="smalltext">
</div>
</td>
<td valign="top" width="85%" height="100%">
<table width="100%" border="0"><tr>
<td valign="middle"><img src="', $message['icon_url'] . '" alt="" border="0" /></td>
<td valign="middle">
&nbsp;</td>
<td align="', !$context['right_to_left'] ? 'right' : 'left', '" valign="bottom" height="20" style="font-size: smaller;">';
if ($context['can_reply'] && !empty($options['display_quick_reply']))
echo '
', $reply_button, '';

// So... quick reply is off, but they *can* reply?
elseif ($context['can_reply'])
echo '
', $reply_button, '';


echo '
</td>
</tr></table>
<hr width="100%" size="1" class="hrcolor" />
<div class="post">', $ads['type'] == 0 ? $ads['content'] : eval($ads['content']) , '</div>
</td>
</tr>
<tr>
<td valign="bottom" class="smalltext" width="85%">
<table width="100%" border="0" style="table-layout: fixed;"><tr>
<td colspan="2" class="smalltext" width="100%">
</tr><tr>
<td valign="bottom" class="smalltext" id="modified_', $message['id'], '">
</td>
<td align="', !$context['right_to_left'] ? 'right' : 'left', '" valign="bottom" class="smalltext">
<img src="', $settings['images_url'], '/ip.gif" alt="" border="0" />&nbsp;', $txt[511], '
</td>
</tr></table>
</tr>
</table>
</td></tr>
</table>
</td></tr>';
}
else
echo '
<tr><td style="padding: 1px 1px 0 1px;">
<table width="100%" cellpadding="3" cellspacing="0" border="0">
<tr>
<td class="windowbg3">', $ads['type'] == 0 ? $ads['content'] : eval($ads['content']) , '</td>
</tr>
</table>
</td></tr>';

}

}




In MessageIndex.template.php find:

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

After that add:

//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);
}


In the same file find:

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


After that add:

//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);
}




In ManagePermissions.php in the sources directory find:

'pm' => array(

And replace with:

'ad_manage' => array(
'ad_manageperm' => false,
),
'pm' => array(


Save and upload after backing up the original.
NOTE: Only do this edit if installing manually



ONLY If installing manually you will require these 2 files to be in your Sources Directory:

Ads.php
LoadAds.php

And this file to be in your theme directory:

Ads.template.php

And this file to be in your Langauge directory:

Ads.english.php

sasawawa

Thanks, Biggue, just installed successful ,really cool ! ;)

blessing2006

hi, bigguy.

I uploaded ad management v2.3 to my smf forum using the admin panel. However, my adsense ads do not show anywhere.

Your post suggest i need to edit some files. But then i'm confused because you say "NOTE: Only do this edit if installing manually".

Should i do these edits even though i uploaded the ad management mod using the admin panel?

What else should i do to make the adsense ads show?

my site is . . .

http://www.nigerianewsjournal.com/forum/


bigguy

All you need to do is edit 4 template files in the theme you are using from the edits above.

DawnsWebDesigns

I'm using SMF 1.1.1., TinyPortal v0.9.7,  & Aero79 design by Bloc.  Your latest ad mod wouldn't install automatically...it had problems with Index.template.php & Display.template.php.  So I manually did those 2 & all is well.

The problem is trying to transfer it to the Aero79 theme.  I'm having a problem with Index.template.php & BoardIndex.template.php.  The coding you're telling me to look for either doesn't exist or it's written differently.  I wasn't able to add a couple of things at all.  Yet the ads appear & I get no error messages?  Still...I'd like it "right".

For instance...under BoardIndex.template.php you have: <search position="after"><![CDATA[// Show some statistics next to the link tree if SP1 info is off.]]></search>

I don't even have that.  So I did this:

function template_main()
{
   global $context, $settings, $options, $txt, $scripturl, $modSettings, $ID_MEMBER;

//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);
   }

   // Show the news fader?  (assuming there are things to show...)


And it works.  So is it ok?

Next you have: <search position="before"><![CDATA[      echo '
   </div>';]]></search>.  I don't have that either.  So I've got:

echo '
</table>
<br />';
//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);
   }
   }

   if ($context['user']['is_logged'])


But again it works...so is it ok?

I wasn't able to add

';
//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']);
echo '</td>';
}
unset($ads);
}
echo '


or

//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);
}
   

to index.template.php yet it still works/there's no error messages?  How can I get help with this?  Should I post a copy of the default index.template & the theme index.template?  Thanks, in advance, for any help.  :)

bigguy

If it is working and you get no errors then leave it. I probably would have done exactly the same thing. In some of the ad mods I install I can't put all the edits in because the code is not there. As you have found out it still works so I would leave it.

DawnsWebDesigns

Quote from: bigguy on January 30, 2007, 11:11:28 AM
If it is working and you get no errors then leave it. I probably would have done exactly the same thing. In some of the ad mods I install I can't put all the edits in because the code is not there. As you have found out it still works so I would leave it.

Yeah they're working.  I've got ads at the bottom of the pages...on the board index...after posts...& under child boards.  And no error messages. :)  It's a miracle.  :o  Thanks for your post & a great mod.  ;)

webmistress

I'm having the same issue of the ads or even the word testing to show up in the position where I have checked the ads. I thought "classic" was the default theme. So I see how to do everything that comes after this:

In index.php look for:

I have an index.php that came with the ad mod and it doesn't have much in it at all

<?php

// Try to handle it with the upper level index.php.  (it should know what to do.)
if (file_exists(dirname(dirname(__FILE__)) . '/index.php'))
include (dirname(dirname(__FILE__)) . '/index.php');
else
exit;

?>


In other words I'm not finding this code in either index.php file I have or any file for that matter. 'trackip' => array('Profile.php', 'trackIP'),

How can I get mine to work if I can't do this first step but I can do the rest?

bigguy

Only edit the template files. The index.php and all others should not have to be done if you have it installed. So only 4 template files to edit.

webmistress

#9
Okay, thank you so much. Do I need to do this part or not?

Ads.php
LoadAds.php

And this file to be in your theme directory:

Ads.template.php

And this file to be in your Langauge directory:

Ads.english.php


And which one of these in the template file? </td>
The one after smflogo.gif?

webmistress

I'm also not finding this in the board index file. I have classic installed. Does it go before the news fader code?

echo '
</div>';


Should I refer to this thread instead since I have classic?

http://www.smfads.com/forums/index.php?topic=22.0

blessing2006

hi.

There are 7 files mentioned above. You say in my case i need to edit only 4 of them.

What are the 4 files?

bigguy

messageindex.template.php
display.template.php
Boardindex.templeta.php
index.template.php

Farmacija

in the first message in isnt precised which </td> tag we should find [ there is a lot </td> tags in different places] and add ad code in index,template.php file. you should correct that!

bigguy

The edit for the ad mod that goes after the </td> is for the welcome user area of the template so you know it is going to be higher in the template file. What theme are you using. ???