Jump to content

Search the Community

Showing results for tags 'Module'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

  1. I made a calendar view page in the admin using AdminCustomPages module, but since I want to add more functionality to it I am trying to make it (the calendar) its own module... So I have a module ProcessKalendar that extends Process and implements Module, ConfigurableModule. It creates the Kalendar page on installation and currently just outputs the input of the one config field for the module on that page on execution. I need to add scripts and stylesheets... How do I do this within the module?
  2. if someone can check I have done this right, I would be obliged as I ain't no module developer! This is a very simple text formatter that looks for @ and # and adds the appropriate links to twitter. So, @profile will become http://www.twitter.com/profile and #searchterm will become http://twitter.com/search?q=searchterm It uses preg_replace as a quick and dirty solution rather than the Twitter API - so no apps need to be created and so on. https://github.com/jsanglier/TextformaterTwitterReplace Obviously, if you use @something and #something regularly and DONT want them linked, then this is useless for you. But quite nice for blogging purposes Unsolicited thanks to Netcarver because I nicked one of his modules to work out how to do it Joss
  3. Hi. I made a little module a while ago to track pageviews. It stores each pageview record as a PW page (hidden, under a hidden parent page "ViewTracker"), with the user & page IDs and timestamp. <?php /** * Processwire ProcessViewtracker Module * * ProcessWire 2.5.3 * Copyright (C) 2014 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * http://processwire.com * */ /* TO-DO: - add settings: templates select, clear/archive option..? - add auto-creation of templates/fields on install */ class ProcessViewtracker extends WireData implements Module { /** * getModuleInfo is a module required by all modules to tell ProcessWire about them * * @return array * */ public static function getModuleInfo() { return array( 'title' => 'ViewTracker', 'version' => 1, 'summary' => 'Records pageviews.', 'href' => '', 'singular' => true, 'autoload' => true, 'icon' => 'eye', ); } public function init() { // add a hook after each page is rendered $this->addHookAfter('Page::render', $this, 'viewTracker'); } /** * ViewTracker hooks into every page after it's rendered and records the views for specified template(s) * (and adds "Hello World" text at the bottom) * */ public function viewTracker($event) { $page = $event->object; // don't add this to the admin pages if($page->template == 'admin') return; // add to selected templates if($page->template == 'vessel') { // create record $r = new Page(); $r->template = 'pageview'; $r->parent = wire('pages')->get('/viewtracker/'); $r->user = $this->user; $r->vessel_id = $page; $r->name = $this->user . $page . date('YmdHisu'); $r->status = $r->status | Page::statusHidden; $r->save(); // record if segment if($this->input->urlSegment(1) !== '') { //$segment = "$this->input->urlSegment(1)"; $this->sanitizer->text($this->input->urlSegment(1)); $r->page_segment = "{$this->input->urlSegment(1)}"; $r->save(); } $event->return = str_replace("</body>", "<p>Hello {$this->input->urlSegment(1)} World!</p></body>", $event->return); } } } I want to add a configuration option for choosing the template(s) this module should activate for, maybe an admin view, but for right now this is all I got, so that the view data can be pulled easily. I know PW can handle a great many pages, but like I've kept this module uninstalled when not developing it... though maybe if I'd just left it enabled I'd have an answer to my own question here. Because tracking page views compiles much more quickly than any other sort of page, really... Should I just be storing this data in its own table?
  4. Hello everybody, our next module is an performant manipulator for Pageimages. It is called GIM. GIM is basically a wrapper for the PHP library Gregwar's image class, which performs many image manipulations. The wrapper is written in a way that is compatible with Horst's PageImageManipulator's (PIM) syntax. How does it work? GIM extends ProcessWire's Pageimage objects. You can load every image with the method gim(), perform some operations and save the image with the save() method: $image = $page->image->gim()->grayscale()->save(); The save() method returns another Pageimage object, so you can use it with other native ProcessWire methods and hooks. Methods GIM includes a lot of methods for image manipulations. You can find them in more detail on our module page. You can crop, resize, flip and rotate the image in several ways You can apply filters like sepia to the image You can add texts and shapes to the image You can merge multiple images in multiple ways Compatibility with Horst's PageImageManipulator (PIM) You can just use GIM instead of PIM by replacing pim with gim: $image1 = $page->image->pimLoad('prefix') ->setOptions(array('outputFormat'=>'jpg')) ->brightness(-10) ->contrast(15) ->grayscale() ->width(600) ->pimSave(); // uses PageImageManipulator $image2 = $page->image->gimLoad('prefix') ->setOptions(array('outputFormat'=>'jpg')) ->brightness(-10) ->contrast(15) ->grayscale() ->width(600) ->gimSave(); // uses GIM GIM includes every method from PIM, so it just works. Also GIM and PIM share the same variation naming scheme, so when you start using GIM, the transition is seamless and does not need to recreate every image. Having the same naming schemes means, that GIM and PIM can also work side-by-side. For a full list of compatibility and migration notes, please check out our module page. Performance The reason why we created GIM is that we were looking for a more performant PHP image library for converting lots of images at once. After using Gregwar's image class for a few images, we thought that this library should find its way into ProcessWire. After testing GIM on a few sites, this is what we found out: GIM handles already manipulated images around 40% faster GIM is able to heavily manipulate at least 15 large images (> 2000px) in one request (more weren't tested yet) GIM is slightly faster than PIM for single image operations I hope this is a great addition to the ProcessWire module ecosystem and you can enjoy it. Thanks in advance, Marvin P.S.: Horst, I hope you don't see this as offense. PIM is a great module!
  5. Hi, I want to write up a module that upon installation generates my site fields, templates, and roles... What hook do I use? This is a better approach than simply exporting a Site Profile, no? Thanks...
  6. This module displays tutorials according to the page where you are (based on intro.js). It also displays useful links. It is in process. Suggestions and reviews are welcome. To test the module go to modules or pagelist after install. Done: - PageList - Modules To Do: - Access -User, Roles, Permissions - Setup -Templates -Fields -Languages -PageEdit -Search Github
  7. Hi all, I was trying to add an image field to `implements Module, ConfigurableModule ` . When uploading image I was getting error as TemplateFile: Invalid image<pre>#0 [internal function]: InputfieldFile->___processInputAddFile('fdd-1.jpg') #1 public static function getModuleConfigInputfields(array $data) { $inputfields = new InputfieldWrapper(); // $field = wire('modules')->get('InputfieldImage'); // $field->attr('name', 'logo'); // $field->label = __('Logo'); // $field->addOption('logo', 'logo'); // $field->attr('value', isset($data['logo']) ? $data['logo'] : ''); $field = wire('modules')->get('InputfieldFile'); $field->attr('name', 'logo'); $field->label = __('Logo'); $inputfields->add($field); return $inputfields; } I tried with file which gives me invalid extensions. Is there a way to fix it ? Basic idea is to extend a template which can have upload functionality of logo etc. Thank you.
  8. Not sure i think its a good plan, but I was wondering what people thought about team PW making say having 4 people working on one site locally and how to keep copies up to date, or is this something that PW doesnt have problems with? for example Drupal has a features module: https://www.drupal.org/project/features just wondered what peoples thoughts were on this
  9. Markup Cross-Fade On Github. In the Module Repository. Thanks to the good people at Lightning.pw for hosting the demo for free! Demo no longer available. A full-screen cross-fading background animation module with optional, per-slide, overlay text. It's based on an article by Mary Lou over on codrops. Here's the home.php template code for the entire site... <?php $cf = wire('modules')->get('MarkupCrossfade'); $settings = array( 'pages' => wire('pages')->get("template=slides")->children(), 'title_xforms' => "scale(1.0) translateY(300px)\nscale(1.0)\nscale(1.0)\ntranslateY(300px)", ); ?><html lang="en"> <head> <meta charset="utf-8"> <title>MarkupCrossfade Demo</title> <style> @font-face { font-family: 'BebasNeueRegular'; src: url('<?php echo wire('config')->urls->assets; ?>fonts/BebasNeue-webfont.eot'); src: url('<?php echo wire('config')->urls->assets; ?>fonts/BebasNeue-webfont.ttf') format('truetype'); font-weight: normal; font-style: normal; } body { background-color: #333; overflow-x: hidden; padding: 0; border: 0; margin: 0; } <?php echo $cf->renderCss($settings); ?> .markup-crossfade li div h3 { font-family: 'BebasNeueRegular', 'Arial Narrow', Arial, sans-serif; font-size: 80px; letter-spacing: 2px; } </style> </head> <body> <?php echo $cf->renderHtml($settings); ?> </body> </html> The only other work involved was adding a 'slides' and a 'slide' template ('slides' having children of template 'slide') and adding an image field called 'image' (NB. not "images"), a text/textarea called 'body' and a required integer field called 'duration' to the slide template. Add a parent to the page tree called 'slides' using template 'slides' and add as many manually sorted children as you need, setting the image, body text and duration for each. After that, the only thing left to do was to upload BebasNeue from fontsquirrel to 'assets/fonts'. That's it. There are a number of parameters you can configure and pass in to the render methods. Here's the list of settings and their defaults taken straight from the source code... array( 'pages' => $pages, // WireArray of pages defining the slides of the slideshow. 'duration_field' => 'duration', // Field of the slide page that provides the duration (in seconds) 'overlay_field' => 'body', // Field of the slide page that provides the overlay text 'image_field' => 'image', // Field of the slide page that provides the image (url) 'title_xform_field' => '', // Textarea field of the slide page that provides the title transformations 'image_xform_field' => '', // Textarea field of the slide page that provides the image transformations 'title_xforms' => '', // Default title transformations - one per line (\n separator please) - leave blank for none. 'image_xforms' => '', // Default image transformations - one per line (\n separator please) - leave blank for none. 'html_class' => 'markup-crossfade', // What class to apply to the owning list 'z_index' => '-10', // z-index of slideshow container and its spans 'li_id' => 'slide_', // What id to use for each slide. The slide # will be appended to this 'browsers' => array( // Array of browsers extensions to render CSS for '', '-webkit-', '-moz-', '-o-', '-ms-' ), 'skip_css' => false, // only generate the keyframes, don't output a modified copy of the module's static css file. 'mask_image' => '', // location of mask image relative to the site root. Leave blank if none. ); In order to use per-slide image and/or title transformations you need to add either one or two textarea fields to your slide templates. Each textarea should have a maximum of five lines of text. Each line of text is used to define the transformation(s) applied at each of the 5 stages of the animation that gets generated. The following (used for the global title animation on the demo site)... scale(1.0) translateY(300px) scale(1.0) scale(1.0) translateY(300px) ...defines the start keyframe with the title scaled at 1.0 and translated along the Y axis by 300px. The next keyframe is not translated so the browser animates it up into the visible area. It stays there in the next frame and is animated back out in the fourth frame. The skip_css setting lets the renderCss() method know if it should include its default css scaffolding file (included with the module) in the output. If set to true, only the CSS for the actual animations is output and you'll have to supply your own scaffolding CSS in your page templates. Whilst this works great in Chrome on linux, could you let me know what the experience is like for you on your OS/Browser combination. Thank you!
  10. Hi everyone. I'm newbie to ProcessWire. I need to export particular page's data (including custom fields and children pages) as XML. What is the best approach for that using ProcessWire API? Do I need to write a module for that? Ideally (for simplicity) I'd like to create just one file which could include everything necessary to call ProcessWire API to fetch data and create XML. Then I can call something like http://mywebsite.com/import.php to import data...
  11. Hey, after reading woop.s pdf over http://lightning.pw): Login: http://terbium-znu.lightningpw.com/processwire/ Name: demo Pass: demo123
  12. Validation Module for ProcessWire, Validation module using GUMP standalone PHP data validation and filtering class. That makes validating any data easy and painless without the reliance on a framework. Usage almost same with original GUMP validation class. Extended original validation class for make it multi-language and added 2 new function 1 for field labels, 1 for set and get fields. Module Link
  13. I don't now if this is already possible to build with one of the available modules/fieldtypes. I so far tried Table, PageTable, Repeater and Multiplier but couldn't get them work exactly as I want. I'm looking for a way to create a matrix/table that uses the children of two pages to build the row and column headers. In my case (an online shop), I want it to take the children of the page product variants and the children of the page currencies. In the end, it should render a matrix/table, where I can enter a fixed price for every variant in every currency. Has anyone ever done something similar? Is there a fieldtype for this?
  14. A module that uses the db-ip.com IP Geolocation service to fetch geolocation information when given an IP address. I wrote this quickly to help anyone who might be stuck with the #VATMOSS mess and need a way to geo-locate a customer's IP address. You will need to register with db-ip.com in order to get an api key but they have a pretty generous daily-query allowance even for the free key (2000 lookups a day.) Here it is on github. And in the module repository.
  15. Please note: This post refers to a commercial package for PHP that includes a module for ProcessWire. If you have to deal with name data on a day-to-day basis then you know what a mess people can make of typing names. If your business prides itself on good formatting – for stationary, labels, email or nametags – then the English Name Sanitiser package for PHP & Processwire can help you keep things well formatted. Background About five years ago I got involved with selling books online via various storefronts such as Amazon, Play, Abebooks and Alibris. Day after day we'd get orders from customers and, quite frankly, the formatting of the Ship-to name field was a mess. A big mess. Some people typed "jenny smith", others "JANE DOE", some "jASON yARDLEY" and still others would write "No invoice" after their name. A few actually formatted their names right. As a business that prided itself on neat formatting of our postage labels - and because dealing with customers and the local post-office about missing parcels is a pain - I decided to start sanitising incoming names to not only make them look good to the customer when they received them but also to make the names and addresses as clearly and unambiguously readable as possible for postal workers. I initially thought that it would be an easy problem to fix - just run each name through mb_convert_case() but it turned out to be a more difficult than anticipated as PHP's methods of converting case handles several situations in a pretty unsatisfactory manner; names like McGregor or O'Donnel, company names and names with missing spaces following punctuation ("john h.jones" etc.) Here's a quick comparison of how PHP and the NameSanitiser do with some problem names... (The whole list is available under the "Tell Me More" button on QBox.co) Over four years later I've decided to release the English Name Sanitiser as a commercial offering that makes it easy to format English names (it includes a PW Textformatter.) The package itself includes a stand-alone sanitisation file that you can use in other PHP projects so it is in no way limited to just PW installations. Licenses are available for individual sites, developers or agencies/institutions and, as I still sell books via Amazon and use this package in my sales system, it is being actively maintained. Visit QBox.co now to learn more.
  16. Introducing PVC PvcCore: https://github.com/oliverwehn/PvcCore/ PvcRendererTwig: https://github.com/oliverwehn/PvcRendererTwig/ (coming soon) PvcGenerator: https://github.com/oliverwehn/PvcGenerator/ (coming soon) Each time I’ve built a ProcessWire page I’ve struggled with organizing (and separating) code, markup and stuff. Playing around with frameworks (backend as well as frontend) like Rails, Ember and stuff I really liked having a given structure, knowing where to put what piece of code. Therefor I started working on a MVCish way to deal with templates in PW that considers the $page object kind of the data/model layer and adds View and Controller upon it. First by just catching everything via a small processor file added to all PW templates as altFilename. I’ve digged a bit deeper since then and hooked into the native rendering process, have been refactoring my code base more than a dozen times. Now I got a first version that seem to work and I’d love some of you guys to try it out! PVC (instead of MVC) stands for Page-View-Controller, as it considers PW’s $page var the model/data layer. I’m still working on the README.md on GitHub to document the basics. So have a look for more detailed infos there. I’ll give you a short overview here: Code separation: PVC introduces views and controllers to your PW templates as well as multiple action templates. Controllers, as most of you already know, keep all the business logic. Controllers execute actions wired to routes (urlSegment patterns). Even routes with dynamic segements (e.g. /edit/:id/) can be defined and assigned to an action, providing input through $this->input->route. Values can be set on the controller to be accessable in your templates later on. It’s also possible to set dynamic values as closures to be calculated (e.g. using field values of the current page) on render. Also controllers allow you to set layouts, styles and scripts to be available in your layout or template. Logic can be shared through inheritance between controllers. Views introduce view helpers. Helpers are functions that are made available to you (only) within your template context. There are predefined ones like embed(), snippet(), styles() or scripts(). But you can implement your own helpers easily and share them among your view classes through inheritance. Action templates contain the actual markup. Every action defined in a controller uses its own template. So the same page can display content accordingly to the action that was addressed via urlSegments/route. Within templates you can access all field values and values set on your controller like globals (e.g. <?=$title?>). Modular renderers: PVC implements rendering through separate renderer modules. PvcCore comes with PvcRendererNative that gives you template syntax the good ol’ PW/PHP way. A Twig renderer is in the making. And maybe you want to build your own renderer for the template syntax of your choice? I consider the module an early Beta version. So make sure to try it within a save environment! Would love to get some feedback (and error reports). I’m no professional developer, so code quality may suck here and there. So I’m glad for inputs on that, too. Also there is some old stuff in there yet, I still have to get rid of.
  17. Module for admin and front-end resizing and rasterizing of vector SVG images Requirements IMPORTANT: This module requires Imagemagick and the pecl imagick extension. For anything but simple SVGs, you must make sure imagemagick was compiled with a relatively recent version of rsvg (I know that 2.32.1 works well and presumably anything more recent should also be fine). If you don't manage your own server and the results are not good, check with your host. If everything is set up correctly, the rendered PNGs will be "perfect" representations of the SVGs. See this post below for just how much of a difference rsvg can make. How to use You must add SVG as an allowed file type for a multiple images field. Check the module configuration for a variety of settings for both PNG and JPG output options. In particular be aware of the Rasterized Images Field selector. If you choose "None" only the SVG will be stored in the images field. You can still access rasterized versions via the rasterize() method - see below for details. NB: You need to be running a recent dev version (or 2.4 stable once available) of Processwire that supports field dependencies for the configuration settings to work as expected. Once the module configuration settings are completed: Upload an SVG image and the module will create a rasterized version. You need to save the page to see the rasterized version which can then be accessed via the API like any other image. The module also adds a new method: rasterize() which can be called from your templates like: $image->rasterize(200,0)->url This method optionally resizes the vector version of the image and then rasterizes it so you can scale it infinitely and there will be no loss of quality. Make sure you point it to the svg version in your images field. Modules Directory: http://modules.processwire.com/modules/image-rasterizer/ Github: https://github.com/adrianbj/ImageRasterizer
  18. Module In Progress... working on an Inputfield which will allow the updating of the select description (for contextual description of the actual selected item) based on the selected option. This module is/was mostly written by netcarver, so i'm just getting the details together and some jquery for this to work... https://processwire.com/talk/topic/419-extending-inputfields/?p=76823 i'm thinking that the module title should probably be more specific?, like InputfieldSelectDataDescription... in case there were other 'extended' interpretations...? module so far: <?php class InputfieldSelectExtended extends InputfieldSelect { public static function getModuleInfo() { return array( 'title' => __('Select Extended', __FILE__), 'version' => 1, 'summary' => __('Selection with extended attributes. An enhancement to select', __FILE__), 'permanent' => false, ); } /** * inputfield is loaded */ public function init() { // append script needed for the inputfield $this->config->scripts->add($this->config->urls->InputfieldSelectExtended . 'InputfieldSelectExtended.js'); } /** * Adds an option with extended attributes that allow mutually exclusive groups. */ public function addOption($value, $label = null, array $attributes = null) { if ( is_null($value) || (is_string($value) && !strlen($value)) ) { return $this; } if (null === $attributes) { $attributes = array(); } $extra_atts = $this->extendAttributes($value, $label); $attributes = array_merge($attributes, $extra_atts); return parent::addOption($value, $label, $attributes); } /** * Hook this and return an array with whatever extended attributes you need. * */ public function ___extendAttributes($id, $value) { $atts = array(); $page = wire()->pages->get($id); $atts['data-description'] = $page->data_description; return $atts; } } the js, so far - works, but doesn't account for multiple selects yet. InputfieldSelectExtended/InputfieldSelectExtended.js $(document).ready(function() { var $default = $('.InputfieldSelectExtended').prev('p.description').html(); $('.InputfieldSelectExtended select').change(function(){ var $selected = $(this).find(':selected'); var $description = $('.InputfieldSelectExtended').prev('p.description'); if($selected.data('description') == null ) $($description).html($default); $($description).html($selected.data('description')); }).trigger('change'); }); once installed you would need to add this inputfield to the list; then select the inputfield on your page field your selectable pages would need a data_description field. here is the result, before option selected: after select: i guess once i get the module more advanced, there would be a way to get some of these things automatically setup.. also - for this to work, you need to set a description for the page select field, so there is something to replace...
  19. Hi - I was able to read id3 tags from audio files very easily using this library and the api, but now i'm stuck trying to get this to work inside a module; in my api test, i just did this: $templates = $config->paths->templates; require_once("{$templates}tools/getid3/getid3.php"); $getID3 = new getID3; $album = $pages->get(2130); foreach($album->children as $track) { $audio = $track->audio_file_p; // Analyze file and store returned data in $track->tags $track->tags = $getID3->analyze($audio->filename); echo $track->tags['tags']['id3v2']['title'][0]; echo $track->tags['tags']['id3v2']['artist'][0]; echo $track->tags['tags']['id3v2']['track_number'][0]; echo $track->tags['audio']['bitrate']; echo $track->tags['playtime_string']; } but now in trying to get this to work inside a module, i can't get the id3 to return the array, not sure what I'm doing wrong... this code is within a method that runs on a saveReady hook: <?php require_once(dirname(__FILE__) . '/getid3.php'); $getID3 = new getID3; $file = $page->audio_files->first(); $tags = $getID3->analyze($file->filename); $title = $tags['tags']['id3v2']['title'][0]; $this->message($title); I did a print_r into a spare field on the $page but it only returned the number 1.. i guess there is something that isn't quite right about the file path or the way the classes are working together? thanks!
  20. Hi, today I started and finished work on my new module "TextboxList". It includes "FieldtypeTextboxList" and "InputtypeTextboxList". The main function is to create inputfields like Facebook when you have to insert the name of your friend (see the screenshot below). It automatically creates a new "box" if you press "," or "enter". The result will be saved as a comma-separated list. It is based on the TextboxList.js of Guillermo Rauch so I wouldn't use this for a commercial project right now. (But I wrote him a mail if he would allow this). I changed the color schema so it looks like a native element. I recommend to use it if you have something like a tag list (like: bla, christmas, bla, 2011, bla, ...). You can download it here: https://github.com/N...oll/TextboxList Have fun with it! Greets, Nico
  21. (Note: Module name temporary and will change) As recently mentioned here I am recently working on a little module. This module gives you a new admin page under "Setup" to create pages in a "batch" mode. What does it do - You can select a parent page where you want to create your pages. Then it will give you a list of templates you can chose from. Those should be permission and template setting aware. Also only parents that really can have children will work, else it will give an alert. - Add as many pages you like by clicking "+add Page". You can set the pages published or hidden status. Sort or remove the pages. - After you entered a template and at least a title you'll be able to klick "create Pages". If successful it will append the list of pages you just created with an open in page tree or edit link, and also the parent. - You can add pages and repeat the process to add pages to the pages you created simply by changing the parent page in the field above the table and go on. It's all ajax and not page load. Also the links of the created pages that get appended below will stay in the document and only the form entries get cleared. This is still work in progress, but I thought enough to share and if you like you can try/test/use it. Download: ProcessTools.zip Screen:
  22. Hi, I'm trying to work out how to create new permissions, and also to check for them before installation. I can't seem to find any info on how to do this. So far I have the following code to create a new permission: $pm = new Permission(); $pm->name = 'new-permission'; $pm->title = 'A test permission?'; $pm = $pm->save(); Not sure if that's the right way to do it? Now to check if the permission already exists before installation, I use the following but it's returning true even when the permission doesn't exist. if($this->permissions->get('new-permission')) throw new WireException("The 'Permission already exists"); I know I'm probably doesn't something stupid, but I have no code to reference for this.
  23. Hi, I'm trying to create a template for a module I'm working on. The page that uses this template will be used specifically as a category to hold other pages. For this reason, I don't need to add any extra fields to it, other than the title, and obviously the name. But I can't seem to figure out how to do it. I've tried the following, but it complains about needing a field. $template_category = new Template(); $template_category->name = 'template_category'; $template_category = $template_category->save(); Any help appreciated.
  24. During module development I've recognized a strange behaviour. Logfile entries in errors.txt and messages.txt are always created twice. This happened on different servers in different environments with different modules. I tested it with this small module: <?php class Debug extends WireData implements Module { public function init() { $this->message(microtime(),Notice::logOnly); // same with $this->error() } } /*log file entries: * 2014-11-07 05:52:14 admin [...]/admin/module/ 0.43575100 1415335934 * 2014-11-07 05:52:14 admin [...]/admin/module/ 0.43575100 1415335934 */ whereas only a simple entry is generated when I provoke an error an catch it to log with exception handling. <?php class Debug extends WireData implements Module { public function init() { try { foo($bar); } catch(Exception $e) { $this->error($e->getMessage(), Notice::log); } } } /*log file entry: * 2014-11-07 12:45:19 admin [...]/admin/module/ Error: Call to undefined function foo() (line 16 of [...]/site/modules/Debug.module) */ Happened this before anywhere? Any Experiences with that? Any Ideas? Couldn't find out the reason for that!
  25. What is the best way to manage larger amounts of constantly necessary static data. I.e. Countries and there depending states and the cities in those states with their postal codes which needs to also translatable into different languages. I.e. Germany, Deutschland, Allemagne, ประเทศเยอรมัน North Rhine Westphalia, Nordrhein Westfalen, ... Cologne, Koeln ,... ... Or Mr., Miss., Mrs., Or Other clearly defined lists of static data i.e for Taxes or Currencies, which would be used over and over again in several site I.e in Search forms, mail forms, user profiles, shops, realestate lists, .... All this data won't change over years. One way would be to create pages the processwire way and than search for them an make a search so that a parent shows only the subpages assigned to him. What about scalability? I.e if you have clearly defined job descriptions - about 30 TSD. Is there already a module taking care of such kind of static data which probably get much better stored as is in a table direct in the database? Imho it does not really make sense to create for each item a page. What is your opinion? How do you handle that static data in your sites? Thanks Andi
×
×
  • Create New...