Forum Moderators: not2easy
I store my articles in a text file which I include into my article page template via php.
I wish to place adsense ads in such a fashion:
ArticleArticleArticleArticleArticleArticleArticle
ArticleArticleArticleArticleArticleArticleArticle
ADSENSEADSENSE ArticleArticleArticleArticle
ADSENSEADSENSE ArticleArticleArticleArticle
ADSENSEADSENSE ArticleArticleArticleArticle
ADSENSEADSENSE ArticleArticleArticleArticle
ArticleArticleArticleArticleArticleArticleArticle
ArticleArticleArticleArticleArticleArticleArticle
I had been trying:
<div style="width:98%"> <!-- Main Body Div -->
<div style="float:left">
<!-- Adsense code goes here -->
</div>
<div>
<?php include($articleName);?>
</div>
</div>
but this only gives:
ADSENSEADSENSE ArticleArticleArticleArticle
ADSENSEADSENSE ArticleArticleArticleArticle
ADSENSEADSENSE ArticleArticleArticleArticle
ADSENSEADSENSE ArticleArticleArticleArticle
ArticleArticleArticleArticleArticleArticleArticle
ArticleArticleArticleArticleArticleArticleArticle
ArticleArticleArticleArticleArticleArticleArticle
ArticleArticleArticleArticleArticleArticleArticle
and I'd rather not use absolute positioning, any ideas?
Unfortunately, this means interrupting the flow of your source text with a div, as in...
<p>This is the first sentence. This is the second sentence. Guess what? Third and fourth sentences here.</p>
<div id="adsense_float"></div>
<p>This is the fifth sentence. And the sixth sentence. Seventh sentence, coming at'cha. Eighth sentence right here. Ninth sentence and so on.</p>
I have never found nor seen a better option. Relative positioning will move the text but leave a hole in the page layout where it originally renders. Absolute positioning won't clear a space for the location of the code.
cEM
What I'm doing now is using php's
explode() function to spilt the text into an array of paragraphs an I can position the floating div wherever I want in the text then.