Jump to content

arjen

Members
  • Posts

    1,222
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by arjen

  1. If you want to translate text, labels and stuff you can do this by wrapping your texts like: <?php echo __("String to be translated."); Read more on this page how to work this out in the backend. Translating files is really easy!
  2. $s is like one item which belongs to the group $skyscrapers. I prefer to name them $skyscraper so you have: foreach($skyscrapers as $skyscraper) { echo "<li><a href='{$skyscraper->url}'>{$skyscraper->title}</a></li>"; } See more about a foreach in the manual. If you want to limit the number of results you can do this: $skyscrapers = $pages->find("template=skyscraper, limit=10"); There are some great tutorials in this forum or on the wiki. I would recommend to do them all. I'm coming from TXP too and and while I still like it very much, ProcessWire is second to none when it comes to structuring data.
  3. Try: $rootTeaser1 = $pages->get(1001);
  4. Nope, sorry ezeey. I also want to use FormBuilder on the subsites, so I'm going to check this out. Finally got a chance to test my alteration and it didn't seem to break anything on the live site.
  5. $pages->count("selector") is supposed to use less overhead and therefore more efficient.
  6. Are you sure LanguageSupportPageNames.module is installed?
  7. Glad I could help. Using a Page fieldtype reference over i.e. childrenpages is that you are very flexible what you want to do.
  8. What I would do is create a page "/tickets/". Under that page there will be children with a "ticket" template. That ticket template has a Page fieldtype (let's say: user_reference) reference to a user. This way you can get the tickets from one user by doing: $pages->find("ticket_reference=$particularuser"); When a user orders a ticket you basicly create a page underneath "/tickets/" and store the user id in the user_reference field. You can save it like: $ticket = new Page(); $ticket->template = $templates->get("ticket"); $ticket->parent = $pages->get("/tickets/"); $ticket->title = "Some title"; $ticket->user_reference = $currentUser; $ticket->save(); All written in the browser, but you should get the idea. Also you might want to check out this excellent thread by soma to create your forms. My advise is to start really simple. Just save and reference user. Test it thoroughly and add additional fields.
  9. Found some interesting things: Within the createOrder() function the $this->input->post->newsletter produces different output than the $fields['newsletter']['value'] So saving the field on this line with the post value $order->sc_newsletter = wire()->sanitizer->text($this->input->post->newsletter) does work. Now I have to find out why the data isn't stored correctly in the array.
  10. Apeisa (and others), How would you approach creating an extra field for a single checkbox to be saved with an order? I.e. a label like "I want to signup for this newsletter". For now I've created an extra field (checkbox) attached it to the template, added the checkbox option to the array of fields. It all works fine except that in the final save the newsletter checkbox get set to 1. I suspect it to be somewhere around this line. We've added that particular check to see it a field isset and therefore the value can be set to 1. When on the confirmation page this echo's all fine, but when creating/saving the order the newsletter checkbox get sets to 1. When printing the array it does show up as 1. That is because in the $orderFields array for some reason the newsletter box gets filled. Any ideas? I've tested this on several browsers, cleaned cookie so I suspect that not to be the issue.
  11. You're welcome. Please keep in mind that this works for me on my local server, but the code may need some working on for use on production sites.
  12. Ryan just posted this page about hooks on the main website. Edit: nevermind seems kongondo is a lot quicker than I am
  13. Will brush up my github forking skills.
  14. I got it working, but it is very hackish and definately should be looked after. I will fork apeisa's code tomorrow and try to figure out why my current version does work and the latest on github won't. For now you can check if this gist works for you. It does for me. It's an old version of the module I installed on my local machine at home. Then I changed some code with the new version. I didn't fix one warning, just placed an @ before it to stop the warning.
  15. Ezeey, I experiencing the same behaviour as my previous post. Did you manage to get it up and running? Could it be that a previous fix has been reversed? It doesn't seem so though when looking at the github history.
  16. Lovely footer indeed. But I think the footer didn't change Nice work Nico!
  17. To avoid any confusion I think your last option is the best one. It produces at least very clean code. Will try to create a small module. Thanks again Soma. Couldn't have do this without you.
  18. I do want to list all authors on a /authors/ page, but only the one who are connected to books. So you say using this module I can reverse the relationshop and still be able to add authors to a book? That would solve my problem and the content manager will still be able to use it properly.
  19. There are usually multiple authors related to one book, so from the content manager to my this is my preferred option. It would be handier otherwise When testing your code works. I got some books with one author (and one book), with multiple authors with one book, multiple authors on one book, unique author on unique book and offcourse some authors with no books. It does seem to work fine. Or are you saying that this query shouldn't be used since it's not optimised?
  20. There will be a few hunderd at minimum. I don't think it will reach into the thousands. I did some testing and your MySQL query works like a charm. Thanks for your answer soma!
  21. Hi! I have a question about optimizing some code. It's about a site which has books and authors. The structure is like this: - Books -- Book 1 -- Book 2 - Authors -- Author 1 -- Author 2 -- Author 3 The book template has a Page fieldtype which is linked to an author. Right now I'm looping through all the authors - and if I can find a relation to a book based on the Page fieldtype - I show that author. I've got a feeling this might be accomplished by a selector. How can I display only authors who at least have one relation to books using a (single) selector?
  22. Nice! It didn't know you can do that. We definately need a markup guide and templating guide with different approaches. There are some great posts hidden in this forum. If only I could find some time to collect all that information.
  23. I always sanitize all user input by default. It isn't much work and I know I'm really lazy so I have to discipline myself. It makes me sleep well at night
  24. Is "sets output formatting to false" necessary since it's a new page/user?
×
×
  • Create New...