Jump to content

kongondo

PW-Moderators
  • Posts

    7,479
  • Joined

  • Last visited

  • Days Won

    146

Everything posted by kongondo

  1. Fieldtype and Inputfield ImageMarker As of 02 January 2018 ProcessWire versions earlier than 3.x are not supported Version: Stable Project Page: Github Modules Directory: http://mods.pw/Bk OR http://modules.processwire.com/modules/fieldtype-image-marker/ Requires: ProcessWire 2.4 or greater ######################## About This module allows you to easily 'place markers' on an image. Each placed marker's position/coordinates (x and y) are saved in the field as well as the ID of the ProcessWire page the marker refers to. In the backend markers are placed on a specified base image. In the frontend, using each saved page ID you can then retrieve any information you want about the pages being referenced and display that on your website over the same base image you used in the backend. The module is useful for a diverse number of uses including: Product demonstration: place markers on various parts of your product to showcase its features. Using a bit of CSS and/or JavaScript you can create pop-up boxes displaying more information about that feature of the product. The information (in this case, feature), would be information you've stored in some field (e.g. a text field) in the page marker (i.e. the page being referenced by the coordinates). Office locations: place markers on a map showing global offices of a multinational company Points-of-Interest: place markers showing points of interest on a map or location or anything. The coordinates are saved as percentages. This means they will scale well with the image being marked. This module came about as a result of this request. @credits Ryan Cramer: This code borrows from his FieldtypeEvents. @credits Helder Cervantes: Module concept, HTML, CSS, JavaScript. @credits Roland Toth: CSS, Inspiration. API In the frontend, the field returns an array of ImageMarker objects. Each of these has the following properties info (integer): The page ID of the marker (i.e. the page being referenced by the marker. Using this, you can get the referenced page and have access to all its data. infoLabel (String): The title of the page (above) referenced by the marker (runtime only). x (Integer): The x-coordinate of the marker (%). y (Integer): The y-coordinate of the marker (%). You grab the properties as in any other PW field, e.g. $out = '<img src="'. $page->base_image->url . '" alt="">';// image to place markers on 'base_image' is the name of the file field foreach ($page->marker as $m) { // do something with the following properties $m->id;// e.g. $pages->get((int) $m->id); $m->x; $m->y; $m->infoLabel; } // the CSS and HTML are up to you but see InputfieldImageMarker.module for examples Frontend implementation is left to you the developer/designer
  2. Video clip showing latest development...(note: previews of other types other than images are still a work in progress...)
  3. Not sure what's going on with my previous post. I've deleted it...Will update with short video instead...
  4. Sorry I got delayed with other stuff + sluggish coming off the holidays ...I'll put something up tonight or tomorrow morning....
  5. All About ProcessWire Hooks http://processwire.com/api/hooks/
  6. Yeah, that . Wanted to recommend that you look at the ProcessWire docs as well but figured out you are doing that already
  7. Hi @flydev Welcome to ProcessWire and the forums and thanks for using Blog. If all you want is to show the titles, there's no need to call the module itself. The posts are normal ProcessWire pages, so adapting your code like below should work. <div class="col-sm-4"> <h3>Recents</h3> <?php $out ='<ul>'; //$blog = $modules->get('MarkupBlog');// no need for this line //$posts = $pages->find("template=blog-post, limit=5, sort=-blog_date");// if you want to sort by date $posts = $pages->find("template=blog-post, limit=5"); foreach ($posts as $post) { //var_dump($post); $out .= '<li><a href="' . $post->url . '">' . $post->title . '</a></li>'; } $out .= '</ul>'; echo $out; ?> </div>
  8. Happy one to you too! Good stuff!
  9. Show off . Here It's a mild 11°C with almost 25 mph wind Happy new year!
  10. I doubt auto loading of resources will work with extending WireData Many modules (including Blog, Padloper, etc) are actually several modules bundled together, each fulfilling their specific role. So, that's OK, if you want to go that route. The important thing is to indicate which module requires which one and which one installs which one (if you wish, i.e., otherwise user installs each on its own). There's is no magic in respect of getting any module's config other than using what PW already provides: $anyModuleConfigs = wire('modules')->getModuleConfigData('AnyModuleClassName'); You can call that from anywhere, including in template files. It returns an array. It will be empty if there is no config data. https://processwire.com/talk/topic/648-storing-module-config-using-api/?p=5241 https://processwire.com/talk/topic/3343-how-can-i-setget-module-data-from-db-when-not-implementing-configurablemodule/?p=33087
  11. What @Martijn said....but I'll attempt a guess If you are talking about a HTML class to add to your uploaded images (uploaded in a page edit session) to target with your CSS, ProcessWire doesn't output markup so you will have to add those on your own at runtime, e.g. $out = ''; if(count($page->images)) { foreach($page->images as $image) $out.= '<img src="' . $image->url . '" class="myImageClass">'; } echo $out; If you are talking about images you insert in the RTE, you can use the RTE to add your classes Welcome to PW and the forums
  12. http://modules.processwire.com/modules/process-hanna-code/ I am guessing your HC exists on the page with ID 1187? So it will always evaluate to true. Use wire('page') to refer to pages originating the request.
  13. It will only auto-load if in your module's init method you call parent::init(); then your code after that. The other conditions have to be true as well, i.e. the resources have to be in the same directory as the module and they have to be named as: MyModuleName.module MyModuleName.js MyModuleName.css What class is your module extending? I don't think the above works with all module types
  14. Have a read here: http://processwire.com/api/fieldtypes/repeaters/ And this post: https://processwire.com/talk/topic/4442-pw-performance-with-hundreds-of-fields/?p=43643
  15. Not quite.... Nope. Not really.... The most important thing to remember about repeaters is that behind the scenes, they are actually real pages (see /admin/repeaters). Not unlike the recommendation to be cautious with $page->children, if you have too many repeaters (and especially with lots of fields), you will be loading all of them into memory when you call the repeater. With $page->children, you can at least do $page->children('limit=20'); So, the issue is about memory/efficiency. Nothing to do with MySQL (which can easily handle millions of rows - of course, we don't load all of these into memory at once ). In conclusion, repeaters do not scale infinitely...
  16. Sorted! Just add a value attribute $myModuleConfigs = wire('modules')->getModuleConfigData('YourModuleClassName'); $savedPageID= (int) $myModuleConfigs['selected'];// name of our input above (see my previous code => $p) $parentAdd->attr('value', $savedPageID);// (int) Saved paged ID #$parentAdd->value = $savedPageID;// alternative way to set For completeness, here's the full working code $form = new InputfieldWrapper(); $parentId = wire('pages')->get('/')->id; // pagelistselects $parentAdd = wire('modules')->get('InputfieldPageListSelect'); $parentAdd->label = __('Parent Page'); $parentAdd->attr('name+id', 'selected'); $parentAdd->set('parent_id', $parentId); $parentAdd->set('startLabel', __('Parent Page')); $data = wire('modules')->getModuleConfigData('YourModuleClassName'); $savedPageID = (int) $data['selected'];// name of our input above $parentAdd->attr('value', $savedPageID);// (int) Saved paged ID #$parentAdd->value = $savedPageID;// alternative way to set $form->add($parentAdd);
  17. I tested with Blog module settings and it works (the saving bit) but couldn't figure out how to tell it to show the label of what's saved...I had a look at how this is done in page fields but the rabbit hole was too deep so turned back
  18. I'd never heard of Cargo before today . What's that famous effect? It seems you are talking about ajax loading....
  19. Hmm...I can't find such a property. Not sure if the select label is coming from JS...
  20. Are you sure its not saving? Un-selection is different from not saved ....Can you confirm by looking into the module's data field in the database? As for selection of saved data, I think there is a property for setting that but I can't find it now. You have to tell the module what is selected (saved) I believe. Let me see if I can find the property...
  21. This works for me //create the config screen $form = new InputfieldWrapper(); $p = 'selected'; $parentId = wire('pages')->get('/')->id; //pagelistselects $parentAdd = wire('modules')->get('InputfieldPageListSelect'); $parentAdd->label = __('Parent Page'); $parentAdd->attr('name+id', $p); $parentAdd->set('parent_id', $parentId); $parentAdd->set('startLabel', __('Parent Page')); $form->add($parentAdd);
  22. Drop the www and use https://, http:// or none of these
×
×
  • Create New...