Jump to content

diogo

Moderators
  • Posts

    4,314
  • Joined

  • Last visited

  • Days Won

    80

Everything posted by diogo

  1. On that example the field being checked has a maximum of 1 image: In this case, the field returns the image itself or false NULL (in case it's empty) instead of an array. edit: //if empty count($page->field_name) === 0 count($page->field_name)>0 === false both forms are good
  2. Yep, learn as much as you can by yourself. Then, break your code in parts and solve one part at a time. Ask away as any particular problems appear in the way and we will gladly help. Soma, I counted 3km
  3. An image field always holds a wireArray, wish returns true even if empty. To have a false in an if statement you want it to return false or 0. if (count($page->field_name)){ This will return 0 in case the wireArray is empty.
  4. This happens because "repeaterPageId" is a variable, and "#repeaterPageId a" is a string (notice that it is inside quotes on your code). Javascript has no way to know that it should use "repeaterPageId" as a variable instead as part of the string. What you would have to do here would be add the string "#" plus the string that "repeaterPageId" is holding plus the string " a" by concatenating them: $("#" + repeaterPageId + " a") // <-the space inside the quotes before the "a" is important This will result in: $("#1234 a") edit: This may be confusing when you can use variables inside of double quotation marks in PHP like echo "this $variable will work"; , but PHP has a way of knowing that $variable should be treated as a variable because of the $. So what we are doing there is exactly the same as doing echo 'this ' . $variable . ' will work'; in PHP.
  5. have a look at this post http://processwire.com/talk/topic/2210-help-getting-a-custom-styles-php-file-working/?p=20641
  6. You don't have to be logged in to access the homepage of the website. You just have to put that piece of code in the home.php and visit the homepage as any visitor would. That alone will make the code work.
  7. <script language="javascript" type="text/javascript"> (function(window, $, PhotoSwipe){ $(document).ready(function(){ var galleryId = '<?php echo $repeaterPageId; ?>'; // <- the quotation marks were missing here console.log(galleryId); // <- I assume here you want to log "galleryId" and not "repeaterPageId" var options = {}; $("#galleryId a").photoSwipe(options); // I'm confused, do you have an HTML element with the id "galleryId" in your code? }); }(window, window.jQuery, window.Code.PhotoSwipe)); </script> I corrected two things in your code that were definitely wrong, but even with them corrected I don't really understand what's going on there because your not really using the variable that you defined with the help of PHP. What you are using that seems similar, is this element "#galleryId", but this is not the same thing, because "galleryId" is a javascript variable while "#galleryId" is the way that jQuery calls the id of an html element. Two completely distinct things.
  8. the value of a repeater is pageArray, so getNext() should work. What value are you using as the parameter? Edit: Ok, quickly tested, and everything works as expected. I will post here my test so you can analyze and make sure that you are using it the right way: $repeaterArray = $page->repeater; $firstElement = $repeaterArray->first(); echo $repeaterArray->getNext($firstElement); //returns successfully the second element echo $firstElement->next(); //also returns the second element
  9. Create the structure exactly how you want it in the admin tree and the URLs will follow the same logic, from there you can easily build the menus. For this have a look at this module http://modules.processwire.com/modules/markup-simple-navigation/ Plus, don't only read the links that Joss pointed to. Spend some time following them and try to build those sites yourself before starting to work on your own.
  10. Thanks for the tip Adam
  11. diogo

    Book Recommendations

    Depends a lot on how the book is written. I really don't like those books that assume that you are reading them in front of the computer. I avoid them like the plague Of course it's good to test things, but if the book is well structured (IMO) You can do it after each chapter for example. Larry Ullman books are great in that matter.
  12. I can also say that the pw website I have on all-inkl.com runs smoothly and without a problem.
  13. Soccer? What's soccer?? edit: just to clarify. I don't think you have to understand them right away. But I think that, by the time you are already doing a review, these concepts should be already clear. Anyway, I don't want to pick on @Tyssen, as it's a nice review regardless.
  14. diogo

    Book Recommendations

    Can anyone like a post of mine? 666 is evil edit: thanks Wanze
  15. == json == txt == xml == png == ttf == js == css == anything
  16. I honestly don't understand the confusion with pages. When everything are pages, that's really all you have to know. Couldn't be any simpler...
  17. diogo

    Book Recommendations

    How much time per day do you spend looking at the light of the screen? I would guess too much... I prefer to stay away from it as much as I can, and reading on paper is great for this. Plus, you can do it on a coffee table outside or on a bench by the river Now I bought a kobo e-reader. With the e-ink technology It really feels like paper and I recommend it to everyone.
  18. I'm interrupting my vegetative state on the forum to say that I went for Linode after my last message ("I'm not a forum kind of person" ) and I'm very happy with it. I still have the 19.95$/month where I keep three production websites and all my experiments and developing stuff. Never had a single problem and learned a lot in the way.
  19. I confirm that this works on Fortrabbit
  20. Not the ideal solution though... Maybe something went wrong when you installed PHP?
  21. Good interview Ryan!
  22. This should work. create a date field besides the counter field. and put change the code to this: if (!$user->isSuperuser()) { if( date('Ymd', strtotime($page->day)) != date('Ymd') ) { $page->counter = 0; $page->day = today(); } else { $page->counter += 1; } $page->of(false); $page->save('counter'); $page->of(true); } echo $page->counter; written in the browser and not tested. But it should give you an idea.
  23. You can use the Page link abstractor module to prevent this from happening http://modules.processwire.com/modules/page-link-abstractor/
  24. <?php # Pete, this one is missing ?>
  25. Apeisa, the interrogation mark is missing...
×
×
  • Create New...