Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/13/2016 in all areas

  1. I'm experimenting with admin columns and so far so good! I've used Admin Template Columns which served well for years but I always felt there should be an easier way to accomplish this. ATC uses two fieldsets so you have to drag 4 asm fields in your templates to set columns. Plus if you need custom column width then you'll need to percentages at two fieldsets' settings. My current solution uses only one field (FieltypeText actually, but it doesn't matter) so to separate columns I only need to put this field in the list where I need a column break. Custom width can be set by editing the field's width and both column's widths will be calculated. I'll need to polish a few things but I like it's simplicity (and that there's one less module to install).
    4 points
  2. One of PW 3.010's major novelty was the introduction of Horst's new image resizing engine that uses ImageMagick. Now I understand that ImageMagick can convert images to Webp, the image format that Google says can reduce image size up to 34% compared to JPEG. Mozilla is apparently adding support to Firefox, and even the Safari team is playing with it, so it looks like Webp is soon going to be available in most major browsers. If Horst's module can be extended to add Webp conversion, that would be a great addition to PW's already very powerful image manipulation arsenal. I'm currently using the free ImageEngine Lite to serve Webp images to supporting browsers, and the results are impressive. I routinely get images that are between 25 and 60% smaller compared to JPEG, with the same visual quality. I would love to eliminate the need to rely on a third-party service though.
    3 points
  3. Don't forget about $this->halt() rather than using exit/die https://processwire.com/blog/posts/processwire-2.6.8-brings-new-version-of-reno-admin-theme-and-more/#new-this-gt-halt-method-for-use-in-template-files
    2 points
  4. I thought I should post my implementation based on Bernhard's code. It tries to work out the length of the first tag and modifies the ->asXML parameters accordingly. The Import Code is as follows : class ImportFromXML { private $file; public function __construct($file) { $this->file = $file; } public function Execute() { $import = true; $xmlFile = $this->file; if ($import) { if (!file_exists($xmlFile)) exit($xmlFile . ' failed to open'); $items = simplexml_load_file($xmlFile); foreach ($items as $xml) { $p = new \Processwire\Page(); //$p = new \Page(); $p->of(false); $p->template = wire(templates)->get("id=" . $xml->template); $p->parent = wire(pages)->get("id=" . $xml->parent); $p->title = $xml->title; //Struggle to call Sanitizer $p->name = wire(sanitizer)->pageNameUTF8($xml->title, true); $p->name = $xml->title; //while ($xmls->find('parent=' . $p->parent . ',name=' . $p->name)->count() > 0) $p->name .= '-1'; //$p->content = $this->PopulateContent($xml->content); $p->content = $this->PopulateMarkup($xml->content); //$p->content_intro = $this->PopulateIntro($xml->content_intro); $p->content_intro = $this->PopulateMarkup($xml->content_intro); $p->author = $xml->author; $p->content_path = $xml->content_path; $p->seo_title = $xml->seo_title; $p->seo_keywords = $xml->seo_keywords; $p->seo_description = $xml->seo_description; $p->seo_image = $xml->seo_image; $p->seo_custom = $xml->seo_custom; $p->image = $xml->seo_custom; $p->image_alt = $xml->image_alt; $p->keywords = $xml->keywords; $p->title_nav = $xml->title_nav; $p->seo_section_title = $xml->seo_section_title; //$p->save(); // try creating PageArray first ???? //$cats = new \PageArray(); $cats = new \Processwire\PageArray(); foreach ($xml->category->id as $id) { //$cat = wire(pages)->get("name='" . $catname . "', parent='/Categories/'"); $pageid = (string) $id; $cat = wire(pages)->get($pageid); if (!IsNullPage($cat)) $cats->add($cat); //$p->categories->add($cat);- } $p->category->import($cats); $p->save(); echo 'new page <a href="' . $p->editUrl . '" target="_blank">' . $p->path . '</a><br>'; } //die(); } } private function PopulateMarkup($node) { $xml = $node->asXML(); //Check for tags if($xml != strip_tags($xml)) { //$startTag = strpos($node,"<"); $endTag = strpos($xml,">"); if ($endTag > 0) return substr($xml, $endTag+1, -1*($endTag+2)); } return $node; } } And the Export : class ExportToXML { private $pages ; public function __construct($pages) { $this->pages=$pages; } public function Execute() { $import = true; if($import) { echo "<?xml version='1.0' ?>"; echo '<pages>'; //$parent = $pages->get('/blog'); $results = $this->pages; //$results = $pages->find('id=3198'); // ohne pic //$results = $pages->find('id=3204'); // mit pic foreach($results as $p): $p->of(false); ?> <page> <name><?= $p->name ?></name> <title><?= $p->title ?></title> <template><?= $p->template->id ?></template> <parent><?= $p->parent ?></parent> <category><?php foreach($p->category as $category) { echo '<id>' . $category->id . '</id>'; } ?></category> <content><?= $p->content ?></content> <content_intro><?= $p->content_intro ?></content_intro> <author><?= $p->author ?></author> <content_path><?= $p->content_path ?></content_path> <seo_title><?= $p->seo_title ?></seo_title> <seo_keywords><?= $p->seo_keywords ?></seo_keywords> <seo_description><?= $p->seo_description ?></seo_description> <seo_image><?= $p->seo_image ?></seo_image> <seo_custom><?= $p->seo_custom ?></seo_custom> <seo_canonical><?= $p->seo_canonical ?></seo_canonical> <image><?= $p->image ?></image> <image_alt><?= $p->image_alt ?></image_alt> <keywords><?= $p->keywords ?></keywords> <title_nav><?= $p->title_nav ?></title_nav> <seo_section_title><?= $p->seo_section_title ?></seo_section_title> </page> <?php endforeach; echo '</pages>'; //die(); /** * <date><?= $p->created ?></date> <featured>1</featured> */ } } } In particular, I had a field that was a PageArray linking to other Pages. <category><?php foreach($p->category as $category) { echo '<id>' . $category->id . '</id>'; } ?></category> Hope it helps some one out!
    2 points
  5. v063 is up! Moved this new submodule named AdminColumns entirely to PHP instead the quick JS prototype. It works, though I'm not sure it's much better this way. Anyway, it was fun/challenge to get the things I needed from other modules (Admin Template Columns, Batch Child Editor, etc). See the readme for how it works but there's no big news there. The field is not uninstalled when AOS is uninstalled, but it shouldn't show up in the page edit form even if you don't remove it manually. However, the field is installed on module install and on activating the submodule too.
    2 points
  6. @kixe The name of the repeater page doesn't come into the code I posted. This line... $pid = filter_var($this->name, FILTER_SANITIZE_NUMBER_INT); // get repeater page id from inputfield name ...gets the ID of the repeater page from the inputfield name - in the context of "Custom PHP code to find selectable pages " $this is the Page inputfield. The inputfield name includes the repeater page ID due to this: https://github.com/ryancramerdesign/ProcessWire/blob/devns/wire/modules/Fieldtype/FieldtypeRepeater/InputfieldRepeater.module#L219 But thinking some more, the base inputfield name itself could include integers so this would be better: $pid = filter_var(strrchr($this->name, "_"), FILTER_SANITIZE_NUMBER_INT); // get repeater page id from inputfield name The whole idea is pretty hacky, but just trying to work around what is available in "Custom PHP code to find selectable pages".
    2 points
  7. Hi, After reading this thread, I decided to make a module that helps generating PDF files of ProcessWire pages. GitHub: https://github.com/wanze/Pages2Pdf Modules Directory: http://modules.processwire.com/modules/pages2-pdf/ This module uses the mPDF library to generate the PDF files. It has fully UTF-8 and basic HTML/CSS support for rendering the PDF files. The output is customizable with ProcessWire templates. Example I've enabled generating PDF files for the skyscraper template of ryans Skyscrapers-profile with a template that outputs the data in a table along with the body text and the images: one-atlantic-center-pdf-4177.pdf Please take a look at the README on GitHub for instructions and further information/examples. Cheers
    1 point
  8. This module serves as an example of creating an editable table of data as a Fieldtype and Inputfield in ProcessWire. In this case, we create a simple table of events each with date, location and notes. This pattern can be adapted to nearly any table of information. Note that this module is intended as a proof-of-concept. If you find it useful for the example scenario (events) then great, but keep in mind it is not intended as a comprehensive events solution, where using ProcessWire pages may be a better fit. This is a pattern I've used for creating tables of data in ProcessWire for many different Fieldtypes/Inputfields and thought it would be good to setup a proof-of-concept example like this to share. Module Page / GitHub Page Install Copy the files for this module to /site/modules/FieldtypeEvents/ In admin: Modules > Check for new modules. Install Fieldtype > Events. Create a new field of type Events, and name it whatever you would like. In our examples we named it simply "events". Add the field to a template and edit a page using that template. Output A typical output case for this module would work like this: foreach($page->events as $event) { echo " <p> Date: $event->date<br /> Location: $event->location<br /> Notes: $event->notes </p> "; } This module provides a default rendering capability as well, so that you can also do this (below) and get about the same result as above: echo $page->events; ...or this: foreach($page->events as $event) { echo $event; } Finding events This fieldtype includes an indexed date field so that you can locate events by date or within a date range. // find all pages that have expired events $results = $pages->find("events.date<" . time()); // find all pages with events in January, 2014 $results = $pages->find("events.date>=2014-01-01, events.date<2014-02-01");
    1 point
  9. right - ok thanks, sure - yes, a per-superuser permission is best, to limit the panels, or none at all (sorry for being dense, doing like 10 things at once here..)
    1 point
  10. New User Bar config settings for changing the position of the bar, as well as an option to also display it for users who also have Tracy Debug Bar permission - gives quicker access to the admin and edit links, as well as any custom links you set up. Also fixed a bug where the User Bar wasn't showing in Production mode.
    1 point
  11. Hey @Macrura - just looking at this part of your question again - is this the key thing you want changed - the ability for Tracy to not be shown for all superusers? If you want I could check for a new "tracy-debugger-superuser" permission. This would only be considered if it exists and if it does, superusers would only be able to see the Debug bar if they also have that permission. Is that what you are looking for? or is your issue answered by these posts? https://processwire.com/talk/topic/12208-tracy-debugger/?do=findComment&comment=127746 https://processwire.com/talk/topic/12208-tracy-debugger/?do=findComment&comment=127747
    1 point
  12. In the meantime I had updated to 0.6.3 but the issue is still there. I also think that the position does not beak anything but I still wonder why it works without position if AOS is deactivated.
    1 point
  13. I had seen this thread before but is seemed such an obscure problem! http://ladosis.eduardosanmiguel.com (mine!) http://thatsnew.net (copycat!) I am talking with namecheap right now (my registrar)
    1 point
  14. Thanks! Right, because you can't add 2 or more instances of the same field. Perhaps such feature wouldn't complicate things too much but let's see how the current implementation performs first
    1 point
  15. Hi @bernhard For monitoring server status I like to use Munin it gives you a full perspective in one view. Recently have used Zabbix for monitor and email me if something goes wrong. Is very expandable and has a wide variety of plugins. This is more a System/Network monitoring software. The web scenarios features of zabbix are nice for web projects, web services tests too. All this solutions are locally installed and not third party services.
    1 point
  16. Hi Robin S, I have spoken to my host and we have decided to use a backup of the site in a different dev area. Sorry for the late reply. Thanks for your continued support, Matt
    1 point
  17. @adrian I am sorry but I am no longer using the module - my customer didn't want to use the functionality and so I removed it. Thank you guys for your efforts in helping me out.
    1 point
  18. kia ora Robin, Yeah, that looks like an ideal start. And I will likely start learning about PW modules in the process. Sweet as, cheers mate.
    1 point
  19. @Robin S You are right. Sorry for the quick shot. Next time I read your post better.
    1 point
  20. Hi there fellow kiwi Check out the Page List Show Page Id module - it's very simple so it's easy to modify to include whatever information you want in the page label. You can add some custom CSS to hide/style the added info: public function init() { if($this->user->isSuperuser()){ $this->addHookAfter('ProcessPageListRender::getPageLabel', $this, 'addPageIdLabel'); // add stylesheet $this->config->styles->add($this->config->urls->PageListShowPageId . "PageListShowPageId.css"); } }
    1 point
  21. no, i don't think i ever mentioned it; it's just sort of a part of this ad-hoc sub-framework i use for developing sites..., and came into being way before Tracy was born... I do use it extensively since it would show for non superadmin under circumstances where Tracy might be confusing; this one is super simple and just shows a handful of links to the site editors/managers.. on the next project, i am going to pursue using Tracy instead of this, and i'll post back here in terms of how it works out with using the php code...
    1 point
  22. I use this module on a daily basis and have no problem with it working on PHP 7. The fact that newer versions of PHP are "more secure", to me is not a "problem" but a commendable thing. Maybe I'm missing something, but the fact that this module is working on PHP 7.x with the changes made back in June (when I reported a problem), leads me to think that if there is any problem, it would be in the setup of the cronjob that the user @Werner Pelnei was using. I originally had problems with the cronjob, but was able to to get it to work with PHP 7.x /usr/bin/curl -s "https://www.mywebsite.com/?hash=aaaa----secret-hash----aaaa" > /dev/null This statement was what finally worked. I just hope that the module works and doesn't circumvent needed security parameters introduced in newer PHP versions. I don't want to have to stop relying on the functionality that this module gives me. As I stated earlier, it works (without any needed new changes to the flourish library in the module) with PHP 7.x
    1 point
  23. Just return json directly like so: http://stackoverflow.com/questions/4064444/returning-json-from-a-php-script
    1 point
  24. @LostKobrakai and @pwired Thanks for directions. I'm going to have a busy day this Monday, but will definetally take a closer look of the posts you provided. Note, that I've already adopted @clsource's (Camilo Castro's) wire render pattern thanks to his recently released Processwire Ghost Writer profile which I am currently refactoring to my needs. @tpr Well, there are various reasons for not taking the template engine path, at least not yet. You have almost converted me and I was about to jump the Latte bandwagon, but currently I want to work with the least amount of dependencies and a template engine is just another framework to add to he system which is not really needed for standard, basic websites which I'm currently interested in.
    1 point
  25. Mostly using Pingdom and Nagios. Pingdom is for personal projects and as a backup for cases where Nagios itself might've gone down, while Nagios is for anything where I really need a "full-featured" monitoring service. PHP Server Monitor seems like a nice tool, though judging from their documentation (didn't install, so please let me know if I got this wrong) it seems to lack some features I've grown accustomed to: customisable user groups and per-group behaviour, different actions based on time and day/date, service/server specific actions, SNMP support and/or support for custom check logic, etc. If you just want to know whether each specific server/service is up and have a reason to avoid hosted services like Pingdom, StatusCake and UptimeRobot, this does indeed seem like a good tool. For most use cases I'd still recommend a hosted solution, mainly because a) ease of use and b) they pretty much guarantee that the monitor itself won't suddenly die without a notice
    1 point
  26. I'm thinking about creating a new module to store form submissions quickly using serialized arrays. The idea is not to create separate fields for each submitted input but only one field. On the backend, the values would displayed in a human readable format, and the field itself won't be editable. Is there any existing solution for this? And, in general, any thoughts on this idea?
    1 point
  27. Just a note: overwriting the render value with custom html output (getting rid of the input field) is not a good idea. The field will have no value in the admin page (only the custom html, no form input) and hitting Save will null out the original value. This could be possibly eliminated keeping the original input for the field and hiding them, and appending the custom html. As for now, I made the field Locked so the field will use the renderValue to display its contents. Doing so hitting Save will not change the original value. Here's how the current admin page looks like. The "Submission details" is one textarea with json contents, using a renderValue hook to make nicer:
    1 point
  28. My point of view is that Typography is very important in the Web Development process. I'm no expert though, as I'm still learning as I go. I believe that good typography puts a finishing touch on a website. I use MyFonts, FontSpring and Adobe Typekit. FontSpring is my favorite, as they have what I believe are great rules on the use of fonts. I also do a lot of graphics work for my clients (forms, images, menus, flyers and documents) and I have gotten away from the default fonts and started to use different fonts on all my workstations. I plan in the next year or two, to invest more of my time in learning and appreciating the world of Typography. There's a lot to learn.
    1 point
×
×
  • Create New...