Topic: Need a bit of help with an xml code

I am trying to modify the quardric adsense manager to make the adsense after first post look like a post with an ad inside it. I copied some code from the old 1.2 version of that mod.

here is my modified version:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">

<!--
/**
 * AdSense Manager - show ads in forum
 * Extension for PunBB 1.4
 *
 * @copyright (C) 2011 quadric quadmachine@wp.pl
 * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
 * @package quadric_image_assistant
 * 
 * Extension for PunBB (C) 2011 PunBB
 * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
 * 
 */
-->

<extension engine="1.0">
    <id>quadric_adsense_manager</id>
    <title>Quadric AdSense Manager</title>
    <version>1.0.1</version>
    <description>Manage AdSense in forum.</description>
    <author>Quadric</author>

    <minversion>1.4</minversion>
    <maxtestedon>1.4.2</maxtestedon>

    <install><![CDATA[
        forum_config_add('o_quadric_adsense_manager_s1_enabled', '0');
        forum_config_add('o_quadric_adsense_manager_s1_client', '');
        forum_config_add('o_quadric_adsense_manager_s1_width', '');
        forum_config_add('o_quadric_adsense_manager_s1_height', '');
        forum_config_add('o_quadric_adsense_manager_s1_slot', '');
        
        forum_config_add('o_quadric_adsense_manager_s2_enabled', '0');
        forum_config_add('o_quadric_adsense_manager_s2_client', '');
        forum_config_add('o_quadric_adsense_manager_s2_width', '');
        forum_config_add('o_quadric_adsense_manager_s2_height', '');
        forum_config_add('o_quadric_adsense_manager_s2_slot', '');
        
    ]]></install>


    <uninstall><![CDATA[
        forum_config_remove(array(
            'o_quadric_adsense_manager_s1_enabled',
            'o_quadric_adsense_manager_s1_client',
            'o_quadric_adsense_manager_s1_width',
            'o_quadric_adsense_manager_s1_height',
            'o_quadric_adsense_manager_s1_slot',
            
            'o_quadric_adsense_manager_s2_enabled',
            'o_quadric_adsense_manager_s2_client',
            'o_quadric_adsense_manager_s2_width',
            'o_quadric_adsense_manager_s2_height',
            'o_quadric_adsense_manager_s2_slot'
        ));
    ]]></uninstall>

    
    <hooks>
    
        <hook id="hd_gen_elements"><![CDATA[
        
            if ($forum_config['o_quadric_adsense_manager_s1_enabled'] && stripos(get_current_url(), 'admin/') === false) {

                $ad = '<script type="text/javascript"><!--
                    google_ad_client = "' . $forum_config['o_quadric_adsense_manager_s1_client'] . '";
                    google_ad_slot = "' . $forum_config['o_quadric_adsense_manager_s1_slot'] . '";
                    google_ad_width = ' . $forum_config['o_quadric_adsense_manager_s1_width'] . ';
                    google_ad_height = ' . $forum_config['o_quadric_adsense_manager_s1_height'] . ';
                    //-->
                </script>
<div class="blockpost<?php echo ($post_count % 2 == 0) ? ' roweven' : ' rowodd' ?>">
    <h2><span><?php echo format_time($cur_post['posted']) ?></span></h2>
    <div class="box">
        <div class="inbox">
            <div class="postbody">
                <div class="postleft">
                    <dl>
                        <dt><strong><?php echo $adsense_config['google_bot_name'] ?></strong></dt>
                        <dd class="usertitle"><strong>Advertisement</strong></dd>
                    </dl>
                </div>
                <div class="postright">
                    <h3><?php echo $lang_topic['Re'].' '; ?><?php echo pun_htmlspecialchars($cur_topic['subject']) ?></h3>
                    <div class="postmsg">
                    <?php echo "<br /><div style=\"TEXT-ALIGN: left\">                
                <script type="text/javascript"
                    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
                </script>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>                
                ';
            
                // Forum Title
                $gen_elements['<!-- forum_title -->'] = '<div style="float:right">'.$ad.'</div><p id="brd-title"><a href="'.forum_link($forum_url['index']).'">'.forum_htmlencode($forum_config['o_board_title']).'</a></p>';
            }
        ]]></hook>
    
        <hook id="vt_row_pre_display"><![CDATA[
            
            if ($forum_config['o_quadric_adsense_manager_s2_enabled'] && $forum_page['item_count'] == 2) {
            
                echo '<script type="text/javascript"><!--
                    google_ad_client = "' . $forum_config['o_quadric_adsense_manager_s2_client'] . '";
                    google_ad_slot = "' . $forum_config['o_quadric_adsense_manager_s2_slot'] . '";
                    google_ad_width = ' . $forum_config['o_quadric_adsense_manager_s2_width'] . ';
                    google_ad_height = ' . $forum_config['o_quadric_adsense_manager_s2_height'] . ';
                    //-->
                </script>
                <div style="text-align:center;">
                <script type="text/javascript"
                    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
                </script>
                </div>
                ';
            }
            
        ]]></hook>
        
        <hook id="vt_end"><![CDATA[
         
            if ($forum_config['o_quadric_adsense_manager_s2_enabled'] && $forum_page['item_count'] == 1) {

                echo '<script type="text/javascript"><!--
                    google_ad_client = "' . $forum_config['o_quadric_adsense_manager_s2_client'] . '";
                    google_ad_slot = "' . $forum_config['o_quadric_adsense_manager_s2_slot'] . '";
                    google_ad_width = ' . $forum_config['o_quadric_adsense_manager_s2_width'] . ';
                    google_ad_height = ' . $forum_config['o_quadric_adsense_manager_s2_height'] . ';
                    //-->
                </script>
                <div style="text-align:center;">
                <script type="text/javascript"
                    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
                </script>
                </div>
                ';
            }
        
        ]]></hook>
        
        <hook id="ca_new_function"><![CDATA[
            if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php'))
                include $ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php';
            else
                include $ext_info['path'].'/lang/English/quadric_adsense_manager.php';
        ]]></hook>
        
        <hook id="ca_fn_generate_admin_menu_new_sublink"><![CDATA[
            if (FORUM_PAGE_SECTION == 'settings') {
                $forum_page['admin_submenu']['qam_links'] = '<li class="'.((FORUM_PAGE == 'admin-quadric-adsense-manager') ? 'active' : 'normal').((empty($forum_page['admin_submenu'])) ? ' first-item' : '').'"><a href="'.forum_link('admin/settings.php?section=quadric_adsense_manager').'">'.$GLOBALS['lang_quadric_adsense_manager']['Settings title'].'</a></li>';
            }
        ]]></hook>

        <hook id="aop_new_section"><![CDATA[
            if ($section == 'quadric_adsense_manager') {
                require $ext_info['path'].'/quadric_adsense_manager_page.php';
            }
        ]]></hook>

    </hooks>

</extension>

Can anyone tell me what i am doing wrong.

MyFootballCafe.com  is Now Online!

2

Re: Need a bit of help with an xml code

Did u find a solution to this. Im interested to

Re: Need a bit of help with an xml code

nope. this forums are dead lol.

MyFootballCafe.com  is Now Online!

Re: Need a bit of help with an xml code

This forum is not dead.

5 (edited by SuperMAG 2012-11-15 08:21)

Re: Need a bit of help with an xml code

lol they are almost dead because i have to help all those people with topics, i dont even have a coding knowledge.

MyFootballCafe.com  is Now Online!

Re: Need a bit of help with an xml code

I do not know English so to always understand what users want.

Re: Need a bit of help with an xml code

i am not talking about you, you are doing the best you can, but punbb doesn't have the same support they had few years ago before the fork.

MyFootballCafe.com  is Now Online!

8

Re: Need a bit of help with an xml code

SuperMAG wrote:

i am not talking about you, you are doing the best you can, but punbb doesn't have the same support they had few years ago before the fork.

I agree.