Leaderboard
Popular Content
Showing content with the highest reputation on 06/07/2014 in all areas
-
This module adds a preview and zoom button to InputfieldTextarea for live previewing the content after being formatted by the text formatters assigned to that specific field. It's pretty alpha still but it already works. For now I was only playing with the Parsedown formatter, but it should work with every other formatter as well, even with Hanna Code, not sure though, haven't tested it. It's restricted to regular textareas, meaning TinyMCE et al are not supported yet, because they need specific change listeners. Will look into it though. The result is fetched via ajax from a process page, the default style sheet contains some Github-like styles but the style sheet is configurable, see module settings. Github: https://github.com/owzim/ProcessTextareaPreview Open for suggestions3 points
-
I've been using DuckDuckGo(the search engine that doesn't track you) for a while now and they recently released a redesigned and much improved Version. I have to say it looks great. duckduckgo.com Also Apple is making DuckDuckGo a part of Safari in the next versions of Mac OS and iOS as private search option. Does anyone think that DuckDuckGo can actually take a chunk out of Google? I would love to see them succeed.2 points
-
ok, figured it out, sorry for posting an error that wasn't really this module... it was something to do with the conditional visibility of fields that was breaking my repeater... thanks again.. this is all sorted!2 points
-
A convenient way would be to put the code in a file called _init.php. Create this file in your template directory and edit site/config.php to enable _init.php. The lines in config.php you need to look for are about 'prependTemplateFile', around line 45, read simple instruction. For some more ideas and insights you can, as Macrura mentioned, look at https://processwire.com/talk/topic/3987-cmscritic-development-case-study/2 points
-
2 points
-
FieldtypeSelectFile & InputfieldSelectFile Inputfield Select File is an Inputfield & Fieldtype to select a single file or folder and stores the name and / or use the selected file as page template. The last option enables the editor to use multiple views for a page, depending on the selected template. Settings The folder containing the files and/or folders.A relative path relative to the /site/templates/ folder. Hide file extensions Hide files Hide folders Natural Sort (Select options)Sort files and folders in natural ordering (PHP >= 5.4.0) Change Page Template Just before the Page::loaded event the selected file is set as template file for the page. This setting can only be applied once per a page and folders are exluded from the select inputfield. Note that a page with no associated template file will render with the selected file. When to use ? Let editors select a file and base your own logic upon this. With the change page template setting you're able to use the selected file as template file. This could reduce the amount of normal templates needed and let editors choose how the page get rendered. There are plenty of use cases for this Inputfield. In the examples I call the field selected_file. // let the editor choose a CSS file $config->styles->append($config->urls->templates . "styles/" . $page->selected_file); /** * advanced usage example * * You need multiple ways to render your markup. Let the site editor choose which * file the page need to render. * */ $tpl = new TemplateFile($config->paths->templates . "includes/" . $page->selected_file); $tpl->set('current', $page); $markup = $tpl->render(); (It could be a real good companion with InputfieldSelector) Download at GitHub Modules directory1 point
-
Textarea Markup inputfield Loosely based on core module InputfieldMarkup, InputfieldTextareaMarkup works with textareas (FieldtypeTextarea) and outputs plain text, markup and optionally values from other fields in Page Edit (backend). That output can be configured via field settings (Input tab) and then modified on a per-page basis, though only by superusers. For an example this: Hello World, I'm a {{template}}, my ID is {{id}} and my name is {{name}}! Would result in a non-editable (except by superusers) "markup field" with content along these lines: Hello World, I'm a basic-page, my ID is 1001 and my name is About! Content pulled from other fields is sanitised using $sanitizer->text() with default options, so no markup should get through, max length for individual field value is 255 etc. The module is available from GitHub. For more details check out README and/or modules directory page.1 point
-
Hi folks, I read some posts where people seem to struggle with setting up config values for their modules. Since I am currently working on some boilerplate code for modules I created a helper class that makes handling of config values a peace of cake. on Github: https://github.com/owzim/PWModuleConfigHelper from the README.md Define a default array in your module: protected static $defaultConfig = array( // example with just one option 'prettySetting' => array( // the label for the form 'label' => 'Pretty Setting', // the default value 'value' => 'I am pretty', // optional, defaults to 'InputfieldText' 'inputfieldType' => 'InputfieldText' ), // example with multiple options 'awesomeSetting' => array( // the label for the form 'label' => 'Awesome Setting', // the default value 'value' => 2, // optional, defaults to 'InputfieldRadios' 'inputfieldType' => 'InputfieldRadios', // each key is for the input label, each value will be saved if selected 'options' => array( 'Option 1' => 1, 'Option 2' => 2, 'Option 3' => 3 ), // set any additional attribute to the input field 'attributes' => array( 'optionColumns' => 1 ) ) ); Apply the defaults to your module: public function __construct() { PWModuleConfigHelper::apply($this, self::$defaultConfig); } Render out the form: public static function getPWModuleConfigInputfields(array $data) { return PWModuleConfigHelper::renderForm($data, self::$defaultConfig); } Result: Access any of the config settings from your module: $this->awesomeSetting; Stuff to be aware of If you're using this in your module and you don't want it to clash with other modules using this, you have the following options to include it: use spl_autoload_register to autoload it, so it only gets loaded once only include the class if it has not been loaded yet, via class_exists('PWModuleConfigHelper') Option 1 and 2 require the class not to change (updates etc.) so the following options are more stable: Namespace to class via renaming it, prefixing it with you module's name Namespace it with PHP namespaces I could make a module out of this but this might be overkill Cheers!1 point
-
You may want to also check other modules that you may have installed recently. I had an issue where repeaters wouldn't save and it turned out to be an issue with a recently installed module. I only figured it out by retracing my steps and uninstalling modules.1 point
-
I have only following Tabs in phpmyadmin: Databases SQL Status Export Import Settings Variables More So there is no Operations Tab (or maybe you mean the SQL Tab) But something tells me I have to open the SQL Tab where I see following: Run SQL query/queries on server Go Do I have to enter here ALTER TABLE `orders` AUTO_INCREMENT = 101; what I found with google ? I´ll wait your answers first before I do anything there. Edit: On the left side inside phpmyadmin I didn´t select first the target database! Now I see new Tabs with also the Tab Operations! Whoa - I did it - both SQL and Operations let you change a table value ALTER TABLE orders AUTO_INCREMENT = 15000; Learned something new about databasing today1 point
-
1 point
-
@teppo: I trust you! Meanwhile I have updated / edited my post above but have not noticed that you replied to it.1 point
-
Absolutely no offence taken and trust me; I've no delusions about our way of life, so-called democratic systems or the nature of humankind in general. The world we live in is what we (or those of us with resources and power, in one form or another) make it to be -- and "beautiful" is very rarely how I'd describe it Would love to write a longer note and go on about subjects such as technology being both a method of enslaving people and, on the other hand, liberating them (depending on who uses it and for what purposes). I'm in a hurry here so that'll have to wait, but in a nutshell very few things are purely black or white and there are also a myriad of ways to interpret these things.1 point
-
I do not mind that people should not play. But by my school days Orwell was still required reading. I just came to the conclusion that the large corporations seem to see people of all ages simply as beef cattle or slaves. In central Europe statistically every person up to age 70 buys for 4 million euros goods, including food, clothes, etc. (1 human == 4 million euros) Industrial food corporations don't want new born humans getting mother's milk. Why don't want they? I could go on and ask some questions about pharmacy cooperations or others, but the parallels should be clear already. Google want to install a global ring with new telecommunication Satellites. For this, they invest 3 billion euros. (or only dollars?) Do they do so just that people have something to play? I think no. And if someone now want to ask what Google and their glasses has to do with the industrial food corporations, well -, then it seems to be darker than I 've thought. (Google is a corporation with commercial interests. Their goods are informations and they sell them to who ever want to buy them, most likely to those who have much much much money.) ------ @teppo: No offence here, but if you think we live in a beautiful world and are free to do what we like, (and maybe you think I'm to old to be up to date with younger lifestyle) than go and ask some greek people in the same age as you are. If you don't know greek young people, go and ask some from spain or portugal. They all live in free democratic countries for more than 60 years, - not in repressive systems, - but only on the paper. ------ EDIT: I like some points of http://criticalengineering.org/en and if you have something like 'repair cafes' in your neighbourhood and go there, you will see that today mostly all of the technical goods have some quirks in it that are not good to the people who have buied them. It could be simple things like the primary transformer that scale down voltage to suite the needs of the actual good. It seems to be common now to built in components for higher costs but results in lesser quality. Example: in germany you have 230V and the electronic industry offers 'one piece components' that scale down the voltage to 12V with a max usage of 1 ampere (just an example, not sure if I recall all parameters right here). These components have a cost of 50 cent per piece for the corporation if they take some thousands. But now a days most corporations like to buy and built in components for a cost of 80 cent per piece that supports a voltage scale down to 15V. You can compare this with overclocking your PC RAM and CPU. The goods work fine but get more damaged with every minute you use it - and without any adavantages for you in the usage. Question: why do the corporations not want to save 30 cent per piece? (If they sell 10 million goods, there would be 1 million more income) If you like I can provide more examples: Recently we need to buy a new washing machine because the 4-5 year old one doesn't work anymore. After opening it we saw that only the carbon brushes of the electric motor were worn down. But we don't get new carbon brushes in the needed sizes anywhere. Also the electric motor wasn't build / designed to get opened in an easy way (like it was in the past for nearly every sized electric motors). That results in buying a new washing machine = costs 500,- euro. Carbon brushes would have cost 5 - 10 euros? And a professional repair service, for those who cannot do those things by themself, may have a cost of 50,- to 100,- euros? Having the the machine repaired has many benefits / advantages for the community / humans / nature etc., but not for the big corporations. So, I think one need some different points of view if a community builds a CMS / CMF framework or if a global corporation like Google does. The motivations and interests are different.1 point
-
Seems that the general opinion of things like Google Glass is rather negative.. or the folks who oppose these are just making more noise than those loving 'em. Even if just to fill the role of contrarian, I'll have to disagree with (what I see as) the general opinion Perhaps it's just that I've grown up watching sci-fi flicks with all sorts of gadgets and ways to use (and abuse) them, but I see at least as many benefits as there are possible, plausible drawbacks to these things. Some of the arguments made against them, such as blaming Google Glass for people being able to videotape and share videos or pictures of public events, seem kind of ridiculous too. How is that a new thing, really? Anyway, personally I find Google Glass an exceptional piece of technology and the concept in general something that will make it's breakthrough at some point (though whether that's through Google's implementation remains to be seen). It's just a matter of time. <rant> About the lecturers turning into cardboard cutouts and tape machines gag: if a pre-recorded message is all the lecturer has to offer (seen that, been there, makes me pretty damn angry each time) by all means please do this. Share a pre-recorded lecture online. Do whatever you have to, but don't force folks to come to that so-called lecture just to hear a non-changing, non-reactive speech you've given thousands of times before. As long as the lecturer knows how to work with the crowd and how to adapt to it's actions and level of knowledge, I don't think this is a real threat.. even if it makes a good gag </rant>1 point
-
@Adrian - looks really good! In the use case i have, my video page has options for youtube, vimeo or local video; with the local video, some of them were very large sizes so i didn't feel like bothering with the uploader; for the html5 video, i have mp4 and webm versions of both, plus the poster image...so i have a media folder in /site/ for all of those things.. having the ability to let the user select the video file makes this whole thing possible.. but i will look into your module for sure on future stuff and i'm redoing a site now and will probably upgrade my system to use your module... will comment on that thread soon!1 point
-
cool get it. well im a module starter myself, i know there is some way to enable settings button on a module and then u could choose all options there but i dunno how . but ye hardcoded stuff is bad for a module.1 point
-
A lot of things have been simplified in the latest dev. You no longer need to set any user template permissions at all. Simply giving the role "Administer Users" permission is enough. Here is Ryan's explanation:1 point
-
Tnx for the followup ! Gonna test this weekend. I didn't thought people would use this fieldtype with ../ in the field settings, so I cleaned the values when I discovered this behaviour. Normal users can't set those settings so I removed this checking and clearing of the data in the update. (can't think of doing real harm) Thanks for finding this Macrura. The module is updated on Github.1 point
-
Since the introduction of "Show in the add-page shortcut menu?" i'm disabling this feature for almost every template. And sometimes I forget to disable it, so I have to go back to the template settings to solve it. For one site I even disabled the button with display: none; (hacky hacky) It's starts to annoy me more then I would benefit from it. I thinks it's better to invert this behaviour, defaulting to No.1 point
-
We talked about this in the office, just letting know i agree with Martijn. In 9 out of 10 templates (maybe even more in the past projects i'm working on) it doesnt need to be displayed in the shortcut menu.1 point
-
Flavy, I wouldn't worry too much about quantity of queries. Instead, focus on the end results and how fast it performs. Quantity of queries means very little as you can have a 100 well optimized and/or simple queries that execute faster than a single complex one. So counting queries is more than often a waste of time, and trying to combine queries can even slow things down. The way that ProcessWire works is that it loads data on demand, as it is requested, using simple and well optimized and indexed queries that are very fast. That is, unless you check the box for "autojoin" in your field advanced settings. When checked, it will join that field's data with the original page query. For instance, we have the "title" field set to autojoin by default, since this is one field that is most likely to be accessed on any given page object. However, whether or not autojoin speeds up anything is debatable, so I would use it sparingly. It has potential to speed things up in some cases, but at the cost of memory, and cost of loading data unnecessarily. As a result, we only recommend it for fields that will always be accessed on every instance of a page. Beyond the obvious "title", examples might include a date or summary field used when outputting lists throughout a site. For the most part, I don't use the autojoin option at all anymore except for "title" fields because there is rarely a measurable benefit, but there is always a measurable drawback (loading stuff in memory that may or may not be used). You might also want to look at the "Cache" Fieldtype, which is included in the core. It's something that people rarely use, but it is directly applicable to your question. It caches all of your fields for a given page (or at least those you select) into one. It's more often used to combine several text fields together for searching purposes, but it can also be used to keep all your page data together in one chunk (and correspondingly, 1 query). Again, it may or may not result in faster performance in the end, but it's another tool worth knowing about and worth experimenting with. Other tools I recommend considering are MarkupCache (core module) and Template cache (a feature in any template settings). Or for the best performance, we also have ProCache, which makes your site perform as quickly as static HTML files. Most PW sites don't need much in the way of caching, but if you find you need it or want it, you've got some great options here. I agree with Antti that 100 fields will not be a problem. Many of us here regularly deal with more than that. But it also is good to think of fields as a finite resource and something that you want to conserve. While there is no technical limit on quantity of fields that you can have, it's possible for overhead to increase as the number of fields do. This isn't about page loading per se, but about overall system overhead and memory required to manage lots of fields at once. The ProFields package is specifically aimed at reducing the quantity of fields necessary to accommodate a site's data needs. Depending on what those needs are, it has the potential to drastically reduce the number of fields in your system. As a result, I think it makes a lot of sense for the needs you are talking about. You should also look into PageTable (on the dev branch) as a better option to repeaters.1 point
-
Feasibly it's possible, but it's not desirable. Making wire('var') aware of context involves pre-compiling the template files to replace wire('var') with wire($this, 'var'). So it's something we do to provide backwards compatibility in template files. We won't be providing that backwards compatibility outside of template files, so people will have to use $this->var, $this->wire('var') or wire($this, 'var'); elsewhere. Also, a Static::syntax implies dealing with a framework that only has one context, which gives the appearance of a weakness that isn't there, something I think we'd want to avoid. While I'd really like to limit statics in ProcessWire as much as possible (just because they are more than often a bad programming practice), that syntax is perfectly fine for static functions where context doesn't matter or where you are passing the context into it. For example, $sanitizer functions would not need to have different behavior in different contexts. I've even seen some frameworks that do use statics for sanitization functions as well. In the end though, IMO they would still be better served by providing the same functions non-statically. The plan is that when you do this... $main = new ProcessWire('/site/'); $intranet = new ProcessWire('/site-intranet/'); ...everything in each of those two instances will be unique to those instances and whatever site files are stored in /site/ or /site-intranet/. That means that when a module is initialized, it is only initialized for the instance (whether main or intranet). When a module refers to $this->var, it's referring to API variables that are part of its instance only. This enables you to have multiple sites talking to each other. Currently this isn't possible precisely because PW uses statics for API variables behind the scenes. But the fact that we've kept that behind the scenes is a good thing because that means it doesn't matter how our API variables are stored. We can switch them to a stronger storage mechanism that would be tied to an instance. This is one reason why I deprecated the Wire::getFuel() syntax (that appeared in early versions of PW2) early-on... though you might still see it appear in a few core spots, which will need to be changed. But we've really tried to keep the public API clear of static calls so that the API would not have to change as PW continues to grow as a framework.1 point
-
Great thanks! The comments manager is just what I was looking for. To make it it a bit more integrated I just moved the "Comments Manager" page from /admin/setup to /admin/blog, which doesn't seem to have caused any problems. A couple of things: to get widgets from the sidebar to display on non-blog pages, the module has to be called on every page: //CALL THE MODULE - MarkupBlog $blogOut = $modules->get("MarkupBlog"); I've just added it to the top of my sidebar.inc for the time being, I'll have to refactor my code a bit in the future to stop it being called twice on blog pages. Second, to get posts to show only an excerpt, in the template files change the line: $content .= $blogOut->renderPosts("limit={$limit}"); to $content .= $blogOut->renderPosts("limit={$limit}", $small=true); Currently it looks like the excerpt length is hardcoded to 450 characters - perhaps adding an option for people to set this themselves would be a good idea? In the meantime, for anyone that wants to change this, find the line $summary = strip_tags(substr($page->blog_body, 0, 450)); in MarkupBlog.module and set it to whatever you want. Great work, I'm getting more impressed the more time I spend with it!1 point
-
1 point
-
I guess it doesn't like the #t=134 Too bad you can't pass the start time though. I tried some of the other formats: &t=1m34s etc, but these must get stripped by the forum because they don't work.1 point