Jump to content

blynx

Members
  • Posts

    174
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by blynx

  1. The title says it all, I wonder: Is it possible to permit non-process-modules configurations for non superusers? I tried to set up permissions on a module (MarkupSEO) like I would on a process module - but it didn't work ...
  2. Yup, but not the "button" - That is in the HTML email-body - I refer to the plain-text-body of that Email. Full example: (there is & where it should be &) Thanks for the links (mmmh I guess that tabs vs spaces thing is rather an issue of personal preference ;P) Let's try this … Hi, @Pete I just saw that you are among the responsible people for the forum, here is a tiny bug - it would be nice if this could be fixed, though it surely affects only very few people (... me? ;P)
  3. Oh! Thanks for the tip - will try to take care of that today if I find the time - otherwise next week, will be away from the computer for the weekend. I will let you know when it is fixed -
  4. Ah sorry, I know - I expressed myself not accurately - I also think legalTemplates and Fields are basically not necessary - but i think it is just a very convenient way to reduce the available data The confusion might be about this: Normally in processwire templates you have to "make the fields public" by manually echoing data in a template (echo $page->title) - so actually for a guest user everything is hidden by default - though by permission actually authorized. With this module - everything gets "unveiled" (to use another term here) automatically. This is what I meant by "public" and "private". ... am I right?
  5. Hi, just a little note: In the text body of the notification Email the & gets & encoded. Would be nice if this could be fixed : ) I get: !!!!! https://processwire.com/talk/topic/15397-graphql-for-processwire/?do=findComment&comment=138055 Should be: https://processwire.com/talk/topic/15397-graphql-for-processwire/?do=findComment&comment=138055
  6. Thats true - yet, when I was reading this thread and thinking about that restriction and security stuff and about the differences of graphQL and REST - I thought that it might actually be handy to simply combine the two. Using REST for simple API calls - simple forms, logins... and so on - and using graphQL for sophisticated stuff for your interactive JS app. You might want to do this to differ between the general public and logged in users. /graphQL/public/ and /graphQL/private/ Since by defining legal templates in one endpoint those will be legal for anyone. But you want to restrain the public data for the guest user as much as possible - but at the same time allow more available data for logged in users, even granularly define legal data for different user roles. You could do it just like that I think? /public/ will only allow very few legal things in general. /private/ will handle anything else automatically via ProcessWires granular permission system for logged in users. Or maybe there is a way to handle that all in one endpoint? Idk ... ... oh. of of course you can ask in your single endpoint for the user role ...... .... ... as simple as that. Maybe it would also be handy to have an option to define "legalFields" in the same way as templates? So you can restrain the amount of data which is instantly public a bit more granularly. So you can just hide anything which doesn't need to be public at all. And by the way - good work! I will definitely learn a couple of things here again ... thanks!
  7. https://github.com/processwire/processwire-requests could be a good place to put a feature request ; )
  8. Uh yeah that may be actually! ... you may just try it out the next time - one will work, the other one will throw an error - i always confuse them .... ;P
  9. Hej! You should just use the translation function in the places which shall be translated. Then people can translate the module by themselves. For example: <?php // from your module $f->description = "The pages you import will be given this parent."; // to $f->description = _("The pages you import will be given this parent."); If you install ProcessWires translation stuff and go to the setup of your language and there to "translate files" area thing - you can select your module and translate those exact phrases which are put into _(" blurb ") Have also a look here: https://processwire.com/api/multi-language-support/ enjoy : )
  10. So I understood that right. I think what I provided should work, of course you have to put in your own field names / variable names. Though, I just saw that I had an error in my code above (the variable in the if condition was wrong). I corrected it - you should try it again - Maybe also try this selector with $page->id "deals_show_on_endorse={$page->id}" But as I remember right this shouldn't be necessary.
  11. maybe this helps for further research: otherwise, also mentioned there as a quick and somewhat dirty hack: <?php echo str_replace(['<p>', '</p>'], ['', ''], $page->summary);
  12. <?php // on endorsement subpage $thatRelatedDealsPage = $pages->get("show_on_endorsements=$page"); if($thatRelatedDealsPage) { echo $thatRelatedDealsPage->title; // etc ... } Something like this? I assume: On the deal page you select the endorsement in a PageReference field - and then on the endorsement page/template you can just search which page has "this page" (= $page) selected in that field. hope that helps
  13. <?php /** * getFieldsetOf * * for ProcessWire * * gets fields inside a fieldset of pages or templates * choose to retrieve values * * @param Template|Page $context the page or template * @param String $fieldsetName name of the fieldset * @param bool|boolean $collectValues want to collect values of the pages fieldset? * @param string $fieldsetCloseIdentifier default: '_END' * @return FieldsArray|WireData returns FieldsArray or if data wanted, WireData */ function getFieldsetOf($context, String $fieldsetName, $collectValues = false, $fieldsetCloseIdentifier = '_END') { if ($collectValues === true && $context instanceof Page) { $collectedItems = new WireData(); } else if($context instanceof Template) { $collectValues = false; $collectedItems = new FieldsArray(); } else { throw new WireException("getPageFieldset: first argument must be of type Page or Template", 1); } if (!$context->fieldgroup->get($fieldsetName . $fieldsetCloseIdentifier)) return NULL; $collecting = false; foreach ($context->fieldgroup as $field) { if ($field->name == $fieldsetName) { $collecting = true; continue; } if ($field->name == $fieldsetName . $fieldsetCloseIdentifier) { break; } if ($collecting) { if ($collectValues) { $collectedItems->set($field->name, $context->get($field->name)); } else { $collectedItems->add($field); } } } return $collectedItems; } Some extension of the above code - works with templates and pages. If thrown at pages you may choose to retrieve the values inside the fieldset as a WireData object. edit: @dragan (below) thanks for the hint! Just removed it.
  14. 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 : )
  15. Have you already contacted transip? If not, you should – I think they will give you advices about the .htaccess file or whatever there is to mind.
  16. <?php $out .= "<div class='row'>"; $i = 1; foreach($page->children as $p) { $out .= "<div class='col-xs-4'>"; $out .= "<img src='{$p->images->first->url}' class='img-responsive'>"; $out .= $p->title; $out .= "</div>"; if($i++ % 4 == 0) $out .= "</div><div class='row'>"; } $out .= "</div>"; Hi! For that stuff I use the handy modulo operator ... it is a division but you will get the remainder from the division. (See evaluations below) The divisor has to be n+1 of the number of inner sections of the division. (Your cols) Then I also do pre-increment the counter directly in the if statement to save some lines (Post- vs. Pre-imcrement). The counter gets incremented before the modulo operation and the comparison. Just changed it. Either you do pre-increment and put the line at the top ($i must start at 0), or post increment and put the line at the bottom ($i must start at 1). That way this logic fits into 2 lines (init the counter + the sectioning logic) Here some modulo results as a visualization: >>> $i = 0 => 0 >>> $i++ % 4 => 0 >>> $i++ % 4 => 1 >>> $i++ % 4 => 2 >>> $i++ % 4 => 3 >>> $i++ % 4 => 0 >>> $i++ % 4 => 1 >>> $i++ % 4 => 2 >>> $i++ % 4 => 3 >>> Hm. yep. Havent tested the code, but it should work. ..... .. I hope. cheers!
  17. Hej, you could use the PageTable field (included module, but you have to install it) - have a look here: or go with the RepeaterMatrix Profield: (I'd recommend that, it is worth the money!) https://processwire.com/api/modules/profields/repeater-matrix/ or use subpages with a simple Pagefield on the 'parent page'. You can arrange the items in the pagefield of the parent with the according InputfiedType. That would define the order. But you'd have to manually create the pages first outside that parent page. It is technically very similar to the pagetable-approach but with less comfort. Hope that helps! cheers Steffen
  18. @BitPoet Yep! Thanks! I corrected it and took a more generic name - also I had commas instead of '=>' !! The point is, the keys of the array passed in $files->render() become exposed as variables in the fetched .php partial.
  19. This discussion is also about linking pages back and forth with a hook example:
  20. Ah, of course, you have to use ->path ! Thought about a processwire ffm meetup the other day ... I know at least one agency here using processwire, cool guys @Webrocker We'll see if we feel the urge ...
  21. echo file_get_contents("{$config->urls->assets}img/icons/ticket.svg") try this - the arrows are not complete and maybe wrap that into curly braces - and also you don't need the preceding slash! Oh, btw - you might like this? This is my placeSVG function which also strips the doctype and comments from svg files when embedded directly: it assumes the templates/ directory as the standard location, but you can add an optional other path ['path' = ...] - and then it concatenates the path with the first argument https://gist.github.com/blynx/d91d749e76c112f06a505a2d17dfdc2e PS: Are you frankfurt (ffm) based? ^^
  22. This is very exemplary and you have to apply it to your loop, still: But you can put the small piece into a seperate .php file - for example /templates/partials/piece.php Have a look at http://processwire.com/api/ref/files/render/ Then, you could: <?php // template file $output = $files->render('partials/piece.php', ['value' => $data]) // or with the loop $output = '' foreach($items as $item) { $output .= $files->render('partials/piece.php', ['value' => $item]) } The partial piece.php could be this, I really like the php style to have plain HTML and only insert small php tags where necessary: (It looks nice in my editor, too) <div class="some-grid"> <div> <?= $value->object_prop ?> </div> <div> <?= $value['array_elem'] ?> </div> <ul> <?php foreach($value->data as $item): ?> <li><?= $item->property ?></li> <?php endforeach ?> </ul> </div> PS: You might also want to have a look at https://processwire.com/blog/posts/processwire-3.0.7-expands-field-rendering-page-path-history-and-more/ "field rendering with template files" - again, I am recommending the same stuff all over - but it really helps structuring the files.
  23. Bit late but ... anyway ... just an idea because I don't know ;O Maybe also rename the json file? Its name also corresponds to the path - but with dashes ... Something in the database? Did it work meanwhile?
  24. Yep, sounds legit. : )
×
×
  • Create New...