0
RSS 스트림에 Google 애드 센스를 추가하려고합니다. 제 3 자에 의존하기 때문에 "RSS 용 애드 센스"를 사용하고 싶지 않습니다.RSS 스트림의 애드 센스
RSS에서 RSS 코드가 깨져서 작은 문자/큰 문자는 사용할 수 없습니다. 좋아, 나는 그들을 탈출하는 htmlentities() 함수를 사용합니다. 그것은과 같이, 스트림의 기본 HTTP를 표시하기 위해 잘 작동 : 나는 구글 애드 센스 코드와 정확히 같은 일을하려고 할 때
$bottom = '<p><a href="http://www.domain.com/image-' .$row['id']. '.html" target="_blank">Post a comment ></a>';
echo htmlentities($bottom);
그러나, 아무것도 표시되지 않습니다.
$ad_code = '<script type="text/javascript"><!--
google_ad_client = "pub-37909010735xxxx";
/* banner, RSS Feed */
google_ad_slot = "xxxxx";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>';
echo htmlentities($ad_code);
은 처음에는 구글이 RSS 서비스 용 애드 센스에 강제로 사용자가 애드 센스의 사용을 차단 생각하지만 나는 그런 슬래시닷 (Slashdot)와 같은 일부 인기있는 웹 사이트가 내가 원하는 정확히 무엇을 할 것으로 나타났습니다.
분명히 뭔가 잘못하고 있지만 그 위에 손가락을 넣을 수는 없습니다.
편집 : 이것은 문제가있는 이유는 RSS 피드를 내부에 자바 스크립트, 인라인 또는 외부를 포함 할 수 없다는 것입니다 출력
<description><a href="http://www.domain.com/image-8551.html" target="_blank"><img src="http://www.domain.com/images/1250670754.jpg" /></a><br /><br />I guess being called snuggly-bumpkins was too much?<script type="text/javascript"><!--
google_ad_client = "pub-3790901073xxxxx";
/* banner, RSS Feed */
google_ad_slot = "xxxxxxx";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><p><a href="http://www.domain.com/image-8551.html" target="_blank">Post a comment ></a></description>