|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
a little help with a code for ads
Hi,
I was wondering if someone could help me with a code by showing an example. I have a site with tons of articles on it and I want to have ads appear in mid article, kind of like news websites do. Someone told me I could use explode to find all the instances of </P> so I know where the end of each paragraph lies. The idea is to insert a paragraph with an adcode in it after say the third or fourth paragraph. I'm not really sure how to count the number of times </p> shows up and how to choose say the fourth time to insert my adcode. I'm kind of a newbie. That's why I asked for an example because then I could pick it apart and learn by example. Hope someone can show me the way. Thanks/
__________________
Without me my guitar is useless -- http://www.guitarnoise.com http://www.musiccareers.net |
|
#2
|
|||
|
|||
|
I'm sure there are tutorials about how to do this kind of thing. Have you run a google search for it and looked around php tutorial sites? After you've done that I'm sure you'll find similar things at the very least. Use that and give it a go then ask us specific questions since its unlikely anyone here will just write your code for you.
-KM- |
|
#3
|
|||
|
|||
|
Thanks for the reply. I guess I was getting hopeful that someone might write code for me. I did search google and go through numerous tutorials before posting here. I've tried really hard to get the desired result on my own but there are a lot of concepts I haven't grasped yet.
I have come up with the following code I learned from an example: PHP Code:
What this does is place the ad code after each paragraph. The looping has me confused. What expression shoul I be looking for to get the adcode to appear only once, and after a </P> of my choice? I don't mind trying to figure it out myself, but a push in the right direction would be greatly apreciated. |
|
#4
|
|||
|
|||
|
Good work, only a small change to get what you want in there -
PHP Code:
Hope this helps, -KM- Last edited by kode_monkey : July 26th, 2004 at 03:20 AM. Reason: Writing code too early in the morning... |
|
#5
|
|||
|
|||
|
Cool. After banging my head against the wall for a while I came up with something that works as well. I wanted to post it here then saw your reply. I was wondering which is more efficient, my code or yours?
PHP Code:
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > a little help with a code for ads |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|