News:

Help keep this project going by donating or buying adseller pro

Main Menu
Coinbase

Re: Edits for ad mod_1-0-7_v1-0-2b on Smf 1.0.7 (Index.template.php edits)

Started by cslepage, August 09, 2006, 05:51:30 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

cslepage

Quote from: bigguy on July 04, 2006, 11:13:30 AM
NEXT EDIT: In your themes directory of the theme you want to modify find the "Index.template.php" file open it.

In same file find:

Quoteecho '

and replace with:

Quoteglobal $modSettings;
   echo '</td></tr>';
if ($modSettings['js_text_displayads_botindex'] && allowedTo('ad_manageperm'))
{
   echo '   <tr><td id="bodyarea">
            <div align="center">',$modSettings['js_text_content'],'</div><br /></td></tr>';
}

   echo '</table>';

Save, close and upload....after backing up the original "Index.template.php"

Which "echo'" do I replace? 

Also, if the theme doesn't contain one of the files mentioned, like "MessageIndex.template.php," do I make the changes in the "MessageIndex.template.php" for the default theme instead?

bigguy

If the theme you are using doesn`t contain one of the template files the changes will have already been made to the one in the default theme so you don`t have to worry about those edits. Also you want to be looking for the first:

Quoteecho '

after the first edit you made in that file. Does that make sense.

NOTE: Remember to backup the file you are working on before editing anything.

cslepage

If I make those changes to the files in the default theme, does that mean the ads I intend for the non default theme will also show up in the default theme?

I have a forum on my board with its own theme, and only that forum, initially, would have ads.

Also, can this mod be used to show ads only to guests?

bigguy

You shouldn`t have to make any changes to the default theme files. When the mod installs it only installs to the default theme. You have to make changes to any template files that are in your custom theme folder. Yes this mod can be used only to show ads to guests if this is the way you have it set in your permissions.

cslepage

Quote from: bigguy on August 09, 2006, 01:41:41 PM
If the theme you are using doesn`t contain one of the template files the changes will have already been made to the one in the default theme so you don`t have to worry about those edits. Also you want to be looking for the first:

Quoteecho '

after the first edit you made in that file. Does that make sense.

The next echo ' I see is in here:

function template_main_below()
{
    global $context, $settings, $options, $scripturl, $txt;

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

Is that the one I replace?

bigguy

No goto the next, try to find the one (and there is one in most templates) that as the space at the front of it.

cslepage

Here's the rest of the file after the first edit:

Quote<td class="bg" style="padding: 1ex 20px 2ex 20px;">';
}

function template_main_below()
{
    global $context, $settings, $options, $scripturl, $txt;

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

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

    <div class="bg" style="text-align: center; padding-bottom: 1ex;', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? ' width: 100%;' : '', '">
        <table cellspacing="0" cellpadding="3" border="0" align="center" width="100%">
            <tr>
                <td valign="middle" align="center" style="white-space: nowrap;">
                    ', theme_copyright(), '
                </td>
            </tr>
        </table>';

    // Show the load time?
    if ($context['show_load_time'])
        echo '
        <span class="smalltext">', $txt['smf301'], $context['load_time'], $txt['smf302'], $context['load_queries'], $txt['smf302b'], '</span>';

    echo '
        </div>';

    // This is an interesting bug in Internet Explorer AND Safari.  Rather annoying, it makes overflows just not tall enough.
    if ($context['browser']['is_ie'] && !$context['browser']['is_ie4'] || $context['browser']['is_mac_ie'] || $context['browser']['is_safari'])
    {
        // The purpose of this code is to fix the height of overflow: auto div blocks, because IE can't figure it out for itself.
        echo '
        <script language="JavaScript" type="text/javascript"><!--';

        // Unfortunately, Safari does not have a "getComputedStyle" implementation yet, so we have to just do it to code...
        if ($context['browser']['is_safari'])
            echo '
            window.addEventListener("load", smf_codeFix, false);

            function smf_codeFix()
            {
                var codeFix = document.getElementsByTagName ? document.getElementsByTagName("div") : document.all.tags("div");

                for (var i = 0; i < codeFix.length; i++)
                {
                    if (codeFix.className == "code" && codeFix.offsetHeight < 20)
                        codeFix.style.height = (codeFix.offsetHeight + 20) + "px";
                }
            }';
        else
        {
            echo '
            var window_oldOnload = window.onload;
            window.onload = smf_codeFix;

            function smf_codeFix()
            {
                var codeFix = document.getElementsByTagName ? document.getElementsByTagName("div") : document.all.tags("div");

                for (var i = 0; i < codeFix.length; i++)
                {
                    if (codeFix.currentStyle.overflow == "auto" && (codeFix.currentStyle.height == "" || codeFix.currentStyle.height == "auto") && (codeFix.scrollWidth > codeFix.clientWidth || codeFix.clientWidth == 0))
                        codeFix.style.height = (codeFix.offsetHeight + 36) + "px";
                }

                if (window_oldOnload)
                    window_oldOnload();
            }';
        }

        echo '
        // --></script>';
    }

    echo '
    </body>
</html>';
}

// Show a linktree.  This is that thing that shows "My Community | General Category | General Discussion"..
function theme_linktree()
{
    global $context, $settings, $options;

    // Folder style or inline?  Inline has a smaller font.
    echo '<span class="nav"', $settings['linktree_inline'] ? ' style="font-size: smaller;"' : '', '>';

    // Each tree item has a URL and name.  Some may have extra_before and extra_after.
    foreach ($context['linktree'] as $link_num => $tree)
    {
        // Show the | | |-[] Folders.
        if (!$settings['linktree_inline'])
        {
            if ($link_num > 0)
                echo str_repeat('<img src="' . $settings['images_url'] . '/icons/linktree_main.gif" alt="| " border="0" />', $link_num - 1), '<img src="' . $settings['images_url'] . '/icons/linktree_side.gif" alt="|-" border="0" />';
            echo '<img src="' . $settings['images_url'] . '/icons/folder_open.gif" alt="+" border="0" />&nbsp; ';
        }

        // Show something before the link?
        if (isset($tree['extra_before']))
            echo $tree['extra_before'];

        // Show the link, including a URL if it should have one.
        echo '<b>', $settings['linktree_link'] && isset($tree['url']) ? '<a href="' . $tree['url'] . '" class="nav">' . $tree['name'] . '</a>' : $tree['name'], '</b>';

        // Show something after the link...?
        if (isset($tree['extra_after']))
            echo $tree['extra_after'];

        // Don't show a separator for the last one.
        if ($link_num != count($context['linktree']) - 1)
            echo $settings['linktree_inline'] ? ' &nbsp;|&nbsp; ' : '<br />';
    }

    echo '</span>';
}

// Show the menu up top.  Something like [home] [help] [profile] [logout]...
function template_menu()
{
    global $context, $settings, $options, $scripturl, $txt;

    // Show the [home] and [help] buttons.
    echo '
                <a href="', $scripturl, '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/home.gif" alt="' . $txt[103] . '" style="margin: 2px 0;" border="0" />' : $txt[103]), '</a>', $context['menu_separator'], '
                <a href="', $scripturl, '?action=help" target="_blank">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/help.gif" alt="' . $txt[119] . '" style="margin: 2px 0;" border="0" />' : $txt[119]), '</a>', $context['menu_separator'];

    // How about the [search] button?
    if ($context['allow_search'])
        echo '
                <a href="', $scripturl, '?action=search">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/search.gif" alt="' . $txt[182] . '" style="margin: 2px 0;" border="0" />' : $txt[182]), '</a>', $context['menu_separator'];

    // Is the user allowed to administrate at all? ([admin])
    if ($context['allow_admin'])
        echo '
                <a href="', $scripturl, '?action=admin">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin.gif" alt="' . $txt[2] . '" style="margin: 2px 0;" border="0" />' : $txt[2]), '</a>', $context['menu_separator'];

    // Edit Profile... [profile]
    if ($context['allow_edit_profile'])
        echo '
                <a href="', $scripturl, '?action=profile">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/profile.gif" alt="' . $txt[79] . '" style="margin: 2px 0;" border="0" />' : $txt[467]), '</a>', $context['menu_separator'];

    // The [calendar]!
    if ($context['allow_calendar'])
        echo '
                <a href="', $scripturl, '?action=calendar">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar.gif" alt="' . $txt['calendar24'] . '" style="margin: 2px 0;" border="0" />' : $txt['calendar24']), '</a>', $context['menu_separator'];

    // If the user is a guest, show [login] and [register] buttons.
    if ($context['user']['is_guest'])
    {
        echo '
                <a href="', $scripturl, '?action=login">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/login.gif" alt="' . $txt[34] . '" style="margin: 2px 0;" border="0" />' : $txt[34]), '</a>', $context['menu_separator'], '
                <a href="', $scripturl, '?action=register">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/register.gif" alt="' . $txt[97] . '" style="margin: 2px 0;" border="0" />' : $txt[97]), '</a>';
    }
    // Otherwise, they might want to [logout]...
    else
        echo '
                <a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108] . '" style="margin: 2px 0;" border="0" />' : $txt[108]), '</a>';
}

?>

I honestly don't know which "echo" to choose.

bigguy

Find this part in the file:

Quoteecho '
        </div>';

    // This is an interesting bug in Internet Explorer AND Safari.  Rather annoying, it makes overflows just not tall enough.
    if ($context['browser']['is_ie'] && !$context['browser']['is_ie4'] || $context['browser']['is_mac_ie'] || $context['browser']['is_safari'])
    {

and replace the:

Quoteecho '

part with this:

Quoteglobal $modSettings;
   echo '</td></tr>';
if ($modSettings['js_text_displayads_botindex'] && allowedTo('ad_manageperm'))
{
   echo '   <tr><td id="bodyarea">
            <div align="center">',$modSettings['js_text_content'],'</div><br /></td></tr>';
}

   echo '</table>';

NOTE: back it up before trying this.

cslepage

None of the three themes I use (default, helios multi, smiley) would accept that modification.  I can get ads to show up as the second message, and on the board index, but none of the others work so far.

bigguy

The default theme should already be modified, you don`t have to do that at all.

cslepage

When I installed the 1.07 ad mod, I got "failure" on index.template.php, boardindex.template.php, and display.template.php.

Oh, and I was wrong:  everything but ads at the top and bottom are working.


cslepage

I found it!

I had to find this:

Quoteecho '</td>
    </tr></table>';

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

And replace

Quoteecho '</td>
    </tr></table>';

with:

Quoteglobal $modSettings;
   echo '</td></tr>';
if ($modSettings['js_text_displayads_botindex'] && allowedTo('ad_manageperm'))
{
   echo '   <tr><td id="bodyarea">
            <div align="center">',$modSettings['js_text_content'],'</div><br /></td></tr>';
}

   echo '</table>';



cslepage

Yes it is!  The only thing that would make it better would be for me to upgrade my forum to a newer version of SMF to get more ad features.