Jump to content

kongondo

PW-Moderators
  • Posts

    7,529
  • Joined

  • Last visited

  • Days Won

    160

Everything posted by kongondo

  1. ...and in the documentation as well: http://processwire.com/api/selectors/#or-groups Edit: sorry, this is a different matter; ignore my post...
  2. MuchDev does credit Soma though...but instead of re-posting the script, could have just linked to it
  3. Lars, use this search tool instead: Search for 'staging' OR 'moving'...etc...There's quite a number of discussions on this already
  4. Update: version 0.1.0 Cleaned-up HTML output by MarkupMenuBuilder, thanks to @David Karich ( + added tab indentation for cleaner markup). Note that for included children things may not always align up properly with their parent/native MB menus Merged all latest changes in dev to master
  5. @Nico....Nope...everyone couldn't; but now they can after Pete's changes
  6. @Soma...Yes, I have. See my edited post above ....we posted at the same time...
  7. Post Edited: See below; I now see the issue and working to fix it asap... I am not seeing that here at all. By current version, are you referring to the dev version 0.0.9? Here's what I see in Chrome and Firefox... Chrome Firefox Edit: OK, Now I see it in "view source"...Web devs are prettifying it I guess. I am baffled by this one. Let me investigate, thanks.
  8. Wish: Nico, maybe remove the closing PHP tag in the generated file? Thanks
  9. Nice one Nico! Moved this to 'dev' instead....in fact don't know why it is off-topic at all? Better in Module/Plugin Development?
  10. I suppose you can, given that the module is still in Alpha. You would then make an announcement here (and especially in your first post). I would also recommend you polish up the readme a bit ....just a little bit about what the module does (I know we 'all' know about captcha...but nice touch to say what your module does all the same). Thanks!
  11. Naming Conventions: Have a look at these: https://processwire.com/talk/topic/2394-how-to-present-your-module/ http://processwire.com/api/modules/ That is what Horst meant by: Note though that the class name still has to be...ClassName..., i.e. just the way you've named yours.. Directory structure... ....should be fine. PW will automatically create a directory named after the module class (ProcessMakeCoffee) when that module is installed if you've submitted it to the modules' directory. Otherwise, the normal instruction is for your users to create the directory if manually installing the module....Have a look at the GitHub project pages of some of the modules in the modules' directory..e..g. https://github.com/ryancramerdesign/FieldtypeEvents https://github.com/somatonic/MarkupSimpleNavigation https://github.com/horst-n/WireMailSmtp
  12. @markoj, Glad you got it sorted. Yes, MB caters for some very specific needs. Btw, if you haven't seen it already, there is an intro to PW for those with a similar CMS background to yours
  13. @markoj, You can pass attribute=value pairs to HC. There is a nice example here: https://processwire.com/talk/topic/1182-module-image-tags/#entry40015 In my example, I assumed you were including 'Blog' as an external page. There is an option in MB to open external links in new tabs if you insist on using it OK, back to your question...In the following example, we pass a title to HC to find a page with that title and return its first image from an image field called 'gallery_preview_image'. To test this, use this code to import the HC code....(see the import button when viewing your list of HCs). !HannaCode:images:eyJuYW1lIjoiaW1hZ2VzIiwidHlwZSI6IjIiLCJjb2RlIjoiXC8qaGNfYXR0clxucz1cIlwiXG5oY19hdHRyKlwvXG48P3BocFxuXG4kc2VsID0gJHMgPyBcInRpdGxlPSRzLCB0ZW1wbGF0ZT1tZW51X2ltYWdlXCIgOiAnJztcblxuaWYgKCRzZWwpIHtcblxuICAgICRwID0gd2lyZSgncGFnZXMnKS0+Z2V0KCRzZWwpO1xuICAgICRpbWFnZSA9ICRwLT5nYWxsZXJ5X3ByZXZpZXdfaW1hZ2UtPmZpcnN0KDApLT51cmw7XG4gICAgJGltYWdlID0gXCI8aW1nIHNyYz0nJGltYWdlJz5cIjtcblxufVxuXG5lbHNlIHtcblxuICAgICRpbWFnZSA9ICcnO1xufVxuXG5lY2hvICRpbWFnZTsifQ==/!HannaCode That should give you code like this (plus populate your HC's attributes field in the Basics tab with s) <?php $sel = $s ? "title=$s, template=menu_image" : ''; if ($sel) { $p = wire('pages')->get($sel); $image = $p->gallery_preview_image->first(0)->url; $image = "<img src='$image'>"; } else { $image = ''; } echo $image; Then, in your MB pass your menu item's page's titles to HC like so: I haven't included your 'Blog' page in this example but you can do that easily. However, irrespective of whether it is an external (i.e. non-PW page) or internal, its image will have to live somewhere on your site.
  14. Well this is simply not true. You use $page for getting the current page and $pages for getting any other page(s)...
  15. I suggest you carefully study and bookmark/reference this table. It is an invaluable reference that will teach/remind you when to use/not use isset, empty, is_null, etc.. PHP type comparison tables http://php.net/manual/en/types.comparisons.php As for you image, I think I already answered you question but I'll repeat it here: If it is a single image field [an image field with a maximum files allowed of 1] if($page-img) {} if it is a multiple image field [an image filed with maximum files allowed of 0 or > 1, even if it contains only one image in your page] if(count($page->img)){}
  16. If field can contain only one value or a string... if($page->title) echo $page->title; If field can contain multiple values, e.g. a multiple image field or multiple page field (i.e. contain arrays) if(count($page->images)) echo "we have images. Let's foreach them"; https://processwire.com/talk/topic/2239-how-to-test-for-empty-fields/ https://processwire.com/talk/topic/546-how-to-detect-an-empty-field/ https://processwire.com/talk/topic/8067-cant-detect-empty-field/ https://processwire.com/talk/topic/957-how-to-find-elements-with-empty-field/ https://processwire.com/talk/topic/8850-check-if-a-datetime-field-is-empty-does-not-work/ https://processwire.com/talk/topic/4177-checking-for-empty-textarea-field/ https://processwire.com/talk/topic/3050-checking-for-a-field-if-else/ etc....
  17. Has Raymond's technique been submitted to the PW Recipe's yet?
  18. There you go...two for the price of one
  19. Hi markoj, First welcome to PW and the forums! Yes, that's possible. MB allows you to 'allow HTML in menu items title'. See that option when editing your menu under the tab 'main'. You would need to be a superuser or have the permission 'menu-builder-allow-markup' in order to set and use that option. Secondly, your 'Ditto' in this case would be Hanna Code: https://processwire.com/talk/topic/3745-hanna-code http://mods.pw/4b Install the module. Otherwise, if you included your whole HTML in your menu item's title in MB, it won't look pretty and the HTML will be rendered. The <h1> would be especially ugly there .. I don't know where your images will be coming from but in this example, I assume they are saved in some page with an image field called 'img' OK, once you've installed HC module (taking care to follow all the instructions, create a Hanna Code of type PHP. Let's call it 'test'. Add the following code to it. This is just example code; $p = wire('pages')->get(1317); #$out = $p->img->first()->size(0,50)->url; $out = $p->img->eq(0)->size(0,50)->url; $out = "<img src='$out'>"; echo $out; Here we assume your images are stored in a field called 'img' and that field allows multiple images. We assume that field is populated in a page with ID 1317. We are also grabbing the first image and resizing it. Save the HC. Head over to MB (assuming you've installed the module). Create a menu and enable 'allow HTML...' as I described above. Add at least one menu item to your menu. Enter something the below in your menu item's title. We assume the title is called 'Blog'. [[test]]<span>Blog</span> Here we use span for convenience, otherwise <h1> will be rendered in the menu title drag and drop handle (hacky I know). We'll replace the <span> with <h1) at runtime. In your template file you could render your menu as follows: //get MB $menu = $modules->get('MarkupMenuBuilder'); $out = $menu->render('My Menu Title', $options);//holds rendered menu //get hanna code $hanna = $modules->get('TextformatterHannaCode'); //render the [[test]] HC + replace <span> with <h1> echo $hanna->render(str_replace('span', 'h1', $menu->render($m, $options))); See MB's documentation about what you can pass to $options (e.g. you may not wish to use <ul> and <li> in your menu. This is just a quick example. Maybe things could be done better.. ....And you probably want to edit this menu yourself...clients will probably be confused with [[test]]Blog
  20. Adrian, no offence meant, but did you actually search?
  21. Update: version 0.0.9 Fixed the issue whereby 'current_class_level' was not being correctly applied in cases where 'current_class' is applied beyond included children into native MB menu items. In dev branch for now.
  22. I always use bundle version - I view the whole thing as one package and also don't want to confuse users...In my commit I enter notes to specify if a version bump 'was just to keep up with updated module xx'. But am not saying this is the 'correct way'
  23. Pete would definitely know...so let's wait for his input
  24. So in Full Editor you don't see this?
×
×
  • Create New...