Jump to content

Robin S

Members
  • Posts

    4,791
  • Joined

  • Days Won

    303

Everything posted by Robin S

  1. Can you give a bit more information please: 1. What version of PW is installed? 2. Which option did you use to enable front-end editing: Option A, B, C or D? 3. If using B,C or D please provide the template code you have used to try and enable front-end editing. 4. Any javascript errors in the browser console?
  2. v0.0.6 released - adds an upgrade process to migrate existing data when upgrading from v0.0.4 or earlier.
  3. v0.0.5 released - a major reworking of the module. TemplatesChildPages now saves template restrictions in a custom database table. The module no longer has a dependency on the Template ASM Select module. The module no longer adds a global field to templates. Much credit is owed to the Template Access by Parents module by @BitPoet , which provided the basis for the SQL additions.
  4. Thanks @flydev, can you (or anyone) explain why it's necessary to manually add the Processwire namespace to this file? I thought the file compiler was supposed to take care of this automatically. If not, how do we know which files need to have the namespace added manually and which are compiled automatically?
  5. @Juergen, you should remove the closing PHP tag at the end of the file. For PHP-only files it's normally considered best practice to omit the closing tag, because you can get errors and odd behaviour if any character or whitespace is accidentally added after the closing tag. Not sure if that could cause the problem you're having (your module works normally for me).
  6. I figured that would be the case. Thanks for confirming.
  7. Not just page IDs but template IDs, field IDs, etc. If I delete a page (template, field, etc) is the ID of that page released back for re-use or can I be sure that the ID will never be used for a new page in the future?
  8. I'm grateful for the "what 2.8 is for" section in the post. With a limited understanding of namespaces and currently no need to use them in my projects I've been a bit confused about which version (2.8 or 3.0) I should use for new projects. I really just want to use whatever the majority is using as it makes the sharing of code in the forum easier. Now I have some clarity that 3.0 is the way to go for new projects.
  9. The 'icon' value needs to be a single image url. A repeater returns a PageArray, so you need to get a single page from it and then a single url from that page. Assuming that the formatted value of the marker_icon field is set to "single item" you would do something like this: 'icon' => $page->map_repeater->first()->marker_icon->url Also, the $options array is something that applies to the map as a whole. It allows you to set a single custom icon to be used across the whole map. I don't think the module provides support for setting different icons to different individual markers.
  10. Thanks all - I think I'm making some progress now after studying those modules.
  11. I'm looking for examples of modules (but not Fieldtype modules) that create and query their own custom table in the database. Hoping to learn from these how to incorporate the use of a custom table in one of my own modules. These are the modules I have found so far: http://modules.processwire.com/modules/process-redirects/ http://modules.processwire.com/modules/template-parents/ The simpler the modules the better because my knowledge of SQL is nearly zilch.
  12. find() would also work here: $primary_tags = $article->article_tags->find("id!=1336|1337|1338|1339|1327|1326|1328"); $secondary_tags = $article->article_tags->find("id!=1042|1043|1044|1340|1341");
  13. The key thing is to load the select options via AJAX. There are are jQuery plugins that can help you do this, for example: http://plugins.krajee.com/dependent-dropdown/demo Edit: a couple of other examples... http://www.appelsiini.net/projects/chained http://tutorialzine.com/2011/11/chained-ajax-selects-jquery/
  14. Have you set up URL segments for the home page template? See Ryan's post where he talks about the home template:
  15. Me too; beautiful work. Love that grain - looks like film but I'm guessing not in this day and age? Maybe clicking the last image on each page could link to the next page?
  16. It works for me even when the field is inside a fieldsettab: Incidentally, the ability to edit individual fields like this is new to me. How did you discover it, and is it documented in the code anywhere? I'm curious if there are other hidden tricks like this.
  17. Try turning off HTML Purifier for the field also. With ACF and HTML Purifier off everything works for me the same as in the demo. I would say no if it requires having ACF and HTML Purifier off. These are pretty important or else careless editors can paste in all kinds of rubbish. And "Extra Allowed Content" should be kept to an absolute minimum - the allowances @OLSA suggested are so broad (plus you actually need other elements like iframe) that it's tantamount to turning ACF off altogether. But if there's a way to get it working with a reasonably strict ACF and HTML Purifier then it would be cool. Another thought: you could set up Hanna Codes for the different embeds, or even a single clever Hanna Code for all embeds that parses the URL and determines the markup needed for the embed. That would be cleaner and easier to lock down. And there is the Textformatter OEmbed module too.
  18. Just throwing out an idea: maybe some JS via AdminCustomFiles that appends "&modal=1" to links in the pagetree depending on if window.location.href contains "&modal=1"? You'd have to find a way to re-init the script for each AJAX load in the pagetree though. Maybe you could to follow the same principle in PHP with a hook to the pagetree render and $_SERVER['REQUEST_URI'] ?? Not sure if that would work.
  19. I think PageTable (and Repeater / Repeater Matrix) will not scale up to the number of chapters expected. But if chapters are child pages of a book then the Lister mode of Batch Child Editor would be a good way to sort/find/manage large numbers of children:
  20. @Jonathan Claeys Please provide an example of the code you are using to try and get your media image URL. I haven't used Media Manager, but looking at the documentation for outputting to the front-end there are a couple of things to be aware of: 1. A Media Manager field returns an array (specifically a 'MediaManagerArray') so you need to treat it as such in your template even if it contains only a single media item. The docs suggest looping over it, but if a MediaManagerArray is also a WireArray (the docs aren't specific about that) then you could use other API methods to get items such as first() or get($key). 2. The media itself (an image in your case) is contained in the media property of an individual MediaManager object. So you need to use methods like url or size() on the media property and not on the MediaManager object. Assuming that a MediaManagerArray is a WireArray and that your Media Manager field is called my_media_field: $media_manager_array = $page->my_media_field; $media_manager_object = $media_manager_array->first(); $image_object = $media_manager_object->media; $url = $image_object->url; echo "<img src='$url'>"; This is just to give you the idea, and is more verbose than necessary.
  21. I think you'll find Repeater Matrix provides the best UI for what you want to do. It gives you the flexibility of multiple page (block) types like PageTable but with the convenience of seeing all the block content together within Edit Page.
  22. This is great, thanks. I see now we need to save complete config data not just one field. $this->modules->setModuleConfigData($name, $config); ^ This didn't work for me, but the following did: $this->modules->saveModuleConfigData($name, $config);
  23. Is there a different/better way to do that besides what I'm doing already?
  24. While I don't have much experience with the old approach, I think one of the main differences between the new and the old approach is the way values and defaults are set to the config fields. In the old approach you set defaults in an array and these were merged with user-saved data from the DB into a $data array. And for each inputfield you typically set the value with $data['some_key'] which could be either a default or a user value depending on if that field had a value in the DB . With the new approach the ModuleConfig class takes care of setting the value to the inputfield. It's an added convenience but it also takes it out of your hands if you want do do something out-of-the-ordinary for a particular inputfield. With the new approach, any value you set to the field is only taken as a default that may be overwritten by a user-saved value. In the blog post that introduced the new config class Ryan seems to confirm this: So now that I look at the first example again, I don't think it is this line that makes the checkbox unchecked... $field->attr('checked', ''); ...rather it's the fact that the field value is not set from the $data[] array so it never gets any value from the DB and reverts to the default state for a checkbox (unchecked) on each load of the config page. This wouldn't be possible with the new approach because values are set 'behind the scenes'. Not sure if it constitutes an issue though, maybe just requires a different approach. This is how I've solved it for now, which seems okay: public function init() { // Reset checkbox $data = array('my_checkbox' => ''); $this->modules->saveConfig(get_class($this), $data); }
×
×
  • Create New...