Leaderboard
Popular Content
Showing content with the highest reputation on 03/18/2017 in all areas
-
I am happy that you like it @Sebastian, thank you for your support. I started the thread here because I thought this would be more like a discussion on how GraphQL and ProcessWire could fit together and wanted to get some feedback first. But this thread quickly become this module's official place here in the ProcessWire forums. Also @teppo included the link to this thread as the "dedicated support forum thread" in the 143 issue of the weekly.pw (which I was flattered to see ). Now I don't really know how to go on with this thread. Should we abandon it and start new thread in the modules section? Or maybe this thread could be moved to modules section? What @moderators think of this? Meanwhile, for those who are following this thread I wanted to mention that there are some additions in the dev branch, such as mutations that allows you to create/update pages and there is also support for FieldtypeMapMarker field. I stopped developing the module for some time because I thought that it needed a good testing before moving further with it and decided to built an SPA using this module, to see if there is something that need to be added or changed. But then I got carried away and started to make usage of third-party APIs such as Wikipedia and GoogleMaps. As a result the app does not make heavy usage of the ProcessGraphQL module, but it is still relevant to showcase the module's abilities. It is a US Skyscrapers app, duh... You can see it live here and the source code here (though I doubt that the code will interest you if you are not a React developer). I was finished with this demo SPA just couple of days ago. Now I will be back to continue to work on this module again.6 points
-
Database errors are always logged. You will find entry in your /site/assets/logs/errors.txt file 2017-03-18 16:05:27 ? http://example.org/?/ Error: Exception: SQLSTATE[HY000] [1049] Unknown database 'example' (in .../wire/core/ProcessWire.php line 375) Depending on your config.php settings an Email will be sent /** * Admin email address * * Optional email address to send fatal error notifications to. * * #input email * @var string * */ $config->adminEmail = ''; In case of fatal errors the following html file will be send <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html> <head> <title>500 Internal Server Error</title> </head> <body> <h1>Internal Server Error</h1> <p>The server encountered an internal error or misconfiguration and was unable to complete your request.</p> <p>{message}</p> </body> </html> You can modify it. You'll find the file (default installation) in /site/templates/errors/500.html5 points
-
Hi, I have created a site profile that shows how to integrate ProcessWire 3.0 with Vue 2.0. See repository here. How this site profile works This ProcessWire site profile is loosely based on the REST API tutorial by @gebeer. Here are the most important steps to reproduce it: Admin settings Create an api template with default settings and just the title field assigned to it. Refer to @gebeer tutorial for further details Create a pages and nav templates with just the title field, for both template tick “Allow URL Segments” in the “URLs” tab (see attachment) Create a home template, this is going to be the single php file that will load your Vue SPA. Assign this template to the root of your website Any other template you create should have the “Alternate Template Filename” field in the “Files” tab set as home (see attachment), in this way if a user enter the website from any url that is not the root, ProcessWire will always redirect to the home template, Vue router will handle the url and call the right data through the REST API Under the root, create an api page and assign the api template to it (you can set “hidden” to this page so doesn't show up in the menu) Under the api page, create the pages nav and pages (see attachment), and assign the templates nav and pages to them. Now you have the www.sitename.com/api/pages and www.sitename.com/api/nav urls that you can use to fetch the JSON data PHP template setup In the templates folder, create home.php file and leave it empty, the HTML will be generated by webpack Now create pages.php and nav.php files. On these files is where we return the JSON data, based on the right url segment. Again, refer to @gebeer tutorial for further details on this matter. Note that I wrote a PageFields class that I use on these templates to fetch ProcessWire fields. The fields that are supported are text, textarea, repeater, img. Other fields may work but I haven't tested them. See the REST API setup for further details about how to use the PageFields class REST API setup You can decide what fields are included and what fields are excluded by passing a configuration array to the PageFields class. You can find here a list of the available configuration settings. See examples below. Show only selected core fields: $pageFields = new PageFields($p, [ 'fld_core_included' => ['url', 'httpUrl', 'template'] ]); Show no global fields, and only selected custom fields: $pageFields = new PageFields($p, [ 'fld_core_included' => [], 'fld_include_all' => false, 'fld_included' => ['title', 'gallery'], ]); On a gallery image field, hide breakpoint listing and show only httpUrl field: $pageFields = new PageFields($p, [ 'img_fld_overrides' => [ 'gallery' => [ 'fields' => ['httpUrl'], 'bp_list' => false ] ], ]); Webpack setup The most important file of all Webpack setup is config/index.js. On line 33 you need to provide your domain name so that Webpack can proxy the ProcessWire REST API to the Webpack dev server. Without this you wouldn't be able to take advandage of the Webpack hot module replacement feature which allows you to reload a vue module without refreshing the page, it also allows you to keep the state of the app. Notes My REST API may have bugs, this is just an example of an integration with ProcessWire, I suggest you either build your own REST API or use the awesome GraphQL module by @Nurguly Ashyrov. Todo Replace REST API with the GraphQL module. This requires vue-apollo, the Apollo/GraphQL integration with Vue, and vue-supply for integration with Vuex.2 points
-
This week we have a new core version on the development branch and some nice updates to our Uikit admin theme in development. This post covers them in detail, includes a screencast and links to a live demo of the updates. https://processwire.com/blog/posts/processwire-3.0.56-and-uikit-admin-theme-updates/2 points
-
I have edited the github repository, now ProcessVue is a site profile and you can install it easily. Just note that the REST API may have bugs...I don't even remember how it works2 points
-
Personally I think that this thread already includes so much great content that it'd be a shame to abandon it -- not to mention that it's more than likely that folks looking for details about this module would end up here anyway. It's your choice obviously, but if you want, I (or any other moderator here) would be more than happy to move this thread to the modules section. Just let us know when you have decided what to do with it2 points
-
With any website, there is the possibility of db issues - overloaded server, network connectivity if the db is on another machine in the hosting network, etc. I would love to see a feature where if there is any reason the db fails or cannot be accessed, then pw displays a dedicated page that is stored in the filesystem - instead of displaying nothing, or an ugly mysql error. Obviously it would be good to log the error, and possibly send a notification to the admin (email?). This gives us the opportunity to still present a professional front (albeit with no functionality) while problems are resolved behind the scenes. I cannot think of a company I have worked for that hasn't had db errors at times What are your thoughts?1 point
-
Ok. Tried with the whole file and for the testing purposes inside the Home I created a child page WordPress inside of which I created another child calling it Import. Pointed the module to the Import page as parent and thought that this way the Home would not change but would the Wordpress. Well I was wrong - the Home title changed again to the same so for some reason the import grabs a page (probably the first) and imports it to Home. On top of that, if I try to import the whole file, then some of the pages were not imported (those that were originaly as Wordpress pages). Categories list is empty too. After the import in both cases I noticed another error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'post' in 'field list' along with the message of successful import. So for now importing the XML in chunks works much better and properly includes categories as well as users etc. Even if I will have to recreate the page that is imported in the Home, I am still totally OK but just reporting to make sure others won't be able to move on.1 point
-
Hello @adrian I tested the importer and got an error. Here are the steps I took and the error to just check if I did everything right or missed something: 1. I cut the whole WordPress file (14-15Mb size) in 6 pieces of 2Mb to make it much smaller and reduce the load etc. as per your instructions. To reduce the size of the file I used a simple app called wxrsplitter that I know worked for WP before. 2. Installed fresh PW 3.0.55 with blank profile and only added ProcessMigrator & MigratorWordpress (I downloaded latest update for ProcessMigrator from the git source but MigratorWordpress was kept the same as I did not se any updated files). 3. Created a page Wordpress and assigned it as parent at the Import page. 4. Selected to import user details. 5. Selected to Import created/modified dates. 6. Choose to automatically download and install missing filetypes. 7. As data source used WordPress Migrator and pointed to the first chunk. The error I got after the import is: Error: Call to a member function eq() on a non-object (line 1704 of C:\OpenServer\domains\recipemagician.pw\site\assets\cache\FileCompiler\site\modules\ProcessMigrator\ProcessMigrator.module) This error message was shown because: you are logged in as a Superuser. Error has been logged. If I refresh the page, then it continued and finished with the informing message of how many pages were imported successfully. The same thing is applied for the rest of the files or if I use the file at once (which by obvious reasons takes more time to import but does not fail other than the error). So I pushed the whole file for the test and was able to import 559 posts as child pages of Wordpress. I checked a few pages with comments and they were all posted in the proper amount and approved with an ability to change the status if needed! It is clear now that all posts were imported. I am unable yet to say would all comments be properly imported but I don't see a reason if one works fine why the rest would not. So will consider that also done perfectly. In regards to the Home page title, it changed again (before it was Home and now is imported a the first page alphabetically added. Because of that it looses its fields and comments (this happened when I imported the XML chunks). Will try now to import the whole file but I doubt that this would happen again. For sure I can preserve the content of the page imported to the Home by creating and adding all the necessary fields to it and reimporting, but just reporting that something is still to be fixed. If a need be, I can provide you with the slices of XML.1 point
-
Hi - I'm totally not following your post. However, based on your 2nd sentence, this would be my answer: Create template called plant add 3 fields Title (default) Type: textarea; Title: Description (optionally use CK editor) Type: page reference; Title: Page Select (page_select); configure this to select the link to another page Create template called plant-index one field, title; configure the family settings to allow children of template plant configure the allow new pages to 1 Create a new page using this template Go back to plant template and family settings, no children and plant-index for allowed parent Go to the page tree and hover over the Plant Index, then 'new' - this will give you a new plant Add your title, description and select the page you want to link to, save Repeat steps 4-5, 199 more times.1 point
-
Thank you very much again. I have checked and unchecked these options but it doesn't work for me. But the Page Reference works perfectly: <a href="<?php echo $page->link->url; ?>"><?php echo $page->link->title; ?></a>1 point
-
Thank you There is so much available in PW that sometimes one forgets it's there.1 point
-
I agree with you on that. I think it would be best if we move this thread to modules section. So, please move it to the modules section. Then after I will update my first post of this thread a bit and add a module tag I guess1 point
-
This is easily done with a page reference field. Here is a very old video demonstrating it https://processwire.com/videos/page-fieldtype/. The field became much more complete meanwhile, but the basics are there.1 point
-
So the fields are named Tab1...Tab9 resp. TabContent1...TabContent9? In that case, two possibilities immediately come to mind, but both require you to assemble the name outside of the quotes (there might be a way inside the strings, but I can't think of one right now). <?php //... $tabname = "Tab" . $i; echo "<label for='tab{$i}' class='labeltab'>{$page->$tabname}</label>\n"; Or, in one go: <?php //... echo "<label for='tab{$i}' class='labeltab'>" . $page->get("Tab" . $i) . "</label>\n";1 point
-
Perhaps you have checked one of these two options in the settings for this module: Prepend site's root path to local/relative URLs? Allow relative/local URLs without "http://" at the beginning? Either of those will break the lookup of the page for getting the title. But again, Page Reference is much better for local links - one of the key reasons is that is stores the page ID which never changes, rather than the URL which may possibly break down the road.1 point
-
For anyone who tries out the new sidebar features in the UiKit admin theme, I just wanted to mention that I already have a partial fix (not committed yet) for the problem of the debug bar appearing in each sidebar, along with the main content area. Each sidebar (and main content area) is an iframe, which is why the debug bar gets loaded in each one. The fix I have works for the initial page load, but falls down when you try to edit a page. I have suggested a change to the core/uikit theme to Ryan (in a PM) that will allow me to fix this as well, but I need him to implement first. I'll update Tracy as soon as there is a fully working solution. Cheers, Adrian1 point
-
it would probably need to be part of a site profile so that it could make sense, it also integrates with 3 other modules, ProcessGeneralSettings, SimpleSiteEngine and SimpleSiteMeta, which together complete the whole frontend api that i'm trying to develop...1 point
-
Oh wow @Nurguly Ashyrov this is an amazing effort. SO much potential usecases. Thanks for all your work. Maybe and depending how you feel about it you could mention this modue in the modules section, I only accidently kind of stumbled upon it here in Offtopic > Pub. This deserves much wider recognition.1 point
-
sure, so the (currently named) SimpleThemeEngine is basically a front end api, which is now in module form, but was previously a loose collection of functions that were used procedurally. I would probably recommend to use Spex since it released and proven to work; My module is probably too specific for general release at the moment... It uses WireData class for storage and provides methods for: Adding, manipulating assets (css/js) outputting assets (css/js) Getting and setting theme variables/settings (used for layouts, like show/hide page header, etc) injecting inline js code in head/foot simple web fonts management, loading etc injecting markup into parts of the page (sort of layout hooks) problem with releasing module is that it depends currently on ProCache being installed (future version would have setting to select the caching/min engine, e.g. AIOM or PC)... below is an example of the code that would be used in the head.... // $ste = $modules->get('SimpleThemeEngine'); echo $ste->headAssets(); echo $ste->getJsConfig(); echo $ste->gFontLoader('Open+Sans:300,400italic,400,600,700|Montserrat:700'); echo $ste->getInjects('header');1 point
-
Simple string concatenation also may help: $selector = "parent={$myParentContainer}, template=atemplatesname"; $selector .= ", fieldnameOne=1"; if(--someConditionHere--) $selector .= ", fieldnameTwo!=selected"; ... $selector .= ", sort=afieldname, limit=10"; and this:1 point
-
It should be possible to do this by specifying a base: <base href="<?= $config->urls->templates ?>myAppDirectory" /> in the header of the page. That means that relative link behavior changes as any url that doesn't start with a slash will be searched inside myAppDirectory.1 point
-
Some people do this via HannaCodes or other, self created markup-modules added to the ckeditor boxes. Something like that: [[image=theimagename.jpg, crop=thecropname]] The above could be used by a custom markup module, if you have not installed HannaCode. Assumed you have only one image field on that templates/pages, you have to search for that image in the field and replace that marker with the img tag and src pointing to the crop. if you have more than one imagefield on a page, you need to add a third param: [[image=theimagename.jpg, crop=thecropname, fieldname=teaserimages]] If you are willing to get your hands dirty with code and build an own markup module, this is a nice way to learn much about PW and PHP. Otherwise you can install Hannacode and do it there. Hannacode is a flagship! Pretty usefull for a lot more use cases.1 point
-
Cool stuff, @microcipcip! Please do write a tutorial when you have time. I am sure it will be useful to many of us in the community. Surely it will be for me . It seems like your boilerplate is not in a site profile format. Is there a reason for that? If not, consider using it, as it is a common way to distribute site boilerplate code and could make your work easier to reuse for PW people.1 point
-
Page Image Manipulator allows you to watermark image variations, which is more flexible than watermarking the original on upload. If you are concerned about sneaky visitors gaining access to the unwatermarked originals see @horst's solution here:1 point