Problem to insert adsense code to a newsfeet.php

Bartek Juraszek Posted in General Discussion 9 years ago

Hi.

I tried to put adsense code to a newsfeet.php file like here : https://www.opensource-socialnetwork.org/discussion/view/505/how-to-use-google-ad-sense

But it does not work for me :(
Can anybdoy help me please ?

This is my newsfeet.php file :

<?php

/**
* Open Source Social Network
*
* @package (Informatikon.com).ossn
* @author OSSN Core Team <[email protected]>
* @copyright 2014 iNFORMATIKON TECHNOLOGIES
* @license General Public Licence http://www.opensource-socialnetwork.org/licence
* @link http://www.opensource-socialnetwork.org/licence
*/
?>
<style> body {
background: #FDFDFD;
} </style>
<div class="ossn-layout-newsfeed">
<div class="ossn-inner">
<div class="coloum-left">
&nbsp;
<?php
if (ossn_is_hook('newsfeed', "sidebar:left")) {
$newsfeed_left = ossn_call_hook('newsfeed', "sidebar:left", NULL, array());
echo implode('', $newsfeed_left);
}
?>

    </div>
    <div class="coloum-middle">
        <?php echo $params['content']; ?>

    </div>
    <div class="coloum-right">
        <div style="padding:12px;min-height:300px;">
            <?php
            if (com_is_active('OssnAds')) {
                echo ossn_plugin_view('ads/page/view');
            }
        if (ossn_is_hook('newsfeed', "sidebar:right")) {
                    $newsfeed_right = ossn_call_hook('newsfeed', "sidebar:right", NULL, array());
                echo implode('', $newsfeed_right);
            }                   
            ?>
        </div>
    </div> 

Where can i put the adsense code ?

Replies
ng Abayomi Oladipupo Replied 9 years ago

According to AdSense terms of service,
AdSense rules go against any social networking site, if you have a working and activated AdSense account, please don't put your AdSense code on it, it may result to your adsense account been disabled or banned from using adsense service.

German Michael Zülsdorff Replied 9 years ago

Ok,

so could you please provide the adsense code?
I'll have a look what happens. :)

Polish Bartek Juraszek Replied 9 years ago

@ Zetman

Yes you are right. I'm neewbie in PHP and CSS . But the more I ask the more I learn.
It's no problem with editing php file after update. Every edited file is copied to the disk.

So as i wrote. The problem with HTMLSidebar is :
After copying the adsens code to the htmlsidebar i go to the homepage and it's work . But only until page refresh. After that, you can see on the homepage the place where the adsense advertisment should be but is white ( without contents ).

Maybe the problem is that i use ADSManager and Htmlsidebar together ? But i need both.

Gruss ;)

German Michael Zülsdorff Replied 9 years ago

@Malik

We appreciate helping each other, no doubt. But there's no need to post the same trick twice, even more when a member has no or just a limited knowledge in coding. Creating a mixup of core functionality and static data is a bad idea anyway, because the next OSSN update may overwrite this file, Bartek's changes will be lost and he has to start all over again.

There's a safe and easy way placing ads or what you want by means of the htmlsidebar module - so please leave core files untouched.

pk Malik Ehsaan Replied 9 years ago

Please See Below Where i mention Paste Your Adsens Code 160x600 Here

<?php if (ossnishook('newsfeed', "sidebar:left")) { $newsfeedleft = ossncallhook('newsfeed', "sidebar:left", NULL, array()); echo implode('', $newsfeedleft); } ?>
</div>
Paste Your Adsens Code 160x600 Here
<div class="coloum-middle">
<?php echo $params["content"]; ?>

</div>
<div class="coloum-right">
    <div style="padding:12px;min-height:300px;">
        <?php
        if (com_is_active("OssnAds")) {
            echo ossn_plugin_view("ads/page/view");
        }
    if (ossn_is_hook("newsfeed", "sidebar:right")) {
                $newsfeed_right = ossn_call_hook("newsfeed", "sidebar:right", NULL, array());
            echo implode("", $newsfeed_right);
        }                   
        ?>

Paste Your Adsens Code 160x600 Here
</div>
</div>

Polish Bartek Juraszek Replied 9 years ago

On the right sidebar i have a adclickable and under the htmlsidebar component installed.
The adclickable component work good.
In the htmlsidebar component i put the adsense code , generated via my google adsense account.
When i go to my homepage , both installer working good.
Htmlsidebar shows adsense advertisment.
But after refreshing the page , the adclickable works still good and htmlsidebar remains visible but without contents ( blank - without adsesnse advertisment).

But it does not matter now :( Google wrote me today that my site have to little contest to have a adsense advertismet.

German Michael Zülsdorff Replied 9 years ago

Sorry, but I can not follow.
What does it mean: It working good until site refreshing?

  1. Did you have some adds in the sidebar before - and now they are not shown anymore?
  2. What happens if you disable the htmlsidebar component - are those adds back again?
  3. Which code did you enter into the htmlsidebar component?
Polish Bartek Juraszek Replied 9 years ago

Yes , i have htmlsidebar installed.
It working good until site refreshing. After that the sidebar is blank :(