Jump to content

Leaderboard

Popular Content

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

  1. Hi Adrian, I have a module that could be helpful here - just putting the finishing touches on it and will release this weekend. Cheers, Robin.
    4 points
  2. Now that's what I call service, or maybe it's just "Great minds think alike" Can't wait to see what you have put together!
    3 points
  3. Maybe just a textarea plus "TextformatterNewlineUL", which »converts newlines to <li> list items and surrounds in an <ul> unordered list«?
    3 points
  4. Padloper works now with PW 3.0. Planning for next release on Christmas time.
    3 points
  5. v108 is up, containing a new feature to add markup to pagelist items: It uses the [tag.class][/tag] syntax, making it flexible to use. The module also contains default styling for the "em" tag (which is the recommended): {title} [em.company][b]{company_ref.title}[/b][/em] [em][i]images: {images.count}[/i][/em] Output in the pagelist:
    3 points
  6. Try with $config->paths, files are not accessed via url.
    3 points
  7. // example // PW3, bootstrap check user-account $PWuser = empty($_GET['user']) ? '' : $_GET['user']; $PWpass = empty($_GET['pass']) ? '' : $_GET['pass']; if(!$wire->get('user')->isLoggedIn() || !$wire->get('user')->hasRole('superuser|chef')) { $u = $wire->get('session')->login($PWuser, $PWpass); if($u) { $wire->get('user') = $u; } if(!$wire->get('user')->isLoggedIn() && !$wire->get('user')->hasRole('superuser|chef')) { echo "\n\nERROR: Incorrect User-Login!\n\nScript stops now!\n"; exit(1); } echo "\nSuccessful logged in as: " . $wire->get('user')->name ."\n"; } else { echo "\nAllready logged in as: " . $wire->get('user')->name ."\n"; }
    3 points
  8. ConnectPageFields Allows the connecting of two related Page fields so that changing one updates the other. Purpose of module An example: suppose your website is about movies. You have a template "movie" with Page field "actors". For each movie you add the actors that appear in the movie. All good, but what if you want to find results like... the 10 actors who have appeared in the most movies actors who haven't appeared in any movies since 1990 You cannot retrieve these pages with a single efficient $pages->find() query, and must load a large PageArray into memory in order to iterate or filter it. For the sake of making these types of queries more efficient you could structure your templates/fields so that movies are added to actors instead, but this may be a less comfortable workflow and can run into equivalent problems (e.g. "find the 10 movies with the largest cast"). The solution is to have a two-way relationship so that movie pages have an "actors" Page field and actor pages have a "movies" Page field. This module will keep these two Page fields in sync so that adding "Ryan Gosling" to "Drive" automatically adds "Drive" to "Ryan Gosling". Also, you can select the same Page field in both Page field A and Page field B. For example, create a "Related" Page field for related pages. Choose "Related" for both fields in a pair in the module config. Now when you add "Orange buffoon" to Related for "Donald Trump", "Donald Trump" is automatically added to Related for "Orange buffoon". Usage Install the ConnectPageFields module. If you haven't already done so, create the two Page fields you want to connect and add them to templates. In the module config select the two Page fields in a "Connected field pair" row as Page field A and Page field B. You can add rows as needed using the "Add another row" button. Troubleshooting Make sure you have set the "Selectable Pages" settings for each Page field correctly: The settings for Page field A should allow pages using the template(s) that Page field B has been added to. The settings for Page field B should allow pages using the template(s) that Page field A has been added to. http://modules.processwire.com/modules/connect-page-fields/ https://github.com/Toutouwai/ConnectPageFields Module config: Demo showing how changing one Page field updates the other:
    2 points
  9. A repeater will work, but it's sort of overkill for repeating just a single line of text. Behind the scenes it is creating a page for every line. This is probably the way to go. If you wanted your own custom markup you could explode and foreach a textarea. $lines = explode("\n", $page->my_textarea); if(count($lines)) { echo "<ul class='my-special-list'>"; foreach($lines as $line) { echo "<li class='my-list-item'>$line</li>"; } echo "</ul>"; } For sure, and for more complex repeatable items see the Table fieldtype.
    2 points
  10. Sorry, this tweak is only a regex preg_replace, nothing more. But this one works - kudos to Tracy Debugger letting me find this out {images.field.label}: {images.count}
    2 points
  11. Definitely better - I would also recommend looking into the heredoc syntax.
    2 points
  12. Based on @Macrura's example - maybe just a personal preference more than anything, but I prefer the look of this. I do think it really helps to indent the code though function renderUkGrid($page) { return " <div class='uk-grid uk-grid-large'> <div class='uk-width-medium-1-3'> <div class='uk-panel uk-panel-box prodotto__panel-mod'> <div class='uk-panel-teaser'> <div class='uk-cover-background' style='background-image: url({$page->product_image->url});'> <img class='uk-invisible' src='{$page->product_image->url}' width='600' height='400' alt='Placeholder'> </div> </div> </div> <a class='prodotto__panel-links prodotto__panel-links-blue' href='{$page->url}'><span>Discover more</span></a> </div> <div class='uk-width-medium-2-3'> <div class='prodotto__descr'><span>{$page>product_options->title}</span> <h3 class='shadow-blue'>{$page->title}</h3> <p>".truncateText($page->product_description)."</p> <p><a href='{$page->url}'><i class='uk-icon-chevron-circle-right uk-margin-small-right'></i>Link</a></p> </div> </div> </div> "; }
    2 points
  13. I don't think this is the place to ask which cms you should choose. It's PW forum and i doubt there will be people who'll tell you you should use another cms. I doubt there is something you can't build with PW, or the others cms too, the questions is which one is the easiest to work with.
    2 points
  14. 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? ^^
    2 points
  15. 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.
    2 points
  16. This isn't tested, but i use this general sort of thing all the time to change page URLs. It is within the hook function that you need to deal with your logic of when to add the .html and when not to, you will need conditional statements... /** * This hook modifies the default behavior of the Page::path function (and thereby Page::url) * * */ wire()->addHookBefore('Page::path', function($event) { $page = $event->object; if($page->template == 'something') { $event->replace = true; $event->return = $page->name . '.html'; } }); Snagged from here originally:
    2 points
  17. Welcome to the PW world @dg234! Your site reads like the perfect task for ProcessWire. While you don't need to move your data from its external tables, chances are high that you will want to do that and create a page for every hike that holds its data, track(s) and images. PW's template files are (unless you install a template engine module like smarty) just PHP files outputting your HTML, so you have every freedom regular PHP scripts give you. PW also provides you with a PDO wrapper to its database in the $database variable, or you can use the underlying WireDatabasePDO class to access an external database. Or use PHP's native database layers. Or use a third-party ORM layer. Whatever you fancy. You don't have to upload your images one by one. You can either drag and drop a number of files at once in the backend (though POST limits may hit you there depending on the server settings) or FTP them to the server and create a short bootstrap script that adds them to their pages. Since you control the HTML, you can include whatever scripts and styles you want, either generically (in such cases I like to put them into an extra include for the header, like _header.php, to keep them organized) or on a per-template basis. If you have a generic page layout but want to add different includes and styles depending on the template, you can use the (popular) strategy of automatically appending one "master" PHP template that produces the HTML and fill the variables used there (like e.g. $content and $headers variables) in every individual template's file as explained here. PW lets you override that setting on a per-template basis, so, like with most things in PW, you have every freedom. Just keep in mind that PW's pages first and foremost are equivalents for tables to store your data. The fields you assign in the backend template are their columns. Page fields, Repeaters and the implicit parent-child relationship are links between these "tables". Not every page needs to have a PHP template, in that case it can't be viewed directly but still used to hold and render data in other pages, but once you have your data in pages, it's easy to display it as well as search for it using PW's extremely powerful selector API. To wrap it up, you'll be able to do most if not all things you need with PW's default functionality and a handful of already available modules. I don't see a need to develop your own module yet, but there is a getting started documentation for module development in the online docs and, if you find that you do in fact need to, just ask here and you'll find a wonderfully helpful community.
    2 points
  18. Have updated it now to version 0.9.17. There was another one pending with this part of the code. I thought I had already comitted it. Sorry!
    1 point
  19. I got it. The Repeater i just installed does the job. But im still open to other ways to accomplish that, just for getting to know PW better. Thanks
    1 point
  20. Sorry guys, I have been laughing five minutes alone here for your vagina monologues vs avengers debate It was indeed our link spam protection plan (that actually worked pretty well). So @fbg13 no worries about any virus, just poor humor from moderators.
    1 point
  21. I have a slightly different pattern as @adrian & @Macrura, this way there are no un necessary whitespace characters in HTML $out = "<div class='uk-grid uk-grid-large'>" . "<div class='uk-width-medium-1-3'>" . "<div class='uk-panel uk-panel-box prodotto__panel-mod'>" . "<div class='uk-panel-teaser'>" . "<div class='uk-cover-background' style='background-image: url(" . $page->product_image->url . ");'>" . "<img class='uk-invisible' src='" . $page->product_image->url . "' width='600' height='400' alt='Placeholder'>" . "</div>" . "</div>" . "</div>" . "<a class='prodotto__panel-links prodotto__panel-links-blue' href='" . $page->url . "'>" . "<span>Discover more</span>" . "</a>" . "</div>" . "<div class='uk-width-medium-2-3'>" . "<div class='prodotto__descr'>" . "<span>" . $page->product_options->title . "</span>" . "<h3 class='shadow-blue'>" . $page->title . "</h3>" . "<p>" . (truncateText($child->product_description)) . "</p>" . "<p>" . "<a href='" . $page->url . "'>" . "<i class='uk-icon-chevron-circle-right uk-margin-small-right'></i>Link". "</a>" . "</p>" . "</div>" . "</div>" . "</div>";
    1 point
  22. Shouldn't that read 'piece' instead of 'child', since you're using $piece in piece.php?
    1 point
  23. You are both providing good adivices and code. I did dozen times what @Macrura wrote...but that's what happens when you got a 5 months baby crying all night long: your mind blows :). Thanks @blynx too, I'm going to investigate more on It.
    1 point
  24. 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 ...
    1 point
  25. @blynx Wow, thanks. ill have a closer look at your function. And yes, i am ffm based
    1 point
  26. Hi Horst. thanks for the post. I was wondering about the above as I had to do this to work? if($u) { wire('user')->user = $u; }
    1 point
  27. I have no time to investigate further but this fixes it (line 344) // if ($image->pagefiles === $pagefiles) { if ($image->pagefiles->page->id === $pagefiles->page->id) { Perhaps "===" is the culprit? PHP docs says
    1 point
  28. Remember the book "Where's Wally?" (or Waldo in some countries) - we need a new one for Nico. That said, Ryan has write access to the lang-sites, and so I'm sure he can update the links. That said, a site-revamp is pending, and those sites may well be scrapped in favour of a single site, but I'm not 100% sure on that.
    1 point
  29. Have you tried to refresh module cache? I just had a problem where the whole admin menu wouldn't change language, after flushing the cache it works
    1 point
  30. Yes, that version works like a charm! All entries are translatable now. Fantastic
    1 point
  31. 1 point
  32. I assume that when you say parent and child you are talking about pages. If you need to edit the fields of the child pages directly in the listing then you could use Lister Pro for viewing the children list and editing the fields using the inline AJAX editing feature: https://processwire.com/blog/posts/inline-ajax-page-editing-comes-to-listerpro-processwire-2.6.6/ If you just need to show the fields from the child pages then you could generate a table from the child pages using Matrix or RuntimeMarkup.
    1 point
  33. @LimeWub Please post in the existing TemplateEngineSmarty thread next time. The problem is that the global "$view" API variable provided by the factory is still associated with the page you're currently viewing, which is using "page.tpl" smarty template. Meaning if you are using $view in your block.php controller, this $view still points to "page.tpl". You can use chunks or partial templates in this case, here's a quick possibility with chunks: $blocks = $page->children("template=block"); $blockHTML = ''; foreach ($blocks as $block) { $chunk = $factory->chunk('block'); $chunk->page = $block; $blockHTML .= $chunk->render(); } $view->set('blockHTML', $blockHTML); Note that I'm passing the block page as variable "$page" to the chunk, so I'm faking the locally scoped $page variable from ProcessWire. Usually I put my chunks into a subfolder chunks, so I don't mix them up with "regular" controllers/views. Does it help? Cheers
    1 point
  34. Ah yes - try the latest version - those should also now be translatable. Sorry, in a rush, but hopefully that will work. Perhaps I can improve things in the future - I honestly haven't played around with module translations at all
    1 point
  35. ProcessWire (again) is featured in the c't: One of Germany's biggest and most renowned IT magazines. The article is about alternatives to WordPress. WordPress-Alternativen: CMS-Auswahl leicht gemacht
    1 point
  36. hi from the API side you can set the values like this: $page->setOutputFormatting(false); $page->images->trackChange('title'); $img = $page->images->first(); // or whatever image you want $img->title = 'Title in default language'; $img->title($languages->get('fi'), 'Title in Finish'); $img->title($languages->get('de'), 'Title in German'); $page->save(); $page->setOutputFormatting(true);
    1 point
  37. @microcipcip @eangulo@spiria I pushed a potential fix to the dev branch of this module which should fix the errors with compiled templates. If anyone has the time to test it out, here's what you need to do: Get the newest version of the dev branch of ProcessWire Get the newest version of the dev branch of this module Delete your FileCompiler = 0 comments in the twig templates (maybe) Delete all files under /site/assets/cache/FileCompiler It's hard to test for me, as I never got such errors - I think it depends on the content of your twig templates. However, I'm positive since there were no longer twig templates compiled in the cache of the FileCompiler. I hope it works! Cheers
    1 point
  38. For those of you who are experienced with the PW API (and those looking to learn), there is now an "Action Code" viewer that shows the executeAction() method of the action you are about to execute. It is of course collapsed by default and only available to superusers. Anyway, hope you'll find it useful and either reassuring (if you're worried about what code it about to be executed on your site), or informative as to what can be done with the API.
    1 point
  39. SeaVuel | Hotel CMS / template : http://seavuel.com/ | http://demo.seavuel.com/ Whose handiwork is this? It looks ryan-esque to me
    1 point
  40. Finally pushed version 0.3.0 which includes your code snippets @kixe thanks for that and a button to remove the cookie for easier development.. Please tell me if all is clear, especially about the new selector, I added a little note on how to include tree parent using just the selector inputfield.. Let me know how you guys like it. Should I still keep both branches? master for legacy (without namespace) and devns for namespace?
    1 point
  41. @AndZyk Compass and Autoprefixer don't do exactly the same thing.
    1 point
  42. QGIS, a really great and capable free, open-source gis software. Plugins available to make some quick and easy webmaps. Inkscape, definitely not flawless but as far as free vector graphics progs go, it is hard to beat.
    1 point
  43. Cough. We used to get a lot of spam with certain movie names on the forum. That's a feature.. kind of
    1 point
  44. Got it, thanks. And your interpretation of those movies clearly goes much deeper than mine
    1 point
  45. I must agree with OP. I have had an example in the past where we have had a slider that is different on each page, however one image maybe the same. At the moment the user will have to re-upload that image into the image field, however in CKEditor he can select it from the page. It would be cool to see this: This will work very much like CKEdit's current asset selector. This will allow for a page tree for example /media/ (hidden) /boats/ (image field - for drag and drop bulk upload) /ports/ (image field - for drag and drop bulk upload) That way if you ever need to use a picture of a boat or a port, you already have uploaded, you don't need to repeat content that could take up space on the server. I must apologies, I'm by no means a backend developer. I have no idea how possible this is (or how clean this is). As a front-end developer, I'm very thankful and lucky that ProcessWire gives me the power and flexibility to make my projects come life (any project).
    1 point
  46. You mean something more elaborate than this (which has always been possible btw)? $p = $pages->get(1091); $p->of(false); $matrix = new Matrix(); $matrix->row = 1060; $matrix->column = 1073; $matrix->value = "This is my value"; $p->results->add($matrix); $p->save('results'); $p->of(true);
    1 point
  47. One way to achieve this is to create an image field 'slideimages' in the root-page (or in a hidden settings-page). You can upload your slider-images there in one place and your colleague can rearrange them as needed. In your template file you access the images like $pages->get("/")->slideimages (or the appropriate path for your settings-page) and then foreach over the images to output the slider-code.
    1 point
  48. I created an empty language pack. Go to: Admin > Setup > Languages Create a new language Drag & Drop the attached zip-file in the Language Translation Files Field. Start to edit the files. empty-lang_pack_pw_3.0.41.zip EDIT: Obsolete in latest PW Versions. Create a language pack by your own. Go to: Admin > Setup > Languages > Add New Save Press button: 'Find Files to Translate' Select all files in the box 'Translatable files in /wire/' Select files in the box 'Translatable files in /site/' which you want to add to your custom language pack Press 'Submit' Start translating Download zip or csv file by pressing the related button at the bottom of the page where translatable files are listed. Done
    1 point
×
×
  • Create New...