Need to make adsense work
-
trud
Need to make adsense work
I posted similar post in the wrong forum, so I am posting here now.
I would like to use this desing for a site; avoidheartburn.com
As you see, there are one ad that would be placed just before {content}
How can I make a used defined tag that can handle this? I have read the handbook, but could not make it work.
My initial goal was to place everything in the template file, but then I saw that approach did not work. I guess javascript can not be inside js
I am sure the UDT is simple once it's done few times, but I have never done this before. So I would need wtep by step guiding. After all even the handbook did not make it for me.
I would like to use this desing for a site; avoidheartburn.com
As you see, there are one ad that would be placed just before {content}
How can I make a used defined tag that can handle this? I have read the handbook, but could not make it work.
My initial goal was to place everything in the template file, but then I saw that approach did not work. I guess javascript can not be inside js
I am sure the UDT is simple once it's done few times, but I have never done this before. So I would need wtep by step guiding. After all even the handbook did not make it for me.
-
cyberman
Re: Need to make adsense work
Please try thistrud wrote: I guess javascript can not be inside js
{literal} js {/literal}
Re: Need to make adsense work
step by step:
get your adsense code from google.
copy paste it as is into user defined tag (in extension -> user defined tags -> add user defined tag) as this code has javascript { and } we need to wrap it inside {literal} and {/literal} otherwise smarty will miss interperet those extra { } as its own. so add {literal} at the top and {/literal} at the bottom.
edit your template in which you want the ads to be shown. check where you want your ads (you might want to wrap em in ) and add call to your user defined tag with {name_of_your_udt}. save
refresh your page, and thats it.
could someone copy this to wiki Im too tired atm
get your adsense code from google.
copy paste it as is into user defined tag (in extension -> user defined tags -> add user defined tag) as this code has javascript { and } we need to wrap it inside {literal} and {/literal} otherwise smarty will miss interperet those extra { } as its own. so add {literal} at the top and {/literal} at the bottom.
edit your template in which you want the ads to be shown. check where you want your ads (you might want to wrap em in ) and add call to your user defined tag with {name_of_your_udt}. save
refresh your page, and thats it.
could someone copy this to wiki Im too tired atm
-
cyberman
Re: Need to make adsense work
Donetsw wrote: could someone copy this to wiki Im too tired atm![]()
-
tt5001
Re: Need to make adsense work
I am getting this error message when I try to add the UDT:tsw wrote: step by step:
get your adsense code from google.
copy paste it as is into user defined tag (in extension -> user defined tags -> add user defined tag) as this code has javascript { and } we need to wrap it inside {literal} and {/literal} otherwise smarty will miss interperet those extra { } as its own. so add {literal} at the top and {/literal} at the bottom.
edit your template in which you want the ads to be shown. check where you want your ads (you might want to wrap em in ) and add call to your user defined tag with {name_of_your_udt}. save
refresh your page, and thats it.
could someone copy this to wiki Im too tired atm
Invalid code entered.
Parse error: parse error, unexpected '}' in /home/tt1home/public_html/admin/adduserplugin.php(84) : eval()'d code on line 1
-
3dcandy
Re: Need to make adsense work
isn't there an adsense tag???
yup, log in as admin, goto extensions > tags and there is an adsense tag, with a bit of a help....
yup, log in as admin, goto extensions > tags and there is an adsense tag, with a bit of a help....
Last edited by 3dcandy on Sat Dec 02, 2006 10:05 pm, edited 1 time in total.
-
tt5001
Re: Need to make adsense work
Thanks, you are correct, but I am not sure how to use my code:3dcandy wrote: isn't there an adsense tag???
yup, log in as admin, goto extensions > tags and there is an adsense tag, with a bit of a help....
Re: Need to make adsense work
Yeah, user defined tag isn't right. That's expecting PHP code...
1. Content->Global Content Blocks
2. Add one
3. Name it adsense
4. Paste into the content textarea:
5. Hit save
6. Go to where you want to drop this into your page or template. Put in {global_content name='adsense'}
7. Bask in the glory of web-based revenue
Hope that helps clear it up!
1. Content->Global Content Blocks
2. Add one
3. Name it adsense
4. Paste into the content textarea:
Code: Select all
{literal}
<__script__ type="text/javascript"><!--
google_ad_client = "pub-9510318816859002";
google_ad_width = 300;
google_ad_height = 250;
google_ad_format = "300x250_as";
google_ad_type = "image";
//2006-12-02: TT1Home
google_ad_channel = "6013869671";
google_color_border = "CCCCCC";
google_color_bg = "CCCCCC";
google_color_link = "000000";
google_color_text = "333333";
google_color_url = "666666";
//--></__script>
<__script__ type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</__script>
{/literal}
6. Go to where you want to drop this into your page or template. Put in {global_content name='adsense'}
7. Bask in the glory of web-based revenue
Hope that helps clear it up!
-
tt5001
Re: Need to make adsense work
It all went as you said, until I pasted into page and then:Ted wrote: Yeah, user defined tag isn't right. That's expecting PHP code...
1. Content->Global Content Blocks
2. Add one
3. Name it adsense
4. Paste into the content textarea:5. Hit saveCode: Select all
{literal} <__script__ type="text/javascript"><!-- google_ad_client = "pub-9510318816859002"; google_ad_width = 300; google_ad_height = 250; google_ad_format = "300x250_as"; google_ad_type = "image"; //2006-12-02: TT1Home google_ad_channel = "6013869671"; google_color_border = "CCCCCC"; google_color_bg = "CCCCCC"; google_color_link = "000000"; google_color_text = "333333"; google_color_url = "666666"; //--></__script> <__script__ type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </__script> {/literal}
6. Go to where you want to drop this into your page or template. Put in {global_content name='adsense'}
7. Bask in the glory of web-based revenue
Hope that helps clear it up!
string(130) "Smarty error: [in template:15 line 16]: syntax error: unrecognized tag: margin-bottom: -3px; (Smarty_Compiler.class.php, line 439)" string(111) "Smarty error: [in template:15 line 16]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 583)" string(129) "Smarty error: [in template:15 line 17]: syntax error: unrecognized tag: margin-bottom:-3px; (Smarty_Compiler.class.php, line 439)" string(111) "Smarty error: [in template:15 line 17]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 583)"
above the header of the site. Had to remove the {global_content name='adsense'} from the page to get it to go away.
Re: Need to make adsense work
Hi Trud,
I am not an expert, but I have also Adsense on my page and include it just as Cyberman suggested:
Other than that: Did you delete the UDT "adsense" again? Not that there are conflicts between your UDT and your GCB.
Good luck!
I am not an expert, but I have also Adsense on my page and include it just as Cyberman suggested:
- add {literal} and {/literal} around your Adsense code
- paste it in the template at the place where you like it to appear
- save
Other than that: Did you delete the UDT "adsense" again? Not that there are conflicts between your UDT and your GCB.
Good luck!
-
tt5001
Re: Need to make adsense work
What are your final thoughts on making this work?trud wrote: I posted similar post in the wrong forum, so I am posting here now.
I would like to use this desing for a site; avoidheartburn.com
As you see, there are one ad that would be placed just before {content}
How can I make a used defined tag that can handle this? I have read the handbook, but could not make it work.
My initial goal was to place everything in the template file, but then I saw that approach did not work. I guess javascript can not be inside js
I am sure the UDT is simple once it's done few times, but I have never done this before. So I would need wtep by step guiding. After all even the handbook did not make it for me.
-
pranab
Re: Need to make adsense work
The solution posted above works, but there's one gotcha to watch out for: If you're using anything other than the default editor to paste the Adsense code into a Global Content Block, make sure it doesn't convert your brackets to etc.
I was using FCKeditorX and had to use the 'source' button there before pasting the Adsense code, to make it work. Otherwise it would just display the code on the page.
If you can see the code on your page, use right-click -> view source and see if the brackets have been converted to their equivalents. If yes, that's a bad thing.
Code: Select all
"<"Code: Select all
<I was using FCKeditorX and had to use the 'source' button there before pasting the Adsense code, to make it work. Otherwise it would just display the code on the page.
If you can see the code on your page, use right-click -> view source and see if the brackets have been converted to their equivalents. If yes, that's a bad thing.
-
WebGirl
Re: Need to make adsense work
Hi there,
I've spent hours and tried all of the above with no luck
1. User Defined Tag didn't work [as Ted said, it's expecting php, not javascript]
2. Global Content tag doesn't work for me - it just disappears altogether
3. using {literal} tags in the Edit area doesn't work either - and yes, the brackets were converted, so I fixed them in the html editor, but still the adsense either doesn't appear or shows the javascript only.
I'm using 1.0.2 "Maui" and also 1.1 "Samoa".
Both have TinyMCE Menu installed.
I need to use different sized Adsense codes on most client pages, so if anyone else has a solution, I'd love to hear it.
Thanks!
WebGirl
I've spent hours and tried all of the above with no luck
1. User Defined Tag didn't work [as Ted said, it's expecting php, not javascript]
2. Global Content tag doesn't work for me - it just disappears altogether
3. using {literal} tags in the Edit area doesn't work either - and yes, the brackets were converted, so I fixed them in the html editor, but still the adsense either doesn't appear or shows the javascript only.
I'm using 1.0.2 "Maui" and also 1.1 "Samoa".
Both have TinyMCE Menu installed.
I need to use different sized Adsense codes on most client pages, so if anyone else has a solution, I'd love to hear it.
Thanks!
WebGirl

