• Content count

  • Joined

  • Last visited

  • Days Won


microcipcip last won the day on March 12

microcipcip had the most liked content!

Community Reputation

70 Excellent

About microcipcip

  • Rank
    Full Member
  1. I am glad that this project is helping ProcessWire getting more devs on board :). I just want to say that I wouldn't have been able to finish ProcessVue if it wasn't for the amazing ProcessWire community. I believe that the community truly is the biggest selling point for new users (like me). Before trying ProcessWire I used OctoberCMS for a while but when I was stuck I got 0 support from the forums, so...althought the CMS is based on the amazing Laravel framework, I just left! I think that ProcessWire is extremely powerful and flexible and with time will become the tool of choice for frontend developers, the new GraphQL module will also help on this direction. Droves of frontend developers are looking for a CMS like this, they just don't know it exists! The usual keywords they use when looking for a SPAs CMS is "Decoupled CMS" or "Headless CMS", and I believe that that's exactly what ProcessWire is for! Some frontend developers prefer to use NodeJS but I think that Node is just too young and is not stable enough, the learning curve is huge if you need it for a non trivial project, and the worst thing of all is that after two weeks ANY js tool you may have used is outdated. See for example how Angular has been replaced with React or Vue, and Gulp with Webpack. That doesn't mean that I am against improvements in this regard, I just feel that it's just too much for us poor frontend devs to cope with! ProcessWire is stable, easy to use and won't change API every week. BTW, after that I migrate ProcessVue to GraphQL I am also planning to add Auth0 login integration with JWT, as I think that login/signup is a common feature in SPAs. I am sure I'll have to annoy @Nurguly Ashyrov and the rest of ProcessWire community for getting it in sync with ProcessWire users, but the result should be quite useful
  2. Now it works!! This is so cool...I wish I could like this thread twice :). Do you have any plan of adding the RepeaterField? I don't know if it has been mentioned in this thread yet, but I found this cool GraphQL tutorial that may be useful for someone new to GraphQL. When I learn GraphQL properly I'll test this module more, as I think it has huge potential for introducing FrontEnd devs to ProcessWire.
  3. I am trying to use this module in the frontend. I added the following code: <button class="graphBtn">Fetch data!</button> <script src="<?php echo $config->urls->templates?>js/axios.js"></script> <script> var $button = document.querySelector('.graphBtn'); $button.addEventListener('click', function (e) { e.preventDefault(); axios.post('/graphql/', { query: ` { basic_page{ list{ title, summary, url } } } ` }) .then(response => { console.log(response.data); }); }); </script> And this is what I get back: { "errors": [ { "message": "Must provide an operation." } ] } Do you know why? If I try the query in the GraphiQl admin I get the right data back. Do I have the wrong permissions set in the module?
  4. 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 works
  5. Ooops stupid mistakes, now it works :). Btw, do you usually build twig forms in this way or do you use ProcessWire form API?
  6. @Wanze I am trying to build a simple contact form with Twig but I am unable to do an ajax request to the php template file. My template name is test.php and I have the following code: <form class="form" action="./" gy="g"> <label for="first_name">Name</label> <input name="first_name" id="first_name" type="text" required=""> <label for="email">Email</label> <input name="email" id="email" type="email" required=""> <label for="msg">Msg</label> <textarea name="msg" id="msg" cols="30" rows="10" required=""></textarea> <input type="hidden" value="{{ page.title }}"> <button>Send</button> </form> // ajax submit $form.submit(function (e) { var request = $.ajax({ url: $form.attr('action'), method: 'POST', data: $form.serialize(), dataType: "html" }); request.done(function( data ) { console.log(data); }); request.fail(function( jqXHR, textStatus ) { alert( "Request failed: " + textStatus ); }); // avoid to execute the actual submit of the form. e.preventDefault(); }); In test.php I tried: if (wire('input')->post) { echo "Submitted"; // with this I get echo back in the AJAX response, but if I refresh the page I get a blank page with the text "Submitted" in it. exit(); } if (wire('input')->post->submit) { echo "Submitted"; // this never get fired exit(); } // here twig code... $test = wire('page')->siblings("template=test"); $view->set('test', $test);
  7. @Ivan Gretsky Is there a way to customize the export or should I just edit the zip file and remove /node_modules/ and add all the config files that start with a dot that have been removed?
  8. @Ivan Gretsky ooops....I am a beginner PW user I didn't even know it was possible to do that! I'll check it out when I have the time, thanks
  9. 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.
  10. I haven't built a multilang website with PW and Vue, but I guess you'd use something like this https://kazupon.github.io/vue-i18n/dynamic.html and with PW you'd generate the right Rest API to handle the multilanguage features?
  11. I agree with @LostKobrakai that it really depends on what kind of app you're building. I have built two websites with SPA+Rest APi and one hybrid with CMS+VueJS and the SPA website was easier to build but more difficult to get indexed on google whereas the hybrid one was more difficult to build (much more difficult) but easier to index. Same as @LostKobrakai. Same as @LostKobrakai Yes that's the easier way to do it.
  12. @Wanze Ok I understand! Last question (hopefully), if I have a home.php and home.twig file, and in the home.php I try to echo something, for example `echo $page->title`, in the frontend I don't see anything, I have to add `exit();`. Is this the correct way of debugging with php?
  13. @gmclelland I already have dump enabled, the problem is that I get a blank page when I output something, it seems that it is trying to return an object that is too big. With PHP I have a easier time debugging the code, but don't know how to debug even from there, when twig is enabled.
  14. I am having difficulty debugging variables within twig. Do I need to do it in PHP side instead? Everytime I try to dump something that isn't a very simple string or small array, I get a blank page. Is there any tip for debugging variables correctly? Here's a simple example (in a multilang website) where I get a blank page: {% for lang in languages %} {{ dump(lang) }} {% endfor %}
  15. @Basilico Agency I have exactly the same code and I am able to extend twig. For example with this code you can enable debugging wire()->addHookAfter("TemplateEngineTwig::initTwig", function($event) { $twig = $event->arguments('twig'); $twig->addGlobal('hsaApp', wire('config')->hsaApp); $twig->addGlobal('hsaDist', wire('config')->hsaDist); $twig->addExtension(new \Twig_Extension_Debug()); });