[PHP] Hulp

Gestart doorSdejong10 reacties38 weergaven

11 berichten · pagina 1 van 1

Sdejong

Lid · Topicstarter

Berichten
1.226
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hee One2xs,

In mijn lay-out (zonder php) krijg ik om-en-om een wit vlak en dan een grijs vlak. Dit doe ik doormiddel van:
<div class="td-bg-gray">


Hieronder een screen:
Afbeelding

Alleen nu er automatisch dingen uit de database worden gehaalt heb ik geen mogelijkheid meer om
<div class="td-bg-gray">


toe te voegen en ziet het er nu zo uit:
Afbeelding

Het betreffende stukje code:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/class"]class[/URL] Top[COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] laatst[COLOR= #007700](){[/COLOR]
        [COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM Filmpjes ORDER BY datum DESC LIMIT 10"[/COLOR][COLOR= #007700]);[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]){[/COLOR]
            [COLOR= #0000BB]$string[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"<i>Er zijn nog geen nummers toegevoegd, of de database is foetsie ..</i>"[/COLOR][COLOR= #007700];
        }[/COLOR]
        [URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
            [COLOR= #0000BB]$string[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]"<table>"[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$film[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700])){[/COLOR]
            
                [COLOR= #0000BB]$string[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]<div class="lst"><img src="http://url/[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$film[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]genre[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" width="50" height="50"  /><div class="nmr"><object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$film[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]?fs=1&amp;hl=nl_NL&amp;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$film[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]?fs=1&amp;hl=nl_NL&amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="30" height="25"></embed></object> <font color="#000000">[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$film[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000] </font></div><div class="vlg"><a href="http://www.youtube.com/watch?v=[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$film[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" target="_blank"><img src="images/link.png" border="0" /></a>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$film[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]artiest[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000] </div></div></div>[/COLOR][COLOR= #007700];
                    
            }[/COLOR]
            [COLOR= #0000BB]$string[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]"</table>"[/COLOR][COLOR= #007700];
        }[/COLOR]
        [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$string[/COLOR][COLOR= #007700];
    }
    
    
    
    
}[/COLOR]
[COLOR= #0000BB]$Top[/COLOR] [COLOR= #007700]= new[/COLOR] Top[COLOR= #007700];[/COLOR]
?>


Na hopeloos proberen ben ik er nog steeds niet achtergekomen, misschien hebben jullie een oplossing.

Alvast bedankt,
Steven
0
Berichten
515
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
zet:

$teller = 0;

boven je while loop

Daarna $teller++; in je while loop op het eind

noem dan je

weet niet precies hoe je de css hebt gemaakt. maar zou wel moeten kunnen met enige aanpasingen

en anders copy en paste die $string .= ....... in je while loop
moet ook kunnen.
0
Sdejong

Lid · Topicstarter

Berichten
1.226
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Justafool, dank voor het helpen. Alleen voor een PHP noob als ik is het een beetje moeilijk te begrijpen. Dus ik moet iets in de while loop veranderen?

$teller = 0;
while($film = mysql_fetch_assoc($sql) $teller++;){


?
0
Berichten
515
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Op
Sdejong schreef:
Justafool, dank voor het helpen. Alleen voor een PHP noob als ik is het een beetje moeilijk te begrijpen. Dus ik moet iets in de while loop veranderen?
$teller = 0;
while($film = mysql_fetch_assoc($sql) $teller++;){


?

Onder de $string
$teller++;

Ik zit op moment op mobiel. Mar als ik thuis bem zou ik het voor je klaar kunnen maken voor 0.2 pt
Dan heb ik wel jou css nodig enige stukje dat de kleuren maakt en de tabel plus celnamen voor de database
0
Sdejong

Lid · Topicstarter

Berichten
1.226
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Volgensmij moet er ook een oplossing zijn zonder de CSS passen, want ik heb de CSS voor de cel namelijk al.
0
Berichten
515
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ik hoef oo, niks aan css aan te passen puur alleen zien hoe je het gedaan hebt
0
Sdejong

Lid · Topicstarter

Berichten
1.226
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
.td-bg-gray{ background: #F5F5F5; padding: 0 20px 0 0; }
.lst {width: 100%;clear:left;padding: 4px 0 4px 11px;font-family: arial;}

smile.
0
Berichten
515
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ok als ik thuis ben krijg je de aanpassing
0
Sdejong

Lid · Topicstarter

Berichten
1.226
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dat zou zeker fijn zijn smile.
0
Berichten
3.788
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/class"]class[/URL] Top[COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] laatst[COLOR= #007700](){[/COLOR]
        [COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM Filmpjes ORDER BY datum DESC LIMIT 10"[/COLOR][COLOR= #007700]);[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]){[/COLOR]
            [COLOR= #0000BB]$string[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"<i>Er zijn nog geen nummers toegevoegd, of de database is foetsie ..</i>"[/COLOR][COLOR= #007700];
        }[/COLOR]
        [URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
            [COLOR= #0000BB]$string[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]"<table>"[/COLOR][COLOR= #007700];[/COLOR]
            [COLOR= #0000BB]$class[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]1st[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$film[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700])){[/COLOR]
            
                [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$class[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]1st[/COLOR][COLOR= #007700]){[/COLOR] [COLOR= #0000BB]$class[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]td-bg-gray[/COLOR][COLOR= #007700]; }[/COLOR]
                [URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR] [COLOR= #0000BB]$class[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]1st[/COLOR][COLOR= #007700]; }[/COLOR]
                [COLOR= #0000BB]$string[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]<div class="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$class[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]"><img src="http://url/[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$film[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]genre[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" width="50" height="50"  /><div class="nmr"><object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$film[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]?fs=1&amp;hl=nl_NL&amp;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$film[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]?fs=1&amp;hl=nl_NL&amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="30" height="25"></embed></object> <font color="#000000">[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$film[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000] </font></div><div class="vlg"><a href="http://www.youtube.com/watch?v=[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$film[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" target="_blank"><img src="images/link.png" border="0" /></a>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$film[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]artiest[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000] </div></div></div>[/COLOR][COLOR= #007700];
                    
            }[/COLOR]
            [COLOR= #0000BB]$string[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #DD0000]"</table>"[/COLOR][COLOR= #007700];
        }[/COLOR]
        [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$string[/COLOR][COLOR= #007700];
    }
    
    
    
    
}[/COLOR]
[COLOR= #0000BB]$Top[/COLOR] [COLOR= #007700]= new[/COLOR] Top[COLOR= #007700];[/COLOR]
?>


Zoeits moet het dan worden
0
Sdejong

Lid · Topicstarter

Berichten
1.226
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Super bedankt Justafool en Eleky! Dankzij de uitleg van Justafool en het script van Eleky is het gelukt smile!
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren