Weet iemand hoe ik een while lus kan maken in een HTML template voor te emailen?
Hieronder de template... deze is voor mij prima... maar hij moet eigenlijk een aantal partys onder elkaar weergeven. Dit doe ik normaal met een while lus... maar hoe gaat dat in dit geval?
Iemand een ideeetje?
Code:<?PHP include('../includes/ubb.php'); include('../includes/verbindingen.php'); include('../includes/functies.php'); include('../includes/verjaardagsmail.php'); include('../../php/adminpanel/includes/instellingen.php'); // ONTVANGERS $Q_Ontvanger = mysql_query("SELECT Id, Voornaam, Achternaam, Gebruikersnaam, Email FROM Gebruikers WHERE Id='1'"); $I_Ontvanger = mysql_fetch_assoc($Q_Ontvanger); $Nu_Datum = mktime(date('H'), date('i'), date('s'), date('m'), date('d'), date('Y')); // PARTYS OPVRAGEN $Q_Party = mysql_query("SELECT * FROM Amusement_Evenementen WHERE Categorie = '7' AND EindDatum > '".$Nu_Datum."' LIMIT 3"); $Ontvanger = $I_Ontvanger['Voornaam']." ".$I_Ontvanger['Achternaam']." <".$I_Ontvanger['Email'].">"; $Onderwerp = "Wat ga jij dit weekend doen?"; $Verzender = "From: REPRESENTIN.NL <noreply@representin.nl>\r\n"; $Verzender .= 'MIME-Version: 1.0' . "\r\n"; $Verzender .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $Bericht = " <html> <head> <style> body { font-family: arial; font-size: 9pt; color: #000000 } table, tr, td { font-family: arial; font-size: 9pt; color: #000000; } input, select, textarea { font-family: arial; font-size: 8pt; color: #000000; } a { color: #000000; text-decoration: none; } a:hover { color: #000000; text-decoration: none; } a:active { color: #000000; text-decoration: none; } input { color: #000000; text-decoration: none; } </style> <body topmargin=\"0\" leftmargin=\"0\" background=\"[URL_WEBSITE2]/images/background.jpg\"> <div align=\"center\"><center> <table border=\"0\" width=\"560\" bgcolor=\"#FFFFFF\" cellspacing=\"0\" cellpadding=\"0\" style=\"margin-top: 10px; border-left: 1px solid rgb(0,0,0); border-right: 1px solid rgb(0,0,0); border-bottom: 1px solid rgb(0,0,0)\"> <tr> <td width=\"100%\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td width=\"100%\"><table border=\"0\" width=\"560\" height=\"106\" cellspacing=\"0\" cellpadding=\"0\" background=\"[URL_WEBSITE2]/images/header.jpg\" style=\"border-bottom: 1px solid rgb(0,0,0)\"> <tr> <td width=\"100%\" valign=\"top\"></td> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td width=\"100%\" background=\"[URL_WEBSITE2]/images/background_table.jpg\"><table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td width=\"100%\"><p align=\"center\"><img src=\"[URL_WEBSITE2]/images/underheader.jpg\"></td> </tr> <tr> <td width=\"100%\" valign=\"top\"><table border=\"0\" width=\"96%\" style=\"margin-left: 10px\" cellspacing=\"0\" cellpadding=\"4\"> <tr> <td width=\"100%\"> <table border=\"0\" width=\"529\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td width=\"100%\"> Beste <b>[VOORNAAM] [ACHTERNAAM]</b>,<br><br> Wat ga jij dit weekend doen?<br><br> </td> </tr> <tr> <td width=\"100%\"> <img src=\"[URL_WEBSITE2]/images/partys.jpg\"> </td> </tr> <tr> <td width=\"100%\"> <table border=\"0\" width=\"100%\" cellpadding=\"3\" cellspacing=\"0\" style=\"margin-bottom: 3px; background-color: rgb(255,255,255); border: 1px solid rgb(229,229,229)\"> <tr> <td width=\"26%\" valign=\"top\"><a href=\"[URL_WEBSITE]/index.php?Page=partys&Sub=evenementdetails&EvenementId=[PARTY_ID]\"><img border=\"0\" style=\"border: 1px solid rgb(15,15,15)\" src=\"[URL_ADMIN]/amusement/EvenementenFotos/EvenementenFotosSmall/[PARTY_FOTO]\"></a></td> <td width=\"74%\" valign=\"top\"><p style=\"line-height: 18px\" align=\"justify\"> <a href=\"[URL_WEBSITE]/index.php?Page=partys&Sub=evenementdetails&EvenementId=[PARTY_ID]\"> <font style=\"font-size: 13pt\"><b>[PARTY_Titel]</b></font><br> <font style=\"color: #AD0006\"><b>[PARTY_DATUM]</b></font><br> [PARTY_OMSCHRIJVING] </a></td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> <tr align=\"center\"> <td width=\"100%\" valign=\"top\" style=\"background-image:url('[URL_WEBSITE2]/images/bottom.jpg');\"> <table width=\"100%\" cellpadding=\"2\" cellspacing=\"2\"> <tr> <td width=\"100%\"> <center> <p style=\"line-height: 17px\"><b><font style=\"color: #000000; font-size: 8pt\">Copyright © 2011 - 2012 | Representin.nl</font></b> <b>|</b> <font style=\"color: #808080; font-size: 8pt\"><a href=\"[URL_WEBSITE]/index.php?Page=home&Sub=algemenevoorwaarden\"><font style=\"color: #808080; font-size: 8pt\"><b>Algemene voorwaarden</b></font></a> <b>|</b> <a href=\"[URL_WEBSITE]/index.php?Page=home&Sub=crew\"><font style=\"color: #808080; font-size: 8pt\"><b>Crew</b></font></a> <b>|</b> <a href=\"[URL_WEBSITE]/index.php?Page=home&Sub=contact\"><font style=\"color: #808080; font-size: 8pt\"><b>Contact</b></font></a></font></td> </center> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </center></div> </body> </html> "; $Bericht = str_replace('[VOORNAAM]', $I_Ontvanger['Voornaam'], $Bericht); $Bericht = str_replace('[ACHTERNAAM]', $I_Ontvanger['Achternaam'], $Bericht); $Bericht = str_replace('[URL_WEBSITE]', 'http://www.representin.nl/contents', $Bericht); $Bericht = str_replace('[URL_WEBSITE2]', 'http://www.representin.nl/contents/mailing', $Bericht); $Bericht = str_replace('[URL_ADMIN]', 'http://www.representin.nl/php/adminpanel', $Bericht); if(mail($Ontvanger, $Onderwerp, $Bericht, $Verzender)) { echo "Oke"; } else { echo "Niet oke"; } ?>
- While() in HTML mail
-
05-08-2011, 21:49 #1
- Berichten
- 26
- Lid sinds
- 14 Jaar
While() in HTML mail
-
-
05-08-2011, 22:37 #2
- Berichten
- 1.245
- Lid sinds
- 18 Jaar
Re: While() in HTML mail
Code:$bericht ="Style code"; $query aanmaken while openen { $bericht .= "rijen die je wilt toevoegen"; } $bericht .= "Bericht afsluiten";
-
07-08-2011, 14:22 #3
- Berichten
- 26
- Lid sinds
- 14 Jaar
Re: While() in HTML mail
Werkt! Perfect. Dankjewel voor je reactie :)
(ik was de . vergeten voor het = teken bij $Bericht)
-
07-08-2011, 15:20 #4
- Berichten
- 935
- Lid sinds
- 17 Jaar
Re: While() in HTML mail
'vergeten' of wist je gewoon niet dat dat mogelijk was?
iedereen begint een keer met scripten tenslotte, dat geeft toch niet.
-
07-08-2011, 22:25 #5
- Berichten
- 26
- Lid sinds
- 14 Jaar
Re: While() in HTML mail
Ik heb het wel eerder gezien in vergelijkbare scripts (omdat ik daarnaar opzoek was), maar ik wist niet dat dat hier nu erbij moest komen. Maar ik neem aan dat je scripter/designer bent en geen Dr. Phil toch? haha.
Plaats een
- + Advertentie
- + Onderwerp
Marktplaats
Webmasterforum
- Websites algemeen
- Sitechecks
- Marketing
- Domeinen algemeen
- Waardebepaling
- CMS
- Wordpress
- Joomla
- Magento
- Google algemeen
- SEO
- Analytics
- Adsense
- Adwords
- HTML / XHTML
- CSS
- Programmeren
- PHP
- Javascript
- JQuery
- MySQL
- Ondernemen algemeen
- Belastingen
- Juridisch
- Grafisch ontwerp
- Hosting Algemeen
- Hardware Info
- Offtopic