• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Check for more than 1 HTML tag with PHP


#1
So, here is my dilemma:
I'm doing a website for a client, and she has portfolio page. She says that she will display 1-3 items there at a time. Now, I need to put in a code, that if there is more than 1 <div class="sub-container"> classes, it will need to put in <div id="line"></div>.

Ask for clarification if you need it.

~E
 

Kevin

Senior Member
#2
Well my PHP knowledge is very limited. But thinking logically you could add a note behind each closing div. That way the browser will know when to insert a new div. (Maybe there is a much easier way but I'm a PHP newb :cry:)

Code:
<div id="sub-container">  Lorem ipsum.</div>[COLOR=Green]<!-- end sub -->[/COLOR]
And then tell your PHP to insert a new div behind the comment. But I don't know how to do that exactly so if you're looking for some specific code then this post was pretty useless. :angel:
 

Skipper

Junior Member
#5
How is the information being outputted now? Where is it being retrieved from, like a database? Or is it just a static HTML document? (I'm guessing not, since "PHP" is in the title =P)

Current source code would be nice, if applicable.
 
#6
What he said ^^ :) If it's coming out of a database, you can just count the entries in the results array and conditionally stick in the "line" div.