Jump to content

Leaderboard

Popular Content

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

  1. 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
    6 points
  2. $children = $page->children("template=article"); foreach(['A', 'B', …] as $letter) { $startingWithLetter = $children->find("City^=$letter"); if(!$startingWithLetter->count()) continue; // Do things here } Only the first find is a call to the database, while all the other ones in the foreach are just in memory searches and therefore quite a bit faster.
    6 points
  3. Just an addition. You could use the range() function from PHP to create the array. For example like this: range('A', 'Z')
    5 points
  4. We didn't define the $image variable. How about this? <?php $features = $pages->find("template=newsitem, limit=3, sort=-date"); foreach($features as $feature) { $img = $feature->image->size(320, 180)->url; echo " <div class='column is-4' >" . "<img src='$img' alt='' />" . "<h3 class='title is-4'><a href='{$feature->url}'>{$feature->title}</a></h3>" . "<p><span class='date'>{$feature->date} &nbsp; &bull; </span>" . "{$feature->summary}</p>" . "</div>"; }
    3 points
  5. @lokomotivan - you should never install modules with the "-master" on the folder name. The easiest way to install is to use the ClassName option, or URL, or zip links. This is way easier than manually extracting and copying to the modules folder and it takes care of this for you.
    3 points
  6. It might be that MySQL and PHP differ in the opinion what localhost should resolve to. If MySQL treats localhost as ::1 (ipv6) and PHP thinks of localhost as 127.0.0.1, that would explain this behavior. Though it's also possible that the user is defined as user@% instead of user@localhost and ipv6 loopback access is treated like a remote access. It's hard to say without taking a peek into the system.
    3 points
  7. v109 is up - see the readme file on date formattig: PageListTweaks: ability to format unix timestamps in pagelists PageListTweaks: using %field.property% will output the value in the user's language (if available) PageListTweaks: always show extra actions fixed language translator filterbox not appearing possible fix for unclickable select dropdowns in ProDevTools API Explorer (reported by Robin S.) "Always show extra actions" was a client request and removes the need to click on the ">" icon to see the extra actions. This can be handy for power users or when you often need to toggle pub/hidden states of pages. Or simply lazy
    2 points
  8. @Elías Gómez, can you post the code you are using to loop over your event pages? It's hard to offer much advice without seeing that. Also let us know what you have selected for the "Formatted value" in the settings of your image field. As a general tip, if you spend a little time getting to know the Tracy Debugger module you will find it very valuable for investigating these kinds of issues. https://processwire.com/blog/posts/introducing-tracy-debugger/ http://modules.processwire.com/modules/tracy-debugger/
    2 points
  9. Try ticking the "Make field value accessible from API even if not viewable" checkbox under "Access toggles".
    2 points
  10. Ah, there's light at the end of the tunnel. Those annoying cookie banners required by a misguided 2012 European law might soon disappear. One less thing to implement...
    2 points
  11. Welcome to the forums and ProcessWire . Oh, we are very kind to everyone, especially those coming from the nightmare that is WordPress. Just kidding. Former MODx-er myself. Nothing wrong with using the variable $features. What I suspect is that your image field is set to hold (and return) more than one image, i.e. an array. So, calling the resize function on an array won't work. Edit Been beaten by others who are faster at typing/thinking...so will stop typing now
    2 points
  12. This should work: <?php $features = $pages->find("template=newsitem, limit=3, sort=-date"); foreach($features as $feature) { $img = $image->first()->size(320, 180)->url; echo " <div class='column is-4' >" . "<img src='$img' alt='' />" . "<h3 class='title is-4'><a href='{$feature->url}'>{$feature->title}</a></h3>" . "<p><span class='date'>{$feature->date} &nbsp; &bull; </span>" . "{$feature->summary}</p>" . "</div>"; } You can read more in the docs. On why you should use first() - or not.
    2 points
  13. Hey OpenBayuo, You can just use something like the following? <body class="<?= $page->template ?>"> Hope this helps.
    2 points
  14. The image field default setting is to output an array, so if you only want to output one image of the page, try on your loop: $event->images()->first()->url;
    2 points
  15. MarkInPageTree New module which does what it says in the title. It adds an icon to a page on the page tree if -> a specific field is true and / or is a specified template. For example I'm using it to add an icon to any page that has a checked (checkbox) exclusive field. This helps with admin clarity as you can see instantly which pages of the same template have differing content (i.e. are exclusive or not). https://github.com/benbyford/MarkInPageTree
    1 point
  16. $page is an API variable, so it's already defined at the time your _init.php runs. $child is not an API variable - it's a variable that you have defined yourself. So you need to make sure it is defined before you try and do anything with it such as $child->created. I don't see $child being defined in your _init.php. I tried both the renderPager() examples you gave and they execute fine. There must be something else that is causing the 500 error. Check your error logs to see if that sheds any light. Are you developing locally or on a live server? If it's a live hosting you may be getting false positives from mod_security if that is installed, so ask your host to disable mod_security in that case.
    1 point
  17. I have done it! The error is that I was naming the property images, instead of the name of the image field itself, ie. poster_image. So now I have something like: foreach ($events as $event) { echo "<img src='$event->poster_image->url()'>"; } I don't need the first() method because I have limited the field to only 1 image. @Robin S, I was repling when you replied
    1 point
  18. Nothing useful on the body I think but there is a class on the h1 and also its containing div:
    1 point
  19. Thanks, i guess i got use to just manually unzip it to modules folder :). There's probably ppl like me there so thought that info could be useful
    1 point
  20. Hi, thank you for reply. I decided to build this module in another way. I think this works nice and is efficent for projects with hundreds of images, like Product-Catalogs. Ok, here is my brand new version module: image upload to another page upload and add to pages field image comparison to prevent duplicates basename comparison and pixel comparison search images by text (or show all) no more autocomplete-clone. A built a own Javascript to api logic to get images back. select images in an easy way drag n drop the imagepages like in imagefield to sort Because its extensive stuff, i decided to take a screen capture. I dont know how add a videocontainer here, so you have to download or open the following link in browser: Screen Capture http://download.frech-und-artig.de/selectOrUpload.mp4 (mp4, 91 MB) 3:35 = upload and select images 5:48 = image comparison 7:18 = image comparison with new page 8:00 = testing change of LibraryParent Image Preview Things that i have done: extended Image configuration fields hook in Page::saved to push uploaded images to new/other page ans check if page and image fields connected right to each other extended Page configuration fields hook in PageField::saved to control PageField Config hook in ProcessPageSearch to provide image thumbs instead of boring labels created new InputField "InputfieldPageSelectOrUpload" without pageAutocomplete cloning i added own logic to sortable / add / remove events etc I focused all the time to simplynes for user comfort. But one thing is anoying: that i have to use two fields: the image and the pagefield. I'd loving it, if there is a way, to setup only one field which is presenting two fields in one. How can i merge this? I leaved the bunch of $this->messages("...") in the module for now, because they explain some things and reports errors. What do you think? See zip in attachement. I hope you understand my amazing english skills. SelectOrUpload-0.0.1.zip
    1 point
  21. See the pagination docs for how to change the markup/classes output by MarkupPagerNav: https://processwire.com/api/modules/markup-pager-nav/
    1 point
  22. This module is very old and I am not sure if it is still maintained - maybe it's just fine, but you might also find what you need in this PW core function: wireRelativeTimeStr() https://github.com/processwire/processwire/blob/d935e9b6995124d76e6fda17fd47ab46dc4d3a3c/wire/core/Functions.php#L283
    1 point
  23. You'll want to use $page->rootParent as the starting point of your menu. But for a simple menu like this (and even not-so-simple ones) I recommend trying MarkupSimpleNavigation as it covers all the common menu needs out-of-the-box.
    1 point
  24. 2.8 is working without an issue. 2.7.x is not working with this module.
    1 point
  25. I installed tracy module. But I could not know how to operate it. Anyway, I could let you access the website as it is just a dummy default installation profile (nothing else). It is just for testing new modules for my own. frontend http://icy-pig-4792.vagrantshare.com/pw271/ admin http://icy-pig-4792.vagrantshare.com/pw271/processwire/ id: admin pass: 123456
    1 point
  26. Are u referring the module config page ?
    1 point
  27. What Robin S said. Security How does the widget communicate with the third-party server? Is that something in your control? Are there risks if the communication was intercepted? User-Friendliness As a general rule, I would never put any sort of code in front of editors, unless I have to. Edit 10 or 15 pages and one widget starts to look like another, we miss or add an extra apostrophe here and there, and soon, it gets a bit messy and our code trips. In addition, the editors will probably be copying and pasting and that's somewhat tedious. Other than that, it doesn't look too friendly . OK, we can mitigate this by asking the client to enter something like this in the text/textarea field type:class_lists,partner:mb,id:123456WB,version:0.1 OK, a bit of progress, but that's still a bit cryptic for some clients. The ideal situation would be to create one input per editable-value. That would mean 1 field per editable-value. Maybe an overkill (to some). Better yet, I would create a custom field that will hold all those n number of inputs for n number of editable-values. The advantages of this are: It is user-friendly It is easy to sanitize and validate each individual input If needed, we can query each of those fields (e.g. in case we have lots of pages and need to find those that contain xxxx in their ID in order to edit them) Etc... Below is an example custom widget field as per above. It is not very difficult (if you are a developer) to create one based on the Events Fieldtype. Just my 2p. Something to consider.
    1 point
  28. Introducing the AutoLinks Text Formatter, part of the ProcessWire ProFields package of modules. What it Does This Textformatter module automatically links your specified phrases/words to your specified URLs. This is an excellent SEO and accessibility tool for creating automatic contextual links with little effort. If there are pages that you commonly link to in your site from your textarea/rich text fields, then this Textformatter can save you a lot of effort, automatically linking to those URLs. Furthermore, contextual links of this sort are also considered especially valuable from an SEO context. Because this module is a Textformatter module, the work it does happens at runtime. That means that this module can easily be applied to existing sites, no matter how large. Usage Example We'll use processwire.com as an example. Throughout processwire.com, we routinely use the terms "API", "selector", "template", "template file", "$page", "$pages" and more. In the past, I've spent a lot of time in TinyMCE manually linking these terms to the appropriate pages, as it is a helpful cross-reference for users. For example, when the term "API" appears, I want to automatically link to the API Cheatsheet page at http://cheatsheet.processwire.com. With the AutoLinks Textformatter module, I can now automatically link to all my important terms from all existing and future body copy. If one of those links happens to change in the future, no problem, as I only have to update it in one place (if at all). The benefits here are a real win win for the users of processwire.com, myself (in time savings) and our performance with search engines that analyze these contextual links. We hope that you find AutoLinks to be a huge benefit to your site(s) and time saver for you and/or your site editors. AutoLinks is available for purchase as part of the ProFields package in the ProcessWire Store.
    1 point
  29. @Speed You are welcome. Even better to change the document root in your web server setting.
    1 point
  30. Well, you should be a bit wary in that a person with edit access to the page could insert some malicious Javascript. If the person editing the website is the site owner then of course they would have no reason to do such a thing. As a general principle I think you should only make editable the parts of the code that it is essential to keep editable. For example, if your client only needs to change the "data-widget-id" attribute then make a text field just for that part and keep the rest of the snippet static in your template file. As an added benefit it also minimises the chances that they accidentally mess up the snippet code.
    1 point
  31. There are several options: 1) The easiest option would be in the Console Panel in TracyDebugger 2) Converted to an action for the Admin Actions module - this would be a great option because I expect there will be lots of users wanting to convert from Thumbnails to Croppable image over the next few months - hint hint @netcarver, @horst, or @jacmaes 3) In a test hanna code 4) In a template file 5) In a bootstrapped script in the root of your site
    1 point
  32. Hi @Nukro, It is planned for the next version. Technically, I already know how I will implement this. What I am still unsure of is how I will implement the GUI (from a usability point of view). With lister, each lister gets its own fixed filter configurations. With Media Manager, there's only one canvass, so to speak. We will probably need a dedicated page to handle the creation and editing of a filter configuration. Users would need to be able to select the active 'filter' configuration/profile. I would like the whole thing to be a simple thing to do (from user perspective) but without cluttering the MM interface. I'll need some time to think this through. I would appreciate any thoughts you have, thanks. As for ETA, I am afraid it cannot happen before the new year.
    1 point
  33. That will just set it to dev and proceed - it won't actually check the value of $config->env Just an option for you - TracyDebugger has a Mail Interceptor panel which which intercepts all outgoing emails and displays their content in the panel instead - might be a decent option for what you are trying to achieve?
    1 point
  34. Announcing that I've tested and can confirm that RuntimeMarkup is compatible with ProcessWire 2.8.x and ProcessWire 3.x
    1 point
  35. Old topic but maybe can be useful. What about adding a global variable? Like this: $port = ($_SERVER['SERVER_PORT'] == 80 || $_SERVER['SERVER_PORT'] == 443) ? '' : ':' . $_SERVER['SERVER_PORT']; $protocol = ($_SERVER['SERVER_PORT'] == 443) ? 'https://' : 'http://'; if(!$config->siteURL) $config->siteURL = $protocol . $_SERVER['SERVER_NAME'] . $port . '/';
    1 point
  36. You have moved those pages around from amother parent? Move those out of the parent and then back in. Works?
    1 point
  37. The reason for this is that you are setting the divisor and the probability after the execution of the garbage collector has already been decided (in other words, after the execution of session_start()). With Ubuntu your default value for the probability is 0, meaning it will never execute. You need to place those ini_set directives before the session is started. In ProcessWire one way to do this would be wire()->addHookBefore("Session::init", function() { ini_set('session.gc_probability', 1); ini_set('session.gc_divisor', 100); }); You would need to place this inside an autoloading module though. Another way would be setting those inside your .htaccess with php_value session.gc_divisor 100 php_value session.gc_probability 1 (depending on your host, this might not work) Your last resort would be clearing them "manually" by adding this to your _init.php. Well basically you wouldn't even need a hook, you could just execute the code. wire()->addHookAfter("ProcessPageView::finished", function() { $prob = ini_get('session.gc_probability'); $div = ini_get('session.gc_divisor'); $path = ini_get('session.save_path'); $expire = ini_get('session.gc_maxlifetime'); if(rand(1,$div) <= $prob)) { foreach(glob($path.DIRECTORY_SEPARATOR."sess_*") as $file) { if(filemtime($file) <= time() - $expire) unlink($file); } } });
    1 point
  38. Hi reno, I think it is doable with two hooks. One hook would return false for Page::viewable() for the ProcessPageList page. Another Hook can be used to redirect your users to a custom admin page after login. I've only used the second one in a project, but I think something like this should work: // This needs to be an autoload module public function init() { $this->addHookBefore('ProcessHome::execute', $this, 'rootPage'); $this->addHookAfter('Page::viewable', $this, 'viewable'); } /** * Redirect users with custom-role to another page after login */ public function rootPage(HookEvent $event) { if ($this->user->hasRole('custom-role')) { $this->session->redirect('custom-admin-page/'); } } /** * Don't give users with custom-role access to Pages page */ public function viewable(HookEvent $event) { $page = $event->object; $user = $this->user; if ($page->id == 3 && $user->hasRole('custom-role') { $event->return = false; } }
    1 point
  39. I would stick with PW, really I remember getting dizzy when I had to make pages in Drupal look the way I wanted: Where this margin is coming from? Ok, this module generates this HTML with 4 wrappers. Where it takes its css from? Let's see it has cached css-file which is generated every time I save module settings. Ok, let's take a look at its real css-file. Well, it's not really css-file, but css template written in php. Ok, what we see, it generates css depending on the options we set in module's properties, but I still can't see where this margin is set. I've spent already about 20 minutes trying to find this goddamn margin property. Ok, if it isn't here it should be somewhere else, let's dig through module's source files. Haveng spent another 10 minutes looking through module's source files I finally found this margin in module_name_API.php!!! WTF? Why put it here? Ok, I fixed my margin, but I have another page where this module's markup is output next to another's and now they overlay, because that another module generates its own markup and now I have to repeat this crazy procedure again for another module. No, not anymore! I have a lot of other things to do! Yes, Drupal is very powerful, but this continuos, never-ending hacking makes me suicidal I would rather spend time creating using the system then struggling with it. As for MODx, I really liked Evolution and still do, but PW makes it look unnecessary complex and is light years ahead in terms of intuitiveness and flexibility. I also tried to use Revolution, but to me it over-complicates things and I can't stand its sluggish back-end (thanks ExtJS). Their announcement IMO is pretty logical step to take as Revolution haven't equaled the hopes, but it gave really good understanding of what's really important for this CMS. I wish MODx team good luck with MODX3 because they've already made one of the best CMSs that I really like and just because they are great guys. Wish them to repeat their success with third version. Processwire brings joy to development, this is why I will keep using it It makes me learn and create rather then hack. And it has a brilliant community, in life of which I wish could participate much more then I do now.
    1 point
×
×
  • Create New...