PSD-Tutorials.de
Forum für Design, Fotografie & Bildbearbeitung
Tutkit
Agentur
Hilfe
Kontakt
Start
Forum
Aktuelles
Besonderer Inhalt
Foren durchsuchen
Tutorials
News
Anmelden
Kostenlos registrieren
Aktuelles
Suche
Suche
Nur Titel durchsuchen
Von:
Menü
Anmelden
Kostenlos registrieren
App installieren
Installieren
JavaScript ist deaktiviert. Für eine bessere Darstellung aktiviere bitte JavaScript in deinem Browser, bevor du fortfährst.
Du verwendest einen veralteten Browser. Es ist möglich, dass diese oder andere Websites nicht korrekt angezeigt werden.
Du solltest ein Upgrade durchführen oder einen
alternativen Browser
verwenden.
Antworten auf deine Fragen:
Neues Thema erstellen
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
Multiticket mit DIV-Container als PDF erzeugen... Wie php-Schleife ansetzen
Beitrag
<blockquote data-quote="Freiheitenwelt" data-source="post: 2681571"><p>Gut - </p><p></p><p>Und hier ein Auszug aus dem Standardtemplate des Ticketplugins... Die Tabellenstruktur war hier viel einfacher und natürlich nicht so auf den mm genau angeordnet. Sieht aber sehr übersichtlich aus der Code und da dompf ja keine Probleme mit CSS und php hat denke ich sollte es bei mir doch auch funktionieren. </p><p></p><p>Wo ich im Moment nicht zurecht komme ist wie ich die Variablen für die vier möglichen Maincontainer und "Top:X" hier einbinde. Also mir fehlt schlichtweg die Idee wie ich die Schleifen hier aufstellen soll?!? Ändern tun sich auch eigentlich nur der Barcode und die Ticketnummer. </p><p></p><p>[PHP]<?php $chunkTickets = array_chunk($tickets, 3); ?></p><p></p><p><?php $numChunks = count($chunkTickets); ?></p><p><?php $x = 1; ?></p><p><?php foreach($chunkTickets as $chunk) : ?></p><p><?php $ticket = $chunk[0]; ?></p><p><?php $i = 0; ?></p><p></p><p>//Wenn ich es richtig verstehe wird mit diesem Code abgerufen wie viele Tickets zur Verfügung stehen und die Daten in einen Array (Chunk) gespeichert - richtig? </p><p></p><p>//Was nun folgt sind die Tabellen in denen die Daten nacheinander geschrieben werden. Die erste Tabelle wird mit den Grundinfos hier nur einmal geschrieben. Das fällt bei mir weg da ich das auf jedem Ticket haben will. </p><p></p><p>//Die Zweite Tabellen Struktur wird mit "foreach etc." so oft durchlaufen wie es Tickets gibt. An dem Punkt will ich ansetzen. Eben dann nur das bei jedem neuen Durchlauf der "Maincontainer" um die X=i*74mm verschoben wird. Nach 4 Tickets wird i wieder 0 und fängt eine neue Seite an. </p><p></p><p>//Also was mir unklar ist sind jene Anweisungen <?php foreach ($chunk as $ticket): ?> z.B. </p><p></p><p></p><p><table width="100%"></p><p> <tr></p><p> <td> </p><p> <h1><?php echo $ticket['name'] ?></h1></p><p> <p></p><p> <?php if(!empty($ticket['WooCommerceEventsDate'])) : ?></p><p> <strong><?php _e('Date:','fooevents-pdf-tickets') ?></strong> <?php echo $ticket['WooCommerceEventsDate']; ?><br /></p><p> <?php endif; ?></p><p> //usw. .........</p><p> .........</p><p> ...........</p><p></p><p> <?php endif; ?> </p><p> Page <?php echo $x; ?> of <?php echo $numChunks; ?></p><p> </td></p><p> </tr></p><p></table> </p><p></p><p></p><p></p><p><table width="100%" class="tickets" cellpadding="0" cellmargin="0"></p><p> <?php foreach ($chunk as $ticket): ?></p><p> <tr></p><p> <td valign="top"></p><p> <?php if(!empty($ticket['WooCommerceEventsTicketLogoPath'])) :?></p><p> <img src="<?php echo $ticket['WooCommerceEventsTicketLogoPath']; ?>" alt="" width="150px"/><br /></p><p> <?php endif; ?></p><p> </td></p><p> <td valign="top" class="ticketinfo"></p><p> <h3><?php echo $ticket['name'] ?></h3></p><p> <?php if(!empty($ticket['WooCommerceEventsDate'])) : ?></p><p> <strong><?php _e('Date:','fooevents-pdf-tickets') ?></strong> <?php echo $ticket['WooCommerceEventsDate']; ?><br /></p><p> <?php endif; ?></p><p> <?php if(!empty($ticket['WooCommerceEventsHour'])) : ?></p><p> <strong><?php _e('Time:','fooevents-pdf-tickets') ?></strong> <?php echo $ticket['WooCommerceEventsHour']; ?>:<?php echo $ticket['WooCommerceEventsMinutes']; ?><?php echo (!empty($ticket['WooCommerceEventsPeriod']))? $ticket['WooCommerceEventsPeriod'] : '' ?></p><p> <?php if($ticket['WooCommerceEventsHourEnd'] != '00') : ?></p><p> - <?php echo $ticket['WooCommerceEventsHourEnd']; ?>:<?php echo $ticket['WooCommerceEventsMinutesEnd']; ?><?php echo (!empty($ticket['WooCommerceEventsEndPeriod']))? $ticket['WooCommerceEventsEndPeriod'] : '' ?></p><p> <br /></p><p> <?php endif; ?></p><p> <?php endif; ?></p><p> <?php if(!empty($ticket['WooCommerceEventsLocation'])) :?></p><p> <strong><?php _e('Location:','fooevents-pdf-tickets') ?></strong> <?php echo $ticket['WooCommerceEventsLocation'] ?><br /></p><p> <?php endif; ?></p><p> <strong><br /><?php _e('Ticket Number:','fooevents-pdf-tickets') ?></strong> <?php echo $ticket['WooCommerceEventsTicketID']; ?><br /></p><p> <strong><?php _e('Ticket Holder:','fooevents-pdf-tickets') ?></strong> <?php echo $ticket['customerFirstName']; ?> <?php echo $ticket['customerLastName']; ?><br /> </p><p> </p><p> <?php if(!empty($ticket['WooCommerceEventsAttendeeTelephone'])) :?></p><p> <strong><?php _e('Telephone Number:','fooevents-pdf-tickets') ?></strong> <?php echo $ticket['WooCommerceEventsAttendeeTelephone']; ?><br /></p><p> <?php endif; ?></p><p></p><p> <?php if(!empty($ticket['WooCommerceEventsAttendeeCompany'])) :?></p><p> <strong><?php _e('Company:','fooevents-pdf-tickets') ?></strong> <?php echo $ticket['WooCommerceEventsAttendeeCompany']; ?><br /></p><p> <?php endif; ?></p><p></p><p> <?php if(!empty($ticket['WooCommerceEventsAttendeeDesignation'])) :?></p><p> <strong><?php _e('Designation:','fooevents-pdf-tickets') ?></strong> <?php echo $ticket['WooCommerceEventsAttendeeDesignation']; ?><br /></p><p> <?php endif; ?></p><p></p><p> <?php if(!empty($ticket['WooCommerceEventsVariations'])) :?></p><p> </p><p> <?php foreach($ticket['WooCommerceEventsVariations'] as $variationName => $variationValue) :?></p><p> <?php</p><p> $variationNameOutput = str_replace('attribute_', '', $variationName);</p><p> $variationNameOutput = str_replace('pa_', '', $variationNameOutput);</p><p> $variationNameOutput = str_replace('_', ' ', $variationNameOutput);</p><p> $variationNameOutput = str_replace('-', ' ', $variationNameOutput);</p><p> $variationNameOutput = str_replace('Pa_', '', $variationNameOutput);</p><p> $variationNameOutput = ucwords($variationNameOutput);</p><p></p><p> $variationValueOutput = str_replace('_', ' ', $variationValue);</p><p> $variationValueOutput = str_replace('-', ' ', $variationValueOutput);</p><p> $variationValueOutput = ucwords($variationValueOutput);</p><p> ?></p><p> <?php echo '<strong>'.$variationNameOutput.':</strong> '.$variationValueOutput.'<br />'; ?></p><p> <?php endforeach; ?></p><p> </p><p> <?php endif; ?></p><p> </p><p> <?php if(!empty($ticket['fooevents_custom_attendee_fields_options'])) :?></p><p> <?php echo $ticket['fooevents_custom_attendee_fields_options']; ?></p><p> <?php endif; ?></p><p> </p><p> <?php if($ticket['WooCommerceEventsTicketDisplayPrice'] != 'off') :?></p><p> <?php echo $ticket['WooCommerceEventsPrice']; ?><br /></p><p> <?php endif; ?></p><p> </td></p><p> <td align="right" valign="top" class='stub'></p><p> <img src="<?php echo $eventPluginURL; ?><?php echo $ticket['barcodeFileName']; ?>.jpg" alt="Barcode: <?php echo $ticket['WooCommerceEventsTicketID']; ?>" width="140px" /><br /></p><p> <small><?php echo $ticket['WooCommerceEventsTicketID']; ?></small></p><p> </td></p><p> </tr></p><p> <?php $i++; ?> </p><p> <?php endforeach; ?></p><p> </tr></p><p></table></p><p><table width="100%"></p><p> <?php if(!empty($ticket['FooEventsTicketFooterText'])) :?></p><p> <tr></p><p> <td colspan="2" class="footer"></p><p> <small><?php echo $ticket['FooEventsTicketFooterText'];?></small></p><p> </td></p><p> </tr></p><p> <?php endif; ?></p><p></table></p><p><?php $x++; ?></p><p><?php echo ($x < $numChunks)? '<div style="page-break-before: always;"></div>' : ''; ?></p><p><?php endforeach; ?> [/PHP]</p></blockquote><p></p>
[QUOTE="Freiheitenwelt, post: 2681571"] Gut - Und hier ein Auszug aus dem Standardtemplate des Ticketplugins... Die Tabellenstruktur war hier viel einfacher und natürlich nicht so auf den mm genau angeordnet. Sieht aber sehr übersichtlich aus der Code und da dompf ja keine Probleme mit CSS und php hat denke ich sollte es bei mir doch auch funktionieren. Wo ich im Moment nicht zurecht komme ist wie ich die Variablen für die vier möglichen Maincontainer und "Top:X" hier einbinde. Also mir fehlt schlichtweg die Idee wie ich die Schleifen hier aufstellen soll?!? Ändern tun sich auch eigentlich nur der Barcode und die Ticketnummer. [PHP]<?php $chunkTickets = array_chunk($tickets, 3); ?> <?php $numChunks = count($chunkTickets); ?> <?php $x = 1; ?> <?php foreach($chunkTickets as $chunk) : ?> <?php $ticket = $chunk[0]; ?> <?php $i = 0; ?> //Wenn ich es richtig verstehe wird mit diesem Code abgerufen wie viele Tickets zur Verfügung stehen und die Daten in einen Array (Chunk) gespeichert - richtig? //Was nun folgt sind die Tabellen in denen die Daten nacheinander geschrieben werden. Die erste Tabelle wird mit den Grundinfos hier nur einmal geschrieben. Das fällt bei mir weg da ich das auf jedem Ticket haben will. //Die Zweite Tabellen Struktur wird mit "foreach etc." so oft durchlaufen wie es Tickets gibt. An dem Punkt will ich ansetzen. Eben dann nur das bei jedem neuen Durchlauf der "Maincontainer" um die X=i*74mm verschoben wird. Nach 4 Tickets wird i wieder 0 und fängt eine neue Seite an. //Also was mir unklar ist sind jene Anweisungen <?php foreach ($chunk as $ticket): ?> z.B. <table width="100%"> <tr> <td> <h1><?php echo $ticket['name'] ?></h1> <p> <?php if(!empty($ticket['WooCommerceEventsDate'])) : ?> <strong><?php _e('Date:','fooevents-pdf-tickets') ?></strong> <?php echo $ticket['WooCommerceEventsDate']; ?><br /> <?php endif; ?> //usw. ......... ......... ........... <?php endif; ?> Page <?php echo $x; ?> of <?php echo $numChunks; ?> </td> </tr> </table> <table width="100%" class="tickets" cellpadding="0" cellmargin="0"> <?php foreach ($chunk as $ticket): ?> <tr> <td valign="top"> <?php if(!empty($ticket['WooCommerceEventsTicketLogoPath'])) :?> <img src="<?php echo $ticket['WooCommerceEventsTicketLogoPath']; ?>" alt="" width="150px"/><br /> <?php endif; ?> </td> <td valign="top" class="ticketinfo"> <h3><?php echo $ticket['name'] ?></h3> <?php if(!empty($ticket['WooCommerceEventsDate'])) : ?> <strong><?php _e('Date:','fooevents-pdf-tickets') ?></strong> <?php echo $ticket['WooCommerceEventsDate']; ?><br /> <?php endif; ?> <?php if(!empty($ticket['WooCommerceEventsHour'])) : ?> <strong><?php _e('Time:','fooevents-pdf-tickets') ?></strong> <?php echo $ticket['WooCommerceEventsHour']; ?>:<?php echo $ticket['WooCommerceEventsMinutes']; ?><?php echo (!empty($ticket['WooCommerceEventsPeriod']))? $ticket['WooCommerceEventsPeriod'] : '' ?> <?php if($ticket['WooCommerceEventsHourEnd'] != '00') : ?> - <?php echo $ticket['WooCommerceEventsHourEnd']; ?>:<?php echo $ticket['WooCommerceEventsMinutesEnd']; ?><?php echo (!empty($ticket['WooCommerceEventsEndPeriod']))? $ticket['WooCommerceEventsEndPeriod'] : '' ?> <br /> <?php endif; ?> <?php endif; ?> <?php if(!empty($ticket['WooCommerceEventsLocation'])) :?> <strong><?php _e('Location:','fooevents-pdf-tickets') ?></strong> <?php echo $ticket['WooCommerceEventsLocation'] ?><br /> <?php endif; ?> <strong><br /><?php _e('Ticket Number:','fooevents-pdf-tickets') ?></strong> <?php echo $ticket['WooCommerceEventsTicketID']; ?><br /> <strong><?php _e('Ticket Holder:','fooevents-pdf-tickets') ?></strong> <?php echo $ticket['customerFirstName']; ?> <?php echo $ticket['customerLastName']; ?><br /> <?php if(!empty($ticket['WooCommerceEventsAttendeeTelephone'])) :?> <strong><?php _e('Telephone Number:','fooevents-pdf-tickets') ?></strong> <?php echo $ticket['WooCommerceEventsAttendeeTelephone']; ?><br /> <?php endif; ?> <?php if(!empty($ticket['WooCommerceEventsAttendeeCompany'])) :?> <strong><?php _e('Company:','fooevents-pdf-tickets') ?></strong> <?php echo $ticket['WooCommerceEventsAttendeeCompany']; ?><br /> <?php endif; ?> <?php if(!empty($ticket['WooCommerceEventsAttendeeDesignation'])) :?> <strong><?php _e('Designation:','fooevents-pdf-tickets') ?></strong> <?php echo $ticket['WooCommerceEventsAttendeeDesignation']; ?><br /> <?php endif; ?> <?php if(!empty($ticket['WooCommerceEventsVariations'])) :?> <?php foreach($ticket['WooCommerceEventsVariations'] as $variationName => $variationValue) :?> <?php $variationNameOutput = str_replace('attribute_', '', $variationName); $variationNameOutput = str_replace('pa_', '', $variationNameOutput); $variationNameOutput = str_replace('_', ' ', $variationNameOutput); $variationNameOutput = str_replace('-', ' ', $variationNameOutput); $variationNameOutput = str_replace('Pa_', '', $variationNameOutput); $variationNameOutput = ucwords($variationNameOutput); $variationValueOutput = str_replace('_', ' ', $variationValue); $variationValueOutput = str_replace('-', ' ', $variationValueOutput); $variationValueOutput = ucwords($variationValueOutput); ?> <?php echo '<strong>'.$variationNameOutput.':</strong> '.$variationValueOutput.'<br />'; ?> <?php endforeach; ?> <?php endif; ?> <?php if(!empty($ticket['fooevents_custom_attendee_fields_options'])) :?> <?php echo $ticket['fooevents_custom_attendee_fields_options']; ?> <?php endif; ?> <?php if($ticket['WooCommerceEventsTicketDisplayPrice'] != 'off') :?> <?php echo $ticket['WooCommerceEventsPrice']; ?><br /> <?php endif; ?> </td> <td align="right" valign="top" class='stub'> <img src="<?php echo $eventPluginURL; ?><?php echo $ticket['barcodeFileName']; ?>.jpg" alt="Barcode: <?php echo $ticket['WooCommerceEventsTicketID']; ?>" width="140px" /><br /> <small><?php echo $ticket['WooCommerceEventsTicketID']; ?></small> </td> </tr> <?php $i++; ?> <?php endforeach; ?> </tr> </table> <table width="100%"> <?php if(!empty($ticket['FooEventsTicketFooterText'])) :?> <tr> <td colspan="2" class="footer"> <small><?php echo $ticket['FooEventsTicketFooterText'];?></small> </td> </tr> <?php endif; ?> </table> <?php $x++; ?> <?php echo ($x < $numChunks)? '<div style="page-break-before: always;"></div>' : ''; ?> <?php endforeach; ?> [/PHP] [/QUOTE]
Bilder bitte
hier hochladen
und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Zitate einfügen…
Authentifizierung
Wenn ▲ = 7, ▼ = 3, ◇ = 2 und die Summe von ▲ und ▼ durch ◇ geteilt wird, was ist das Ergebnis?
Antworten
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
Multiticket mit DIV-Container als PDF erzeugen... Wie php-Schleife ansetzen
Oben