Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/14/2017 in all areas

  1. This week we have ProcessWire 3.0.60, which is likely to be our next master version. We’ve also got a few more Pro module updates, as well as a major update to our online API reference… https://processwire.com/blog/posts/processwire-3.0.60-core-updates-and-more/
    5 points
  2. Hey! This is a very early/experimental/alpha not for production environments release of a new module I'm working on. Just testing the possibilities and the interest that might be for such a thing. The idea is to be able to quickly create fields while working inside the template files without having to go to the admin. For example, in an early stage of development when creating a layout, insteading of putting a placeholder headline and then going to the admin to create the headline field where the real content will be, you can create the field directly from the template file by doing: <h2><?=$page->field("A nice headline", "headline", "text")?></h2> This will create a new "headline" text field when it doesn't exist in the system and add it to the the template of the page you're working on and add "A nice headline" value to it. On a second run the module will recognize that the field already exists on that template and will simply return it's value. The method accepts three string parameters in the order ( value, field name, field type ). Value and name are required but field type will assume "text" when omitted. $page->field("A nice headline", "headline"); // creates a text field $page->field("A nice paragraph", "body", "textarea"); // creates a textarea field The method also accepts a boolean parameter in any position: TRUE forces the value to be saved into the field on that page, FALSE (or omitted) sets that value to the field when it adds it to the template, but leaves it how it is when the field already exists in the page. This is the only situation when this module can be destructive, and it's only concerning the value of the field on that page: $page->field("Another nice headline", "headline", TRUE); // will create or add a text field and add the value to the page even if the field already exists there The method also accepts an array as parameter. This array will be used as options for the creation of the field. The options array will override the string parameters when they clash. $page->field("A nice headline", "headline", array( 'name' => 'subtitle', 'label' => 'Subtitle' )); // will ignore the name "headline" and use "subtitle" instead As soon as the fields are created and added to the template, all the method will do is return the value, just like if using $page->headline, unless you use the TRUE parameter which will override the value of the field by the value in the first parameter. -- With this module you can, for instance, convert an existing HTML template quickly, just by pasting the html into a template with no fields created yet, and going through all the code, replacing the content by calls to my field() method. In the end you should have a working page with all the fields created in the template. Now you just need to go to the fields and adjust their preferences. So, just download it > install it > test it > tell me what you think! dynamicPageFields.module.zip -- Edit: Multilanguage fields threw an error but they don't now. You can create a multi lang text by doing: $page->field("A nice headline", "headline", "textlanguage"); that third parameter is just a case insensitive simplification of input field names to make it easier to write. You can still use the original input field name like "FieldtypeTextLanguage" if you prefer.
    2 points
  3. @ryan - another thought - could the API reference docs on the website link to the appropriate lines in the code on Github? Obviously the link would have to be to the exact commit that was used to generate the docs, but I don't expect that should be hard to implement. Also, even though I don't have the API Explorer module, I would still like to suggest implementing an editor protocol handler link so that users could click to open to the appropriate link in the code in their favorite code editor. I do this with the Captain Hook panel in Tracy and find it fantastic.
    2 points
  4. Diogo, I really like this module, looking forward to using this! Thanks
    1 point
  5. @GuruMeditation - turns out there was more to those space issues. I have alerted Ryan here:
    1 point
  6. Hi @ryanC I have an images folder which I keep stuff like logo, things that aren't inserted via the admin (as a image file upload or whatever). What I use to get these images is: <img src='<?php echo $config->urls->templates . "/site-assets/images/logo.png"; ?> I don't know what you mean when you mention CKEditor stripping tags, or "Processwire field just gives me a broken link icon". The above is for images not uploaded via the system i.e. I haven't used a image upload field and the code in the template simply displays them. If you have a field which is an image upload field, and you add that to a template (say basic-page.php), then you create a page using that basic-page.php template. If you then upload an image via that field and click save, the images will reside in a path like: yoursite.com/site/assets/files/27 ...where the number at the end is the ID of the page where the image has been associated with (or uploaded to). You don't manually create these folders, the system does it for you. Hope that helps a little.
    1 point
  7. Sounds like you have a good handle on how the process will work, so no reason to worry I think. I've just done something very similar so I can attest that it's quite simple to do in PW. Regarding 1 & 2: most likely you will be querying an API endpoint that will return a JSON string to you. You'll probably find the WireHTTP class useful here - that's what I used. The getJSON() method will convert the JSON response into an associative array that contains all the data you requested. Tracy Debugger will be useful for exploring this array. Then you will use some part of the data as a unique identifier (you could use the title string but there's probably some kind of reference code that will be a better candidate) and based on whether you can find an existing page with that identifier you will either create a new page or update an existing page. Then it's simply a matter of matching items in the array to fields on your page and saving the page at the end. You can use a lazy cron function to automatically query the API endpoint every 24 hours. To delete pages that are no longer contained in the JSON response you can collect all of the unique identifiers in the response and then use a PW selector to get pages not matching any of those identifiers. Those pages you delete.
    1 point
  8. HI @nabo It looks like you can use subfield selectors: https://processwire.com/api/selectors/#subfield $pages->find("template=store, repeater_fied.hours=10");
    1 point
  9. Adding to this: ...so long as you are starting with the "blank" profile. If you have installed a profile that is based on Uikit such as the new blog profile then the frontend will use Uikit.
    1 point
  10. Uikit is only used in the admin, on the front end you can use anything you want. Think of PW as a data source, all the rest - markup, styles, scripts - is up to you.
    1 point
  11. I've just used the JSON with settings feature to install 3rd party and some core modules, worked well. It's nice to see how much time this module can save, thanks! First I thought core and 3rd party modules are mixed but 3rd party ones were at the end of the checkboxes list, apart from one or two. If they could be separated better it would be great, eg. in two columns or making 3rd party ones bold or something. Another thing I noticed is that when the batch install reached a module not listed in the Modules Directory (nor available on GitHub) the batch was aborted and the rest of the modules weren't installed. This was a custom module. If it was possible to skip these and continue with others that would be great.
    1 point
  12. Hee PeeJay, I will see if I have time soon and if I can reproduce and fix it. Thanks for the report.
    1 point
  13. Got it. It's working great!
    1 point
  14. v0.1.0: this time hopefully...
    1 point
  15. If you do need to do it in init() which is before wire('page') is available, then you can do this: if(strpos($_SERVER['REQUEST_URI'], $this->wire('config')->urls->admin) === 0) {
    1 point
  16. PW does not pull any CSS or Js to your frontend unless you tell him so.
    1 point
  17. https://processwire.com/api/multi-language-support/multi-language-urls/#api
    1 point
  18. There are various pages in the admin, which do not have the "admin" template. These are generally not accessable as backend page per se, but really checking for the rootParent is the most future prove way of handling that even if updates to processwire would change something with the templates. The backend parent page will more likely stay with it's id of 2.
    1 point
  19. No problem @SamC. Instead of "today" you can also use strings like: "next monday" or "next year" or "+1 week 2 days 4 hours 2 seconds". See strtotime function.
    1 point
  20. There may be other solutions/modules but Ryan's RSS Loader Module would probably be a good starting point. It will obviously depend on the format of your source feed.
    1 point
  21. Hi everyone, Some critical updates this morning: 1) The module stopped doing anything in recent versions of PW 3 - I don't exactly when, but this is now fixed. 2) I also added support for restricting the new Pages > Tree dropdown menu that was added in 3.0.55 Please let me know if you find any problems with these changes or if you find any other situations where the module is no longer working. Given the rapid development of new ways to access the page tree that are being added to PW, I strongly recommend thoroughly testing your site if this module is protecting critical info from certain users. Hopefully everything is already taken care of for the current PW dev version, but with the UiKit admin theme, there could be possible breaks. Thanks for testing and letting me know!
    1 point
  22. The PW Backend is basically a highly-specialized frontend to your data, so if you set your permissions correctly you can let whoever you want have access to it.
    1 point
  23. Just a heads up that I have committed a new version with lots of bug fixes (although I expect there are still some more to come). Also, there was a spelling mistake in the class name of the old version (as noted by @tpr above), so you should uninstall the old version and install this new version from scratch. Would like to get an idea of how many people are using this - I'd like to get it working well, but it's already been a substantial effort and want to make sure this is in demand over the Module Settings Import / Export that I released yesterday. Obviously this is way more powerful, but maybe it's more than most people want. Thanks for any feedback. Cheers, Adrian
    1 point
  24. You probably did not replace the whole wire folder, but only replace existing files, because JqueryFancybox is no longer part of ProcessWire.
    1 point
×
×
  • Create New...