Jump to content

kuba2

Members
  • Posts

    103
  • Joined

  • Last visited

Everything posted by kuba2

  1. Hello I am learning PHP and made a codeacademy PHP online course. Basic stuff and interesting course for free. But there is a do/while exercise I can't get my head around: In the following, there is a flipcoin example, which flips, as long the result is head. In the do statement there is the if and the else The if condition is $flip and it echoes a H letter for Head. The else echoes a T for Tail. $flip is random 0 or 1 My question: How can the if and else statements be H or T if $flip is random? I don't understand the $flip variable, because in my head it can be 0 or 1.....therefor if is not one fixed value, because of the rand(0,1) it can change How does the programm to put out a H or a T? I hope my question is clear enough Thanks for any clarification Jakob <!DOCTYPE html> <html> <head> <link type='text/css' rel='stylesheet' href='style.css'/> <title>More Coin Flips</title> </head> <body> <p>We will keep flipping a coin as long as the result is heads!</p> <?php $flipCount = 0; do { $flip = rand(0,1); $flipCount ++; if ($flip){ echo "<div class=\"coin\">H</div>"; } else { echo "<div class=\"coin\">T</div>"; } } while ($flip); $verb = "were"; $last = "flips"; if ($flipCount == 1) { $verb = "was"; $last = "flip"; } echo "<p>There {$verb} {$flipCount} {$last}!</p>"; ?> </body> </html>
  2. I changed it ti foundation slider! Thanks for the tip! All the best
  3. Thanks I used flexslider before and it worked fine. It doesn't work, when I delete the script line with the 1.7 jquery...can I change the path to the foundation jquery? Thats something I am not getting yet I have to look into the foundation slider Thanks again
  4. Hello I have a non PW question.... Somehow I am too stupid to get Flexslider 2 SLIDER running.... Does anybody have a suggestion what could be wrong here? I have copied the Flexslider 2 code one to one and it is not responsive.... the website: http://www.airbrush-makeup.ch/test/index.html Thanks for any help Jakob <!doctype html> <html class="no-js" lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Airbrush Makeup</title> <link rel="stylesheet" href="css/app.css"> <link rel="stylesheet" href="css/style.css"> <link rel="stylesheet" href="flex/flexslider.css" type="text/css" media="screen" /> </head> <body> <div class="grid-container"> <div class="grid-x grid-padding-x"> <div class="large-3 medium-3 cell"> <img src="img/logo.png"> </div> <div class="large-9 medium-9 cell"> <div class="title-bar" data-responsive-toggle="example-menu" data-hide-for="medium"> <button class="menu-icon" type="button" data-toggle="example-menu"></button> <div class="title-bar-title">Menu</div> </div> <div class="top-bar" id="example-menu"> <div class="top-bar-right"> <ul class="dropdown vertical medium-horizontal menu" data-dropdown-menu> <li class="farb"><a href="#">HOME</a></li> <li><a href="services.html">SERVICES</a></li> <li><a href="workshops.html">WORKSHOPS</a></li> <li><a href="portfolio.html">PORTFOLIO</a></li> <li><a href="ubermich.html">ÜBER MICH</a></li> <li><a href="kontakt.html">KONTAKT</a></li> <li class="padright"><a href="#">DINAIR-ONLINESHOP</a></li> </ul> </div> </div> <div class="kontakt_header"> <p>TERMIN VEREINBAREN: Tel. 077 400 1 400 / info@airbrush-makeup.ch</p> </div> </div> </div> <div class="grid-x grid-padding-x"> <div class="large-12 medium-12 cell" id="balken"> </div> </div> <div class="grid-x grid-padding-x"> <div class="large-12 medium-12 cell" id="sliderx"> <!-- Place somewhere in the <body> of your page --> <div class="flexslider"> <ul class="slides"> <li> <img src="img/Dinair_Wechsler_Index_3.jpg" /> </li> <li> <img src="img/Dinair_Wechsler_Index_3.jpg" /> </li> <li> <img src="img/Dinair_Wechsler_Index_3.jpg" /> </li> </ul> </div> </div> </div> <div class="grid-x grid-padding-x" id="card-container"> <div class="large-4 medium-4 cell" id=""> <div class="card" id="cardwidth"> <!-- <div class="card-divider"> This is a header </div> --> <img src="img/1.png"> <div class="card-section"> <h5>AIRBRUSH-WORKSHOP</h5> <p>Faszination Airbrush-Makeup: Schnuppern Sie mit dem Workshop „Erste Schritte“ erstmals Airbrush- Luft oder lernen Sie Tricks und Kniffe im Anfänger-Workshop.<br/><br/> </p> MEHR ERFAHREN </div> </div> </div> <div class="large-4 medium-4 cell" id=""> <div class="card" id="cardwidth"> <!-- <div class="card-divider"> This is a header </div> --> <img src="img/2.png"> <div class="card-section"> <h5>MAKEUP-SERVICES</h5> <p>Ein tolles Tages-Makeup oder das perfekte Styling für den besonderen Event - mit Airbrush wird jedes Makeup erstklassig! Vereinbahren Sie Ihren Termin für Ihr persöhnliches Airbrush-Makeup.<br/><br/> </p> MEHR ERFAHREN </div> </div> </div> <div class="large-4 medium-4 cell" id=""> <div class="card" id="cardwidth"> <!-- <div class="card-divider"> This is a header </div> --> <img src="img/3.png"> <div class="card-section"> <h5>DINAIR ONLINE-SHOP</h5> <p>Entdecke jetzt den perfekten Teint mit den praktischen Airbrush-Sets von DINAIR:<br/><br/> </p> MEHR ERFAHREN </div> </div> </div> </div> <!-- TESTE OB DIV STIMMEN --> </div> <script src="bower_components/jquery/dist/jquery.js"></script> <script src="bower_components/what-input/dist/what-input.js"></script> <script src="bower_components/foundation-sites/dist/js/foundation.js"></script> <script src="js/min/app-min.js"></script> <!-- jQuery --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.min.js">\x3C/script>')</script> <!-- FlexSlider --> <script defer src="flex/jquery.flexslider.js"></script> <script type="text/javascript"> $(function(){ SyntaxHighlighter.all(); }); $(window).load(function(){ $('.flexslider').flexslider({ animation: "slide", start: function(slider){ $('body').removeClass('loading'); } }); }); </script> </body> </html>
  5. Hello Quite a basic question from me: I am wondering what's the best approach to code cards like in the example image. What is the most elegant and efficient way to make these. Thanks for any suggestions. Jakob
  6. This works! Thanks <div class="column nopad" id="quadrat2-footer "> <p> <a href="https://c1.staticflickr.com/1/357/31876784275_12286240d4_h.jpg" data-fancybox="images-single"> <img src="https://c1.staticflickr.com/1/357/31876784275_fbc9696913_m.jpg" /> </a> </p> <div style="display: none;"> <?php foreach($page->galerie as $image) { echo "<a href='{$image->url}' data-fancybox='images-single' title='{$image->description}'></a>"; } ?> </div> </div>
  7. I don't think I need the data-thumb attribute, it works well without it
  8. Hello I am using the Fancybox 3 gallery and I have a problem loading the images from the backend via PHP into the imagegallery. Please help with the PHP.... I am using the Gallery with one preview image: http://codepen.io/fancyapps/pen/jyEGGG/?editors=1000 Here is the original code: <h3>Gallery with one preview image</h3> <p> To show only one or a few images but have a large gallery, simply hide the rest of the links. <br /> Optionally, use <code>data-thumb</code> for thumbnail image. </p> <p> <a href="https://c1.staticflickr.com/1/357/31876784275_12286240d4_h.jpg" data-fancybox="images-single"> <img src="https://c1.staticflickr.com/1/357/31876784275_fbc9696913_m.jpg" /> </a> </p> <div style="display: none;"> <a href="https://farm3.staticflickr.com/2947/33594572585_b48eba935b_k_d.jpg" data-fancybox="images-single" data-thumb="https://farm3.staticflickr.com/2947/33594572585_46ca00f3a5_m_d.jpg"></a> <a href="https://farm3.staticflickr.com/2859/33395734202_522f9d8efd_k_d.jpg" data-fancybox="images-single" data-thumb="https://farm3.staticflickr.com/2859/33395734202_15a81c4ef3_m_d.jpg"></a> </div> How do I put all my images into the div? I guess it is quite simple, but I have failed all day trying to implement this. My folder in the backend with the images is called 'galerie'. I have tried something like this with a foreach array but it doesn't work. <h3>Gallery with one preview image</h3> <p> To show only one or a few images but have a large gallery, simply hide the rest of the links. <br /> Optionally, use <code>data-thumb</code> for thumbnail image. </p> <p> <a href="https://c1.staticflickr.com/1/357/31876784275_12286240d4_h.jpg" data-fancybox="images-single"> <img src="https://c1.staticflickr.com/1/357/31876784275_fbc9696913_m.jpg" /> </a> </p> <div style="display: none;"> <?php foreach($page->galerie as $image) { echo "<a href='{$image->url}' data-fancybox="images-single" title='{$thumbnail->description}'></a>"; } ?> </div> Thank's a lot for any help! Jakob
  9. Hello I have an image with 3 different squares ( see image - white square on the left with 3 differently coloured little squares ), which each need to link to other pages. What is the best way to achieve this? Do i put 3 DIV's over the <img>, or do I put 3 square DIV's in a big square DIV? Thanks for any help Jakob
  10. Thanks a lot for Your input! Very much appreciated. In my understanding media queries only react to screen size. The ipad Pro has more or less the same size as a laptop. So a media querie is not the right way, otherwise the bg-attachment scroll will be applied to the laptop, where bg-attachment fixed works fine. I would need to use Your JS example, right? Thanks again Jakob
  11. Hello Is there a way to program my code in a way, that the website has Background-Attachment Fixed on laptops and PC's and Background-Attachment Scroll on mobile devices? On ios Background-Attachment Fixed does not work. It can't be done with media queries, because the ipad pro is bigger than my laptop. Maybe a Javascript or something. I found this, but not knowing Javascript I don't know if it would work. Could this work? if (iosVersion >= 7) { $(document).scroll(function() { $('#background').css('background-position', '0px ' + $(document).scrollTop() + 'px'); }); } Can anybody offer some advice? Thanks a lot Jakob
  12. Hi there I am intending on using the shopify button, which is created by embedding a code from shopify... Is that doable with processwire and php? I saw they make an embed code for html...can I put that somehow in the backend, so that the php puts it out as html code? At the moment I have this PHP code: <?php foreach ($page->children() as $product): ?> <div class='single-product-wrapper'> <img src="<?php echo $product->img->first()->url; ?> "/> <p><?php echo $product->inhalt1; ?></p> </div> <?php endforeach; ?> What is the best way to combine shopify an PW? Thanks Jakob
  13. Good question... The two on the bottom are for flexslider, which I removed ( forgot to remove them ) One for an animation ( easing in of images ), I just copied the jquery from my example
  14. Here's my code for the page with all the products, which works. Image size works via CSS. I am planning implementing shopify, so there will be no single product page. By the way, I am using the shopify button, which is created by embedding a code from shopify...is that doable with processwire and php? I saw they make an embed code for html...can I put that somehow in the backend, so that the php puts it out as html code? <!doctype html> <html class="no-js" lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>In-Albon Devotionalien</title> <link rel="stylesheet" href="<?php echo $config->urls->templates?>styles/app.css"> <link rel="stylesheet" href="<?php echo $config->urls->templates?>styles/style.css"> </head> <body> <!-- Header --> <!-- INCLUDE NAV.PHP --> <?php include("./header2.inc"); ?> <div class="row"> <div class="large-12 medium-12 columns" id="centerdiv"> <div class="wrap"> <div class="bilder-produkte"> <?php foreach ($page->children() as $product): ?> <div class='single-product-wrapper'> <img src="<?php echo $product->img->first()->url; ?> "/> <p><?php echo $product->inhalt1; ?></p> </div> <?php endforeach; ?> </div> </div> </div> </div> <!-- Footer --> <?php include("./footer.inc"); ?> <script src="<?php echo $config->urls->templates?>bower_components/jquery/dist/jquery.js"></script> <script src="<?php echo $config->urls->templates?>bower_components/what-input/what-input.js"></script> <script src="<?php echo $config->urls->templates?>bower_components/foundation-sites/dist/foundation.js"></script> <script src="<?php echo $config->urls->templates?>js/min/app-min.js"></script> <script src="<?php echo $config->urls->templates?>js/jquery-2.1.3.min.js"></script> <script src="<?php echo $config->urls->templates?>js/functions.js"></script> <!-- jQuery --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="<?php echo $config->urls->templates?>js/libs/jquery-1.7.min.js">\x3C/script>')</script> </body> </html>
  15. Hello again Thanks for all the help, love the forum! How do I resize the image? I have no Idea how to write something like this ( $thumbnail ) in Shorthand. <?php foreach($page->image_field as $image) { $thumbnail = $image->size(150,100); echo "<p><a href='{$image->url}'><img src='{$thumbnail->url}' alt='{$thumbnail->description}' ></a></p>"; } ?> Also, I wrote the shorthand code in regular PHP, and the images didn't show anymore.... this <?php foreach ($page->children() as $product): ?> <div class='single-product-wrapper'> <img src="<?php echo $product->img->first()->url; ?> "/> <p><?php echo $product->inhalt1; ?></p> </div> <?php endforeach; ?> into this <div class='single-product-wrapper'> <?php foreach ($page->children() as $product){ echo $product->img->first()->url; echo $product->inhalt1; } ?> </div> That is the same, isn't it? Thanks Jakob
  16. Hey there, thanks again Almost there With this code: <?php foreach ($page->children() as $product): ?> <div class='single-product-wrapper'> <img src="<?php echo $product->img; ?> "/> <p><?php echo $product->inhalt1; ?></p> </div> <?php endforeach; ?> I get this output: <div class='single-product-wrapper'> <img src="roter-engel-kerze-gross-big.png "/> <p><p>Grosser Roter Engel mit Kerzenlicht</p> <p>Ein grosser Keramikengel mit kleinen Löchern, durch welche das Kerzenlicht scheinen kann. Filigrane Gesichtszüge geben der Skulptur einen feinen Touch. </p></p> </div> <div class='single-product-wrapper'> <img src="sitz-big.png "/> <p><p>Sitzender Engel</p> <p>Dieser sitzende engel kann auf einer Möbelkante platziert werden und schaut fröhlich im Zimmer umher.</p> <p>Die Figur ist ca. 25 cm hoch.</p></p> </div> <div class='single-product-wrapper'> <img src="gruner-engel-mittel-stehend-big.png "/> <p><p>Fröhlicher stehender grüner engel</p> <p>Die Figur kann überall platziert werden und verbreitet gute Stimmung.</p> <p>Höhe: 15cm</p></p> </div> But somehow the images don't show.... I tried the $product->img->url doesn't work. It's probably a detail, but I don't see it Thanks
  17. Thanks for sharing! I started coding everything at once, so my PHP is lacking. Great to here how You came to it...helps a lot.
  18. Fantastic! Thank You very much I need to go to PHP school!
  19. Hello Real Beginner here. I am trying to loop the children of a product ( Keramik ) I have. They should look as an image with text underneath ( Example with bicycle tires ). I create for each product an own child page . I can't get my head around this... Thanks for all the help. Jakob I would like to have 3 Images with text on each row My structure: Each child has a Title, img and description
  20. Hej thanks! Well, there is apache running on the server...
  21. this happens with $config->debug true XHR Loaded (resize - 500 Internal Server Error - 7.216459000002942s - 754B) VM5639:3 http://diabeu.com/processwire/page/image/resize?id=1&file=skull.gif&width=505&height=727&hidpi=0 VM5640:3 Time over 1000ms VM5641:3 Object {startedDateTime: "2016-08-25T17:16:39.149Z", time: 7216.459000002942, request: Object, response: Object, cache: Object…}
  22. Console : http://diabeu.com/processwire/page/image/resize?id=1&file=skull.gif&width=505&height=727&hidpi=0 Failed to load resource: the server responded with a status of 500 (Internal Server Error) The file is in the assets/files folder
×
×
  • Create New...