A A A

Please consider registering
guest

Log In Register

Register | Lost password?
Advanced Search:

— Forum Scope —



— Match —



— Forum Options —




Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
Anyone want to help me with Adsense?
Jul 17, 2010
10:40 am
Rookie
Forum Posts: 1
Member Since:
Jul 17, 2010
Offline

Can anyboy help me please?

I'ts the first time I try to add adsense to my forum but I've got this error:

 

Parse error: syntax error, unexpected '}' in /home/manuel/public_html/wp-content/plugins/simple-forum/forum/hooks/sf-hook-template.php on line 240

 

The code I have added is:

 

function sf_hook_post_topic($forumid, $topicid)
 {
 $adsense='<script type="text/javascript"><!–
 google_ad_client = "pub-3617166114262860";
  /* 200x200, creado 16/07/10 */
  google_ad_slot = "7621746195";
  google_ad_width = 200;
  google_ad_height = 200;
   //–>
  </script>
  <script type="text/javascript"
  src="http://pagead2.googlesyndicati…..how_ads.js">
  </script>';
   return $adsense
   }

 

Thanks for your help!

 

Jul 17, 2010
12:17 pm

SP Master
Forum Posts: 22223
Member Since:
Nov 9, 2008
Offline

return $adsense;
Needs that semi-colon on the end…

Yellow Swordfish
Dec 29, 2010
9:41 pm
Boa
Guest

Hi, I want to put the adsens on the right side of every post. My code is like this:

 

sf_hook_post_content()
{
$adsense='<script type="text/javascript"><!–
google_ad_client = "pub-XXXXXXXXXXXXXXX";
/* 250x250, criado 18/04/10 */
google_ad_slot = "XXXXXXXXXX";
google_ad_width = 250;
google_ad_height = 250;
//–>
</script>
<script type="text/javascript"
src="http://pagead2……..ow_ads.js">
</script>';
return $adsense;
}
    Displays content after any text belonging to the
    WordPress page but prior to the start of forum display.
    This will display on all forum views
    —————————————————— */

    function sf_hook_post_content()
    {
        return '';
    }

 

And an error apperas:

Parse error: syntax error, unexpected '=' in E:home…..simple-forumforumhookssf-hook-template.php on line 131

 

Can you help me plz?

Dec 29, 2010
10:28 pm

SP Master
Forum Posts: 23688
Member Since:
Dec 10, 2006
Offline

not sure what you have posted…  you dont call the function…  you put your code inside it… after copying the hook.txt file to .php file as detailed in file and on wiki…

so change

function sf_hook_post_content()
{
return '';
}

to

function sf_hook_post_content()
{
$adsense='<script type="text/javascript"><!–
google_ad_client = "pub-XXXXXXXXXXXXXXX";
/* 250x250, criado 18/04/10 */
google_ad_slot = "XXXXXXXXXX";
google_ad_width = 250;
google_ad_height = 250;
//–>
</script>
<script type="text/javascript"
src="http://pagead2……..ow_ads.js">
</script>';
return $adsense;
}
Dec 30, 2010
3:57 pm
Boa
Guest

thx, it worked but, the place where the ad is appearing is wrong. I want to show the ad like this, on the right side of every post.

___________

|                      |

|  Ad Here     |

|                      |

|__________|

Dec 30, 2010
4:17 pm
Boa
Guest

I discovered myself, it must be put on the 'function sf_hook_pre_post'. Thx a lot!

Dec 30, 2010
4:49 pm

SP Master
Forum Posts: 23688
Member Since:
Dec 10, 2006
Offline

np. glad you figured it out and that we could help you!

Mar 4, 2011
10:55 am
murat
Guest

sf-hook-template.php ı prepare this file and sending here ;

simple-forum/forum/hooks

but not work adsense code and page,

Where is send this sf-hook-template.php

Mar 4, 2011
5:44 pm

SP Master
Forum Posts: 23688
Member Since:
Dec 10, 2006
Offline

have you read the instructions?  our wiki has details on how to use the hooks…

but simplistically…

1) rename the sf-hook-template.txt to sf-hook-template.php

2) find the hook (determines the location) you want to use

3) add your hook code. it should return the result, not echo it

There are dozens of examples on adding adsense in this forum… have a quick search…

If you give us more details on what you want to do (what, where, etc), we can help…

Forum Timezone: America/Chicago

Most Users Ever Online: 444

Currently Online: ptomislav, steve.engelking
58 Guest(s)

Currently Browsing this Page:
2 Guest(s)

See All Online Activity

Top Posters:

-Radio-: 1251

Lee H: 606

Luffer: 535

Conrad_Farlow: 502

jim: 478

neon: 263

ovizii: 240

Tal: 240

Member Stats:

Guest Posters: 2625

Members: 7361

Moderators: 1

Admins: 2

Forum Stats:

Groups: 5

Forums: 16

Topics: 10890

Posts: 79543

Moderators: Brandon C (162)

Administrators: Yellow Swordfish (22223), Mr Papa (23688)