Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/12/2017 in all areas

  1. You can do this... $items = $pages->find('template=product-item, action=1, !outlet=[status=published]'); $group_items = $pages->find('template=product-item, action=1, outlet=[status=published]'); ...but I don't think unpublishing Group pages is a good strategy, because unpublished pages do not appear as an option in a Page Reference inputfield. So it means that in Page Edit you cannot distinguish between a product that has no Group selected, and a product that does have a Group selected but the Group has been unpublished. What I would probably do is create a new Page Reference field "group_status" with selectable pages "Active" and "Inactive", and set the "Active" page to be the default value. Add this to the Group template. Then in the Outlet field, include the group_status field in a custom format for "Label field" so you can see the status of each group in the Outlet inputfield. You can have both if you use the ConnectPageFields module.
    5 points
  2. I like to showcase my new website acniti on the forum here. History Building and managing a website is a hobby, over the years, making websites got more complicated and more technologies, knowledge and wisdom are required. I started building my first website around 1997. It started out with a static site built with FrontPage, a WYSIWYG HTML editor. A few years later it was time for the first content management system, I looked at Joomla but settled for MediaWiki. I run those websites for 2 years on the MediaWiki platform and then moved on to WordPress. WordPress was good, it did a good job but over time, it became more complicated to make something out of the box, if it's not a blog, it becomes complicated and to have a feature rich website requires a lot of plugins. Little by little it became less fun and more and more hassle juggling the various plugins. In 2014 I became interested in learning PHP programming, I wanted to do this already for many years, but never had enough time to bite the bullet and work my way through the basics. At the end of the courses I though and now what have I learned, how to put this into action? To built modern website with PHP only is difficult, it also requires knowledge of html, MySQL, CSS, java-script etc. I started looking for a framework experimented a little with CakePHP and then came across Processwire via a CMS Critic blog post. Development setup I developed the acniti website on a Linux Ubuntu 16, with PHP 7 and MySQL as the development server. For the IDE I use PhpStorm, before using Storm I have used and tried some other IDE's such as Zend, Eclipse, Netbeans, Aptana but none of them I liked, some were feature poor, Zend and Eclipse were slow and use a lot of memory. PhpStorm not free but definitely worth the investment. I make use of the free tier Git repository of AWS called CodeCommit, I still use GIT Cola to commit the changes, I could also use PhpStorm for this but I never took the time to change my workflow. For project management I am a big fan of Redmine, Redmine is a web-based open-source project management and issue tracking tool. I use this also for my other work so it easily integrates with the website building flow as well. It's easy for maintaining lists of features you want to carry out per version, it supports a wiki which is easy for making notes and keeping a log of the activities. I use it everyday and it runs on Ruby. For images and graphics I switch back to Windows for some Photoshop. Processwire The acniti website runs on the latest stable Processwire version at the time of writing 3.0.62, the website has 4 languages including an Asian language. The Japanese language URL's are implemented with their 3 alphabets kanji, hiragana, katakana i.e. https://www.acniti.com/ja/インレットフィルタ. Some images on the site have text and image language tags help to select the correct language, the Processwire blog post from 30 June was helpful to get this running. The main site has a bootstrap theme, for the mobile version of the site the google AMP specification is implemented. This was really fun to do but challenging at times as the AMP specification is still a little limited. To visit the AMP pages type /amp/ behind any URL like https://www.acniti.com/amp/ for the homepage. The Google webmaster portal is really easy to troubleshoot and check for the correct AMP implementation. Finally structured data according to schema.org is added to the site via the JSON-LD markup. The commercial modules ProCache and Formbuilder are installed. The ProCache module is really amazing and makes the website lightning fast. Besides the commercial modules around eleven open-source modules are used, Database Backups, Tracy Debugger, Wire Mail SMTP, Protected Mode, Batcher, Upgrades, PublishAsHidden, URL (Multi-language), Twitter Feed Markup, Email Obfuscation (EMO), Login History, Selector test. During development the Processwire forum is really helpful and checked often. The forum is good for two reasons, most of the questions, I had during development of the site, are already on the site. Secondly the only 6 questions I posted over the last 2 years, are quickly and accurately answered. The downside I didn't become a very active member on the forum but see that as a compliment. An open issue on the acniti site is the AMP contact form with Formbuilder, the restricted usage of java-script for the AMP specification requires some more in-depth study. Hosting setup For the hosting services the acniti site uses Amazon EC2, I use AWS already many years to manage my cloud office so it was easy to decide to use it for the web hosting as well. The site is running on a micro instance of EC2 and with the ProCache module CloudFront is serving webpages worldwide fast. Updates from the development server are sent to CodeCommit and from there to the production server. From a site management point of view it would be nice to use AWS RDS to manage the MySQL databases, but from a cost perspective I decide not to do that for now. Via a cron I have set up automatic MySQL backups and these are via another cron job uploaded to AWS S3. To make sure the server is safe, a cron job runs daily snapshots of the server, this is getting initiated via AWS Lambda. Lambda also removes older snapshots because during creation a delete tag is attached for sevens days after their creation. It's important to make a separate MySQL backup as with snapshots the database often gets corrupted and its easier to restore a database backup than to fix a corrupted database. Another nice feature to use AWS Lambda for is a simple HTTP service health checker, which reports to you by email or sms when the website is down. Making use of all these Amazon services cost me probably somewhere between 10 - 15 $ a month, I have to estimate a little since I am running a lot more things on AWS than only the website. The site is running on a Comodo SSL certificate but next year I will change to the free LetsEncrypt, as it is easier to add and will automatically renew after 90 days. The Comodo certificate requires manually copy pasting and editing the certificates in place. Writing Content The content for the site I write in the Redmine wiki, most of the content I write requires research and it takes about two weeks before I publish the content to the Processwire site. For writing content I use the google spell checker with the grammar checker, After the Deadline. To ensure catchy headlines they are optimized with the Headline Analyzer from CoSchedule Social Media Now the site is running, it needs promotion. The robots.txt files shows the search engines the way as does the sitemap.xml both of these I have made in a template file. Most of the blog articles I promote are republished on social networks like, LinkedIn, Tumblr, Google+, Twitter, and some branch specific networks as the Waternetwork and Environmental XPRT. To check, the search engines index the site well, Google webmaster and Bing webmaster check for any problems with the site. For statics on the same server there is an instance installed of Piwik. Piwik is a leading open alternative to Google Analytics that gives full control over data. The Piwik setup works very well and gives a good overview of the site usage both on the desktop via the site or via a mobile app. As a part of a test I have installed the open-source SEO-panel on the same server to manage keywords and to further improve the scores in the search engine, a nice feature is that you can also track your competitors. I am still new to SEO panel and have to learn more how to use the tool effectively.
    3 points
  3. Glad it worked for you Remember that $field->name is going to refer to things like "body", "headline", etc so it's actually calling: $item->body which returns the value of the body field. The use of $item->fields is like $page->fields which is mentioned in the docs and cheatsheet. Shameless plug, but I really find the Console panel in Tracy Debugger an incredibly useful tool - it lets you try code and dump objects and arrays in a nicely formatted way - it really helps the learning process.
    3 points
  4. This week we added the new pages export/import feature to the core! In this post, we tell you how to install it and cover all of the new things added over the last week. https://processwire.com/blog/posts/processwire-3.0.71-adds-new-core-module/
    2 points
  5. I am checking for this, and it appear that all the SDKs are compiled despite using /*NoCompile*/ on the require_once. Also I note that this feature was introduced in PW 3.0.43, so I assume the file will be compiled for PW 2.7. Concretely, what is the bad thing about leaving all those SDKs file being "FileCompiled" ? if($this->useFTP) { require_once(__DIR__ . '/Classes/FTPClient.php'); } if($this->useAmazonS3) { require_once (/*NoCompile*/ __DIR__ . '/SDKs/aws/aws-autoloader.php'); require_once(__DIR__ . '/Classes/ClientAmazonS3.php'); } if($this->useDropbox) { require_once (/*NoCompile*/ __DIR__ . '/SDKs/dropbox/autoload.php'); require_once(__DIR__ . '/Classes/ClientDropbox.php'); } if($this->useGoogleDrive) { //require_once __DIR__ . '/SDKs/google/autoload.php'; // oh my.. require_once (/*NoCompile*/ __DIR__ . '/Classes/GoogleAutoload.pain.php'); googleAutoload(); require_once(__DIR__ . '/Classes/ClientGoogleDrive.php'); } Anyway, for the people who have the module in hand, I bumped the module to the version 0.0.36. The Gitlab server is not running up but will give a download link in PM as I would appreciate a test on a Windows machine..
    2 points
  6. To get the correct locales for YOUR server (each server might use different ones) just use the below code. <pre><?php passthru("locale -a"); ?></pre> It will show you a list with all locales installed on your server.
    2 points
  7. I think perhaps I am not understanding what you are looking for, but does this suit your needs? foreach($page->my_repeater as $item) { foreach($item->fields as $field) { echo $item->{$field->name}; } }
    2 points
  8. Also consider InputfieldSelectizeMultiple, it can support any complex markup for the select items, and any field, subfield, sub-subfield etc..
    1 point
  9. Hi @homma, Yes. I do keep a copy here. It is for 3.0.42. I am not sure whether it works with the latest version. Gideon ProcessWireUploadDemo.zip
    1 point
  10. I haven't tested it much but it looks like you can hook Page::getMarkup() $wire->addHookAfter('Page::getMarkup', function(HookEvent $event) { $page = $event->object; if($page->template->name !== 'TEMPLATE(S)_USED_IN_YOUR_PAGE_FIELD') return; $out = $page->title; // add more stuff to $out using $page $event->return = $out; });
    1 point
  11. This type of usage is called "variable variable" http://php.net/manual/en/language.variables.variable.php
    1 point
  12. Adrian nailed it. Thanks for your help/input @abdus
    1 point
  13. Exactly what I was looking for. That worked @adrian You provided a great solution that works. I would have never thought of $item->{$field->name} as storing the value of the field. The way I was originally thinking, in pseudocode was something like: $all-repeater-fields = $page->my_repeater->getchildren(); foreach($all-repeater-fields as $a-field) { echo $a-field->name; echo $a-field->value; } Could you also guide me into a direction in the PW docs or method in which you came across this? It seems little things like this, I dig into the documentation and API reference, and just can't find good examples/explanations for these types of questions. I try using var_dump() and the docs to try to 'connect' the dots, but something with the way I'm researching just isn't 'clicking'. The idea of $item->{$field->name} holding the value for the field would have never crossed my mind. Thanks so much for the assistance --
    1 point
  14. Labels are generated inside InputfieldPage::getPageLabel method (\wire\modules\Inputfield\InputfieldPage\InputfieldPage.module), but unfortunately it's not hookable. You can prefix the method with 3 underscores ___ to enable hooking (it works that way) but when you update the core it will be overwritten with unhookable version. Feel free to make a feature request on Github. // /site/ready.php wire()->addHookAfter('InputfieldPage::getPageLabel', function (HookEvent $e) { $field = $e->object; if($field->name !== 'myPageField') return; $page = $e->arguments(0); $e->return = "$page->title @ {$page->parent->title}"; });
    1 point
  15. Right, gotcha. Actually, this module is not installable either despite the requires property being consistent with the module documentation. So I think it's an issue with ProcessModule and/or the Modules directory JSON generator and it should be reported to Ryan.
    1 point
  16. Something like this maybe? <?php // get all field names $fieldNames = $page->repeater_field->first->fields->explode('name'); // get all content from all fields $content = $page->repeater_field->explode($fieldNames); // array comes out multidimensional unfortunately // iterate recursively // https://stackoverflow.com/questions/1319903/how-to-flatten-a-multidimensional-array $iter = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($content)); // and print all content foreach($iter as $part) { echo $part; } This works in my setup.
    1 point
  17. Lots of info and links about how to handle this - there is more than one approach, so worth reading so you get a better understanding of what is going on:
    1 point
  18. @homma - here is some reading on this issue: https://github.com/processwire/processwire-requests/issues/56 (sorry, @Gideon So already linked to this)
    1 point
  19. Tip: By default the Dropbox App is in Development mode and allows only one user - you. When you apply for a token you may get a Dropbox notification saying you need more users. Simply go back into your Dropbox App configuration and click on the button to the right of this setting. You'll automatically be granted 500 development users. Should you need more than 500 users, you'll need to apply to Dropbox for Production status for your App and totally outside the scope of this ProcessWire Dropbox API module.
    1 point
  20. @Sipho - You can choose different templates for Repeater Matrix fields - that link I provided shows examples and states: But, as with repeaters, they are not pages with URLs that can be directly visited - you could probably "fake" this by using URL segments on the parent page and use the passed values to determine which repeater item to show. OT - I completely agree that the PageTable interface is not ideal - seems to me we need the repeater matrix editing interface for PageTable fields as well. When the PageTable field was added, repeaters didn't support ajax loading, hence the modal editing interface to ensure it was scalable with lots of items.
    1 point
  21. Not free, but check out Repeater Matrix: https://processwire.com/api/modules/profields/repeater-matrix/
    1 point
  22. If you want to stay compatible with the 2.x branch I'd simply develop on a 2.8 or even 2.7 installation.
    1 point
  23. Hi folks, how can I do a simple contact form with PW? I need Name, Adress, Mail and a checkbox I find a lot of stuff here in the forum but nothin what I cant understand, because nothing wehre show from scratch. So here are the main questions: Where put I the HTML form code? Inside a new template? Or inside the content field? And how can I do the form validation? Ist there a modul ready to go for PW? (not the formBuilder because ist costs money) If not, where put I the PHP code for validation? I just camo from MODx, and I wonder how dificult it is to build a simple form in PW. It might be something to do that I am new to PW, but for now I do not understand how it works to build a form inside PW with validation and so on. What I need is a simple step to step tutorial for beginners. Is there anything like that?
    1 point
  24. FormBuilder is also a good way to go for contact forms, especially if you want to set one up without doing any development and have a lot of pre-bundled options as to where the submitted data goes.
    1 point
  25. Hi, Here are a few links to get you started. Has example of a form built already http://processwire.com/talk/topic/59-module-want-form-builder/page-4#entry11639 A tutorial on building forms using PW fields. You should read through this and compare it to Ryan's post below. It will explain a lot. http://processwire.com/talk/topic/2089-create-simple-forms-using-api/ Ryan's simple contact form. I just used this the other day. All you really have to do is copy and paste his code. You would exclude the include("./main.php"); unless you have one of course and echo out the form as shown below. http://processwire.com/talk/topic/407-processing-contact-forms/?hl=%2Bcreate+%2Bsimple+%2Bcontact+%2Bform#entry3208 include("./head.inc"); echo $page->body; include("./foot.inc");
    1 point
  26. There is a simple module that does this already http://modules.processwire.com/modules/form-template-processor/, the good thing is that it's a also a well commented starting point for something more complex. You might want to also have a look at this module http://modules.processwire.com/modules/form-template-processor-mailer/ that was already built from the previous one.
    1 point
×
×
  • Create New...