Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/16/2017 in all areas

  1. Hello guys! i'm here to solve the mystery of seavuel.com ! I'm the owner. I am planning to release a commercial site-profile for a hotel-website on codecanyon.net What do you think about the idea/project? I mostly think of it as a long-term project with regular updates and a low-price.
    8 points
  2. To be honest I'm not sure this will make things considerably easier to grasp for (new) people. I can already see people trying to use it as replacement for a templating language. I really don't think it's worth it just to not have a $main/$sidebar variable, especially for new people. I'd imagine it's more confusing than helping. I'd much rather would like to see a guide dedicated to examples of direct output -> delayed output -> separation business logic / view logic -> templating engine (twig/blade), what the benefits are and how to switch between them (e.g. same output in different strategies). Especially the third one is a kinda pet peeve of mine, because I went into the rabbit hole myself, where markup was so deeply coupled with processwire api stuff, that it was a nightmare to change anything. For me this seems to be more in line with your motto of teaching people how to fish.
    5 points
  3. /** * Global function, therefore does work everywhere, * but will always refer to the first pw instance * in case of multi instance usage. * Because of that it's discouraged to use this in * modules. */ wire("apivar") /** * Safest way to get the api variable in wire derived * classes like modules. */ $this->wire("apivar") /** * Does work as well, but some (core) classes have that * type of access disabled. It also prevents you from * using a custom paramater $apivar in your class. */ $this->apivar
    5 points
  4. This is a multi-part question, so lets try to break it down. The normal workflow resembles the following: Data is requested on the client-side. In your case, this is via ajax. You'll need JavaScript code to send the ajax request The request is either sent to the current page or to a named url, i.e. you could have a dedicated page to receive the ajax request You process the ajax request by sanitizing and whitelisting the inputs You send a response back, normally as JSON, but could be xml, or whatever JavaScript code receives the response and manipulates the DOM (aka updating the page without refresh) How Tos How to Work with Ajax Driven Content: 1, 2 See #1 See input, sanitize, + search forums using these terms for more examples . See #1 See #1
    4 points
  5. Hello I opensourced my Telegram bot called "Voxgram" https://github.com/NinjasCL/voxgram Now you all have an example of working with the Rest Helper and the Python Telegram Framework (I think the my python code is a mess) but anyway here you go :).
    3 points
  6. Hello @darkmesaia I often recommend these to start with: Important concepts: https://www.smashingmagazine.com/2016/07/the-aesthetic-of-non-opinionated-content-management-a-beginners-guide-to-processwire/ Understanding Processwire Templates, Fields and Pages: https://medium.com/@clsource/understanding-processwire-templates-fields-and-pages-201aecd0a1a4#.m9yquavll Step-by-step guide, 4 part tutorial: http://blog.mauriziobonani.com/processwire-basic-website-workflow-part-1/ Approaches to categorising site content:
    3 points
  7. I helped @raulyjo through MP, the problem did not come from the module. It was missing a page and the template code that were probably forgotten during the migration. All good now
    3 points
  8. Hi all. For a while now been wondering how many would be interested in a backend and frontend shop catalogue built on top of PadLoper? I've previously spoken to @apeisa about this and his take is that there are no plans to develop PadLoper in this direction but he's happy to support such efforts. The gist of the backend shop catalogue is to provide one place (think ProcessModule) where you can manage your PadLoper products - add, edit, delete, track sales, etc without having to set up the underlying structure yourself. The frontend would be like a shop/webstore profile, a frontend cart basically, that's customisable. The shop would be 100% powered by PadLoper. This means that to use the 'shop catalogue' would require that PadLoper is installed. These are just loose ideas at the moment for a pro module. This might or might not see the light of day depending on feedback. Anyway, would love to hear thoughts, thanks.
    2 points
  9. He talks about the separation of concerns... ...and MVC is a popular pattern that enforces that. But they're not exactly the same thing, for sure.
    2 points
  10. I think this new approach is similar to template engines in one respect: the idea of extending a named block. This feature is present in template languages like Smarty and Twig and I for one find that feature very useful. I don't see any other similarities to template engines though. What would be your idea of misuse of this new strategy? If you mean it allows (encourages?) developers to not follow the MVC pattern then I don't see this as a big issue. There is no cardinal rule: "Thou shalt use MVC in all projects" - it depends very much on the type of developer you are and the type of project you are working on. When Ryan says... ...I take this to mean people who are new to PHP development in general. People who have a design background, or those used to a drag-and-drop interface, or who have previously worked only with static HTML. If someone has a lot of PHP experience I doubt they would find anything about PW difficult to understand - more like a breath of fresh air. And people who are new to PHP development are not going to be: building large, complex web projects working on long-lived projects that will be handed over to future developers collaborating on a project with other developers in a team For any of these I totally see the value of MVC. But if you are a newbie working on <10 page brochure websites you do not need MVC.
    2 points
  11. Have you thought about using WireCache instead ? https://processwire.com/blog/posts/processwire-core-updates-2.5.28/#wirecache-upgrades
    2 points
  12. https://processwire.com/blog/posts/processwire-3.0.49-introduces-a-new-template-file-strategy/#Comment12849 By Ryan: "What's described in this post is not a template engine, and not even related to a template engine. Actually it should work quite nicely alongside a template engine if you are using one. What markup regions do is essentially the same thing that the existing PW region() function does, but with some added flexibility and simplicity." If it can be used together with a template engine, then it is the way to go I think. While teaching to fish instead of simply feeding is good a concept, when there are so many different ways to fish, you have to start teaching by using one method only so that all the newcomers can learn the same thing at least at the beginning. This new method/strategy reminds me of Magento, but it is a lot simpler to implement. I do support it. Let's teach people (ourselves to begin with) how to use it with and without a template engine
    2 points
  13. Hi! With processwire there are many solutions to one problem. Also about "how do I structure my project". In general I'd always recommend to just start with your project and learn by doing so that you learn why the structure you chose is good or maybe why not to improve the next time. Have a look at this thread. @MilenKo is documenting his start with processwire there pretty thoroughly - a lot of questions about starting with processwire are discussed. I'd recommend to scan the first couple of pages to get some inspiration to get started! Also there are the tutorials on the homepage: http://processwire.com/docs/tutorials/ Also you might want to make a test installation with one of the site-profiles which are included as an example to learn from. Good luck and enjoy : )
    2 points
  14. I'm not quite clear what you mean but maybe these are some solutions: (first) child redirect: here and here (menu) item that links to another page: here
    2 points
  15. The error is visible if you install Tracy Debugger.
    2 points
  16. Hi Adrian, Confirmed this version fixed the problem. Gideon
    2 points
  17. This is just an idea... You could consider making the creation and maintenance of these articles easier for site editors by having a simpler structure in the page tree (just the categories as parent pages), entering the article date with a datetime field, and then creating the desired URL for the frontend using URL segments (enable this on the category template). So your category template would look for the following URL segments: segment 1: year - sanitize to integer, throw 404 if out of range segment 2: month - sanitize to integer, throw 404 if out of range segment 3: day - sanitize to integer, throw 404 if out of range segment 4: article page name - throw 404 if no match for article page name In terms of finding articles that match a given year, month or day you could convert to a timestamp range as Ryan shows here, but to make it easier (and considering you'll need the integers for building the article URLs) I would instead add 3 integer fields to your article template, set the field visibility to "Hidden (not shown in editor)" and then populate them with a saveReady hook. // in /site/ready.php $this->pages->addHookAfter('saveReady', function($event) { $page = $event->arguments('page'); if($page->template->name === 'article' && $page->article_date) { $page->day = date('d', $page->article_date); $page->month = date('m', $page->article_date); $page->year = date('Y', $page->article_date); } }); Now it's really easy to find articles, e.g. $matches = $pages->find("template=article, year=2016, month=11, sort=sort"); For the question in your original post you'd do something like this: $latest_article = $pages->get("template=article, parent=/politics/, sort=-article_date"); $recent_articles = $pages->find("template=article, parent=/politics/, article_date={$latest_article->article_date}, sort=sort, limit=5"); $day_link = "/politics/{$latest_article->year}/{$latest_article->month}/{$latest_article->day}"; // use this as the first link to the 'parent' page When you need to output the URL of an article you would build it like this: $url = "{$article->parent->url}{$article->year}/{$article->month}/{$article->day}/{$article->name}/"; For convenience you'd probably make a simple function that returns this URL string. In the backend, rather than browse through the page tree, if you want to list articles by day/month/year you can use the "Find" lister. Or better yet a dedicated Lister Pro instance for articles.
    2 points
  18. Sounds like you would want to handle 5 data types: boats rooms cruises customers bookings A boat I'm assuming has a fixed number of rooms. Perhaps start with a data model like this which takes everything into consideration: Boats (boats.php) Boat A (boat.php) Room 1 (room.php) Room 2 Room 3 ... Boat B Room 1 Room 2 ... Customers (customers.php) Customer 1 (customer.php) Customer 2 ... Bookings (bookings.php) Booking 1 (booking.php) Booking 2 ... Cruises (cruises.php) Cruise 1 (cruise.php) Cruise 2 ... Cruise template fields: title date boat (page-select to /boats/, boat.php) Customer template fields: first name last name (other typical fields) Cruise template fields: title boat (page-select to /boats/, boat.php) date Booking template fields: customer (page-select to /customers/, customer.php) cruise (page-select to /cruise/, cruise.php) rooms (based on cruise->boat, select for the rooms that the boat has) I'm assuming the interface would be PW's admin. Perhaps use some hooks and ListerPro to tie it all together. Make it as user-friendly as possible. Maybe have a page within the admin outputs each cruise with which rooms have been booked vs. unbooked which would be friendly to the site admins.
    2 points
  19. The Fotomediale is a annual festival of photography for children's and youth photography in Freiburg, Germany. This small website provides information about the festival and its workshops. Because of the topic, this site is very picture heavy. Almost every page contains it own set of images displayed in the background. The images cycle through automatically, but you can also use the buttons on the edges (or if you want arrow keys on your keyboard ). If you want to see the images, you can collapse both the navigation and content area. The transitions between pages were made with Ajax and pushState, but you can also access them directly via their URL. To handle the large image backgrounds, all of the images are lazy loaded using lazysizes. The registration form was created using the API. www.fotomediale.de Modules used: ProCache Markup Sitemap XML Email Obfuscation (EMO) Tracy Debugger Regards, Andreas
    1 point
  20. This week we take a look at a new template file output strategy available in ProcessWire 3.0.49+. (Not to be confused with a “template system” like Twig or the like, as our template system is PHP). This strategy is an experimental but super-simple new alternative to direct output and delayed output, and in some ways a combination of both. Yet it’s likely to be more accessible for front-end developers and newcomers to ProcessWire, without sacrifices. Have a read and let us know what you think. https://processwire.com/blog/posts/processwire-3.0.49-introduces-a-new-template-file-strategy/
    1 point
  21. May be starting with something small like a subscription service. Then making things a little more complex like a T shirt shop. Then a more complex one with features similar to woocommerce or something like that. I think is a wonderful idea.
    1 point
  22. As a general rule, you can copy any PW module from /wire/modules/ to /site/modules/ if you want to customise it. When you do a Modules > Refresh you will see a notice... Session: Module "SomeModule" has multiple files (bold file is the one in use). Click here to change which file is used ...and you can enter the module settings to switch between the version in /wire/ and the version in /site/.
    1 point
  23. Hi Kongondo, I'm interested, although I have not used PadLoper yet, I might want to use it when time comes to get rid of any of "my Woo shops". Not in the near future though.
    1 point
  24. Done: https://processwire.com/about/chat/ I included a sensible (I hope!) intro to say why people should consider using the forums for most questions and answers, and the chatroom as a place to hang out or get help in a hurry if someone's there.
    1 point
  25. LostKobrakai did not mention MVC at all, probably he did not even refer to it , as far as I can see. Speaking of MVC, I'm not convinced that "strict MVC" is that much useful either, and I'm not alone eg.: http://paul-m-jones.com/archives/6288 But either way, I do agree with @Robin S that lots of brochure websites do not need MCV or the alike, and even webshops can be successful without them especially if one does not have to refactor too much in it the future for some reason. When a system is based on solid system design (meaning the site does what the client needs in the first place) then there is less to worry about regaring possible refactoring. But it is getting off-topic here...
    1 point
  26. Thanks @Robin S that was it! Now it is working perfectly
    1 point
  27. very interesting discussion here. @LostKobrakai: If you don't mind, could you elaborate a bit more in detail why this new template strategy could be misunderstood or confused with a template engine? I really don't get the point, but would like to. To my - admittedly rudimentary - knowledge a template engine like twig adds only a little bit syntactic sugar like {{ var }} or something like {% block content %} Content of the page... {% endblock %} But what has this to do with the template strategy Ryan introduced here? And i also fail to understand in which regard the new template strategy could potentially lead to a tight coupling of markup with api stuff? I mean isn't the separation of business logic and view completely independent of using an engine like twig or not? Or in other words: Couldn't you mix up markup and business logic as easily with twig as wihtout it? Or again in other words couldn't you use the MVC pattern as easily with Ryans new template strategy as without it? (-> would like to know more about how to use MVC within PW templating btw...) just curious...
    1 point
  28. Hello @MilenKo, I am glad you are making progress. Haven't read everything in this thread, but a here a few notes: In HTML5 there is an aside element available, especially for sidebars like yours. Using delayed output you could prepend for example a _init.php file in your site config containing often used variables. In the default site profile there is for example a variable for the homepage, so you can use this instead of $pages->get('/'). You could make your tags dynamic using a page field and store the tags in a dedicated page tree. Regards, Andreas
    1 point
  29. Have a look at wireRenderFile, it does the output buffering stuff for you. $out .= wireRenderFile('./inc/training-item.inc', array('p' => $p));
    1 point
  30. i can show a simple module to do this, the only thing delaying me right now is figuring out how to prevent the publish - I guess if you hook into saveReady, then you can check to see if the page status is published (since the request would have that set) and then if the image requirements are not met, you would set the status to unpublished, overriding the request; haven't tested this yet but will do so soon.. ok here is a try - note that once you install this module, you can keep adding stuff to it by adding your hooks to the init and then your functions below.
    1 point
  31. I'll let others, especially @apeisa, chime in with more thoughts but I can attest that: Yes I am not sure, but I think it can be done Yes For all of the above, you would need to write some code. Nothing out of the box. For #3, see example here.
    1 point
  32. And as likely to misuse. I don't want to say that it's not easier in some ways, but I fear that people – especially the target group, new to processwire, never heard of region api – misunderstand what it's meant for.
    1 point
  33. You can try to send @Pete a message. That worked for me. Regards, Andreas
    1 point
  34. Hey Andreas, that's how I solved it in the end. Thanks a lot!
    1 point
  35. There is a nginx.conf somewhere here in the forums. Just search for it on google.
    1 point
  36. The inputfield value is not saved correctly because config you are trying creates an error: PHP Notice: Object of class ProcessWire\Page could not be converted to int in ...\modules\Process\ProcessModule\ProcessModule.module:1287 So it seems that the inputfield you have created is returning a page object when what is expected is a page id. One solution is to create the options you want to make available in the inputfield: class ProcessHelloConfig extends ModuleConfig { public function __construct() { $items = $this->pages->find("parent=1"); $page_options = []; foreach($items as $item) { $page_options[$item->id] = $item->title; } $this->add(array( // Text field: greeting array( 'name' => 'greeting', // name of field 'type' => 'text', // type of field (any Inputfield module name) 'label' => $this->_('Hello Greeting'), // field label 'description' => $this->_('What would you like to say to people using this module?'), 'required' => true, 'value' => $this->_('A very happy hello world to you.'), // default value ), // Radio buttons: greetingType array( 'name' => 'greetingType', 'type' => 'radios', 'label' => $this->_('Greeting Type'), 'options' => array( // options array of value => label 'message' => $this->_('Message'), 'warning' => $this->_('Warning'), 'error' => $this->_('Error'), ), 'value' => 'warning', // default value 'optionColumns' => 1, // make options display on one line 'notes' => $this->_('Choose wisely'), // like description but appears under field ), // My custom test field array( 'name' => 'myTest', 'type' => 'select', 'label' => $this->_('Test'), 'options' => $page_options, ), )); } } BTW, if you want to allow the user to select any page from the tree you can use the Page List Select inputfield: // My custom test field array( 'name' => 'myTest', 'type' => 'PageListSelect', 'label' => $this->_('Test') )
    1 point
  37. I'lll give it a go next time I need to start a new site. In fact, that might be soon as I want to test this https://processwire.com/blog/posts/processwire-3.0.49-introduces-a-new-template-file-strategy/
    1 point
  38. Can you share the code of the template where the pagination is? I always find an extra pair of eyes is helpful as it's easy to miss something when you're staring at it over and over.
    1 point
  39. Thanks for the help. I tried other CMSs and notice the same quality as ProcessWire. I also found out I can display the full image and resize the width by CSS.
    1 point
  40. Just trying this here: d($page->repeatertest->find("language=".$user->language)->each("author_name")); In this case I am using the system "language" field, rather than a page field and I am reporting the author_name which is another field within the repeater. It actually seems ok here
    1 point
  41. The actual repeater item. I also installed Language Support and set up a test Page field with template=language and that works too. $results = $page->test_repeater->find("test_page.name=german"); echo $results->each("<p>{name}</p>"); // echoes the repeater item name, e.g. 1484443861-212-1 Edit: fixed the above
    1 point
  42. Hello all ! Just because I'm proud to be featured by Snipcart (js ecommerce solution) about my integration on my Processwire based website ! This post talks about Processwire and how I've done it : https://snipcart.com/blog/case-study-ateliers-fromagers-processwire If you wanna take a look at my website : https://www.ateliersfromagers.com/ (french & english) Have a good day everyone ! S
    1 point
  43. @flod and @Gideon So - I just committed a new version which automatically adds the Repeaters parent to the list of branch exclusions. I would appreciate it if you could please check if this takes care of image uploads in repeaters without having to manually add it in the config settings. Thanks!
    1 point
  44. When making a new booking, you have the 'room' dropdown (well perhaps it should be "Rooms" since one customer may be able to book more than one room) as I described, however you obviously don't want to a room to be double-booked, meaning that dopdown should only show available/unbooked rooms. You can determine that by writing a custom query for that ASM-select field (using PW's Custom PHP Code feature). I think the selector would be something like (well you'd need to finish it off and also make it handle whether the current booking has a room selected): // this will find all the unbooked rooms of the selected boat $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->name == 'rooms') { $booking = $this->pages->get($this->input->id); $cruise = $booking->cruise; $boat = $cruise->boat; $allRooms = $boat->children; $availableRooms = new PageArray(); foreach($allRooms as $room) { if( ! $this->pages->count("write query here to determine if the room has been booked") ) { $availableRooms->add($room); } } $event->return = $availableRooms; } }); Hope this helps.
    1 point
  45. This is freaking awesome - I love it! I've always disliked working with HTML markup inside PHP variables - the sacrificed readability of the HTML that comes with multiple variable concatenations, the single quotes/double quotes/escaped quotes hassle. I try to avoid it as much as possible using output buffering but this new feature suits me down to the ground and will definitely be my preferred way of managing markup in templates going forward. Simple and brilliant, like the rest of PW. Thanks!
    1 point
  46. Could you use the "Alternative Template Filename" option to assign the home.php file to all templates?
    1 point
  47. to make file uploads work i had to make those adjustments on my laragon + win10: // php.ini (right click on laragon tray > php > php.ini date.timezone = Europe/Vienna // uncomment and set always_populate_raw_post_data = -1 // uncomment don't forget to reload laragon awesome tool so far, thanks for sharing @LostKobrakai and @pwired
    1 point
  48. For Windows users there is the Laragon version: https://laragon.org/download.html
    1 point
×
×
  • Create New...