什麼adsense

這次介紹的模組是adsense 模組
這個模組可以將你的網頁變成你的謀生工具, 賺取外快, 幫補寄存費等等
如果你對adsense 沒有認識, 之前有用過adsense, 我建議你先到google adsense 看一看
明白什麼是adsense 才開始你的賺錢大計

這次使用的是 adsense1.3 的官方發佈版
從官網下載了以後, 將檔案解壓到 drupal/modules/ 下
用管理員登入, 到 site building->modules 啓用

也順便啓用內建的profile, adsense 的設定會用到

接著要設定adsense 模組
留意, 這模組的設定比較多, 請小心

先到user/profile, 新增一個 "single-line textfield"
用作記下你的google-adsense id

form_name 指定為 profile_google_adsense_client_id

其餘的都可以自定
下面有一個visibility 的選項, 要選private
save.

接著填入你的id, 到user/1, edit
你的id 可以從google 給的一段script 的看到
格式為pub-xxxxxxxxx..

save.

接著到adsense 模組設定了
在required parameters 內選google adsense client id

Ad group 內就可以設定adsense 的顏色, 屬性等等

save 了以後, 你就可以在block 內看到adsense 320x180 之類的block 了

當然, 你也可以在theme 之內使用
用以下的一段code

<?php
if (module_exists('adsense')) {
  print
adsense_display('120x600', 2, 4);
}
?>

adsense 可以算是最簡單的廣告組織了
只要數個簡單的步驟, 你就可以開展自己的廣告收益
何樂而不為?

AttachmentSize
adsense-1.png51.02 KB
adsense-2.png73.09 KB
adsense-3.png69.11 KB
adsense-4.png50.42 KB
adsense-5.png40.12 KB

Comments

很難得認識香港的drupal達人

hi! joe!
我在drupaltaiwan.org 見到你的留言,
才知道這個地方,
發現很多關於drupal 有用的資料,
我是在協青社當網頁設計的.
[做網頁設計, "program野"自然不好.]
如果對drupal 有什麼不懂,
可否問你嗎??

可以用右邊的電郵聯

可以用右邊的電郵聯絡我
我也承接freelance 的~

請教一下, 這邊的

請教一下, 這邊的 adsense 是如何放在 node 和 comment 的中間呢? 我用 firebug 看了一下, 這裡有三段 div, 一般只有 node 和 comments 兩個, 請問 adsense 這段是怎麼產生的呢? 謝謝.

<div id="node-58" class="node">
<div class="adsense">
<div id="comments">

我把 block 的 weight 設定從 -10 到 10, 都是在 comment 的下面, 所以是得直接修改 template.php 才能做到這種效果嗎?

對,

對, 要改template
但是改node.tpl.php
我的做法是加一個if,
如果是第一個顯示的node 便加adsense module代碼

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <h4> <h3>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options