Inserting an ad in the body of the article using PHP

Dear visitors of the blog Today I would like to discuss how to insert a code of context advertisement in
the body of articles
using the PHP language (ru).

Some rules of placing advertisement in the body of articles

  1. It is no good when there are too many ads in the body of the article and it complicates the reading.
  2. Also it is not convenient when the advertisement code goes right under the title of the article and it’s hard to understand where the title and the advertisement code are. After the article’s title an ad should be inserted at least between two first paragraphs.
  3. You don’t want to insert the ad in the center of the paragraph thus breaking it into two parts. It’s better to insert a context ad between the paragraphs.
  4. It would be good if ad blocks are separated by one thousand or more characters.


Inserting an ad between paragraphs of the article

In order to insert a block of context ad , it is necessary to determine places for advertisement block in the body of article using the rules described above. In harmony with these rules, this is a space between the paragraphs. How to get the needed values which will indicate such places between the paragraphs?

Read more