Leaderboard
Popular Content
Showing content with the highest reputation on 04/15/2015 in all areas
-
Some time ago we did a redesign and relaunch of http://www.pipistrello.ch/ using ProcessWire. A Circus for children to participate. The design and html theme is wanted and bought by the client, so we don't take credits for that other than ProcessWire work and some small adjustments as was requested.11 points
-
TL;DR: I know, there is already an Validation Module. And it wasn't my intend to build another module. But I needed it in so many places which lead to duplicate code and suddenly there was a module Perhaps it's useful to someone. At the moment there are only validators I need in my current project, if you miss one, please tell me or (preferred) send a pull request! ------ This module provides a set of useful validation methods using ProcessWire sanitizers. Example Usage: $conf = array( 'username' => array('isEmpty', 'isUnique' => array('ident' => 'name', 'sanitize' => 'username')), 'pass' => array('range' => array('min' => 6, 'max' => 20)), 'pass_confirm' => array('isEqual' => array('equal' => 'pass')) ); $validator = new Validator; $validator->setConfig($conf); if (!$validator->isValid()) $errors = $validator->getErrors(); You can also use it to validate POST requests: $validator = new Validator; $validator->setConfig($validatorConf); // validation failed if (!$validator->isValid()) { $data = array( 'success' => false, 'errors' => $validator->getMessages() // $validator->getErrors() ); $this->returnJson($data, 400); } ❯ http -f POST http://pw.dev/v1/user/ email=info@com username=exampleUser pass=short { "errors": { "email": [ "Please enter a valid email address." ], "pass": [ "This field must be at least '6' characters.", "'short' must contain at least one digit character" ] }, "success": false } For a detailed documentation please have a look at the guides: Installation Usage Available Validators Error Messages phpunit Testing8 points
-
It's a very valid question. It's where it can lead to a module mess much like in every module/plugin based system. The kind of: "I have 20 modules that do validation. Which is better, which really is tested and works? Which works for which PW version..." etc.3 points
-
Not really. It is much faster on production, I get 340 ms for the same page on a shared linux hosting. As for me, I always get better results going live. Probably because the server is optimised for that exact task. Most of the time is spent building a page (which is faster on server), not transpoting it here and there. I just checked it in the dev tools - you can get those details)2 points
-
There's no need to justify why a module exists. It's always nice to have options, even if they solve the same thing in different ways.2 points
-
$user->usergender is not the id of the selected field it's the label. Just like you would get the page from a pagefield and not the id. This will get you the id. $user->getUnforamatted("usergender");2 points
-
2 points
-
Refresh listerPro after closing/saving the modal: (You need to enable 'Additional javascript config data' in the settings) $(function () { if (config.AdminCustomFiles.process === 'ProcessPageListerPro') { $(document).on('dialogbeforeclose', '.pw-modal-window', function() { $("#_ProcessListerRefreshTab").click(); }); } });2 points
-
hey wanze, looks great and could help me a lot if i find time to code some day for what is in my head for a long time ^^ https://github.com/wanze/Pages2Pdf/blob/master/Pages2Pdf.module#L97 shouldn't it check if the user has at least viewing access for the page with the given ID because i think $pages->get(id) via API returns the page independent of its current publishing/hidden state and access? maybe anyone could easyly change the page id and download pdfs of pages he is not allowed to see?2 points
-
This module adds a "SEO" tab to every page where you can define a special title, description, keywords, etc. Try it http://aluminum-j4f.lightningpw.com/processwire/ Name: demo Pass: demo123 How to use You can choose between include automatically or use the following methods: $config->seo // includes all the default values and configuration settings // e.g.: $config->seo->title $config->seo->keywords $page->seo // includes all the default values mixed with the page related seo data // e.g.: $page->seo->title $page->seo->keywords // for rendering: $page->seo->render . . Screenshot Download You can download it in the modules repository: http://modules.processwire.com/modules/markup-seo/1 point
-
Image Animated GIF v 2.0.2 Module for PW 2.5 stable or newer, but is obsolete for PW Versions greater then 3.0.89 (... read more ...) This module helps with resizing and cropping of animated GIFs when using the GD-Library. The GD-Library does not support this. This module is completely based upon the fantastic work of László Zsidi (http://www.gifs.hu/, builts the initial classes) xurei (https://github.com/xurei/GIFDecoder_optimized, enhanced the classes) I have ported it to a PW module and it works with core imagefields, together with Pia and with CropImagefields that uses the new naming scheme since PW 2.5. ------------------------------------------------------------------------------------------------------------------------------------------ read more in this post about the rewrite from version 1.0.0 to version 2.0.0 ------------------------------------------------------------------------------------------------------------------------------------------ You can find it in the modules directory: https://modules.processwire.com/modules/image-animated-gif/ and on Github: https://github.com/horst-n/ImageAnimatedGif ------ A preview can be found here1 point
-
I have a PW site where I had been successfully uploading png and jpeg files. Recently the file and image file fields don't save. The upload status bar completes (100%) without error but when the page with the file field is saved the uploaded file name is missing from the refreshed page. This must be due to a site hosting change but I need more specific info like error details before I raise it with them. The php v5.4 config has file uploads enabled and safe mode is off. I have tried the following to fix this without success: I have read and tried the fixes to the similar posting from Soma: can't upload image/files problem Upgraded the PW site from 2.3 to 2.5.3. (no change) Turned on debug in config.php with no obvious error messages showing. Debugged core\WireUpload.php where I found that the recommended fixes from 1. wouldn't work because the file field is not using Ajax. Have you got any other suggestions?1 point
-
This is a new version of Yahoo! Weather module for ProcessWire, old version of the module can be found at this link. The module has been rewritten, new options have been added alongside with caching from the API (Yahoo! API allows 20.000 calls per hour when using free version, so it comes in handy if your site has a lot of page hits). I've also updated icons in the package (you can easily swap them with yours in module icons folder). You can grab the module from the Modules page or directly from Github link. Update 1.0.1 Yahoo changed their forecast API URL (http://xml.weather.yahoo.com/ instead http://weather. yahooapis.com/), tiny update in Github repo. How to use You can call the module in two different ways: This is a basic call that renders the module, use this if you want only one instance of the module shown with WOEID set in the module settings. <?php echo $modules->get('MarkupYahooWeather')->render(); ?> If you want to show multiple instances of the module, call it this way: <?php $weather = $modules->get('MarkupYahooWeather'); $weather->woeid = 12587912; // Decatur, USA echo $weather->render(); $weather->woeid = 44418; // London, United Kingdom echo $weather->render(); ?> Options This module has the following options: Yahoo! Weather WOEID WOEID (Where On Earth ID) is an unique identifier for each city, you can easily find WOEID by using this site: http://woeid.rosselliot.co.nz. Default = Zagreb Set Locale Sets PHP locale, needed for localized date display. Default = en_US.UTF-8 Set Encoding Converts international date names to right format. Default = ISO-8859-1 Date Format Sets desired date output, formatted with PHP strftime function. Default = %A, %d.%m.%Y. Cache Time Cache time in minutes, caches .xml file(s) retrieved from Yahoo! API and pulls the data locally. Default = 5 minutes Display temperature in Fahrenheit instead of Celsius? Show weather conditions in Celsius or Fahrenheit scale (temperature: C/F; wind speed: km/h, mph; sunrise and sunset: 24h, am/pm). Show 5 day forecast below current weather forecast? Shows extended 5 day forecast, if unchecked, only current weather will be shown. Default = Checked Show wind direction and speed? Shows wind direction and speed. Default = Checked Show sunrise and sunset time? Shows sunrise and sunset time. Default = Checked Autoload script and stylesheet? Renders script and stylesheet during page render, if you prefer to include them manually, turn this option off. Default = Checked Load script in the bottom of the page? If "Autoload script and stylesheet" option is checked, you can select where script should be rendered automatically, before the end of head or body tag. Default = Unchecked Delete Weather Cache Deletes locally stored and cached .xml file(s) from Yahoo! API for all instances of the module.1 point
-
I spent way too much of my spare time with trying to produce an overly complex site backup module. Anyway - it is here in a pre-release state. I somehow have to get rid of the monster. Features: Use Storage Providers There are two base classes for Storage modules and three reference implementations: Remote Storage Driver This is a baseclass for construcing plug-in modules that allow to send data to a remote storage. You need to extend all abstract functions: connect, disconnect, upload and getConfigFieldset Implemented Examples Storage Mail Sends a backup as mail attachment. If the file size exceeds a set limit it will get split. It uses PHPMailer library as WireMail does not support attachments. @todo: For now this mails all in a single smtp session - maybe thats not so safe? Remote Directory Driver This is a baseclass for construcing plug-in modules that allow to send data to a remote storage and list and delete old files. You need to extend all abstract functions: connect, disconnect, upload, find, size, mdate, delete and getConfigFieldset. Implemented Examples Storage FTP Allows to connect to an ftp server and upload, list and delete files. Uses standard php ftp functions. Storage Google Drive Allows to connect to google drive server and upload, list and delete files. Uses the php google api. You have to create a Service account with the google developers console and add the key file to the plugin directory (or another directory if you specify a relative or absolute path to that file). s. https://developers.google.com/identity/protocols/OAuth2ServiceAccount#creatinganaccount I don't use the OAuth token process because it is not more secure. Once there is a renew token (which is necessary to avoid user interaction) it is as powerful and insecure as a keyfile. It is just more complex as it needs a callback url for registering. @todo? In case you can prove otherwise I will implement the callback registration. Run from the web or the command line It's allways better to have a regular cron job running. But sometimes you might need webcron Command Line You just need to call backup.php with the id of a backup job and it will be run Web Cron There is a token that starts the backup job from the web if passed as a url parameter. You can specify whether you want logging the http stream or not. You can also specify whether you want a job to be repeated within a certain timespan. This is for using unreliable webcron services by hitting the backup multiple times. @todo Consider integration of cron.pw @todo I use the init function of an automatically loaded module as a hook. This seems a bit strange. Is there better ways to do that? Log to mail, file and admin You can recieve logs by mail (on success or failure), log to a file and see log in a an admin page: Configure I built a admin interface that - besides the log viewer - features a list of jobs: and an editor for the job (which is too extensive to be described in detail): Dicussion I am not too sure on how to solve the issues indicated with @todo. My main concern are the hooking (init of an autoload module for the moment) and locking (none, no singleton for the moment). As for hooking I only know of the alternative of using a page where one would have (afaik) to use a special template as the admin template is secured or hook into the security functions (which would probably call for a singleton module). Concerning the locking issue I think it might be good if the Admin Class would lock if it is updateing something. For the moment this is the same class that runs the backups thus it would also lock the admin if there is a backup running. And it would lock the whole site if it is on autoload (as I use the init hook). Lastly I should reconsider the logging and maybe try to better integrate it with processwire logging. I would appreciate comments and suggestionsn on these issues. I appreciate your test results. Don't be took frutsrated if something goes wrong, this is at an early stage but afaik it should be running. Please find the modulle on: https://github.com/romanseidl/remote-backup1 point
-
I think you're looking for the settings here: mysite.com/processwire/module/edit?name=ProcessProfile1 point
-
Roll back to php 5.5 and it works like a charm. With PHP 5.6 I added this line to php.ini always_populate_raw_post_data = -1 and now the ajax upload works.1 point
-
I try to investigate but first I show you the errors. The ajax return: <br /> <b>Deprecated</b>: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in <b>Unknown</b> on line <b>0</b><br /> <br /> <b>Warning</b>: Cannot modify header information - headers already sent in <b>Unknown</b> on line <b>0</b><br /> <br /> <b>Warning</b>: Cannot modify header information - headers already sent in <b>/Users/andreamontaldo/Sites/siae-promo/web/wire/core/admin.php</b> on line <b>15</b><br /> [{"error":false,"message":"Added file: dsc00181.jpg","file":"\/siae-promo\/web\/site\/assets\/files\/1023\/dsc00181.jpg","size":98458,"markup":"\n\t<li id='file_3dbec45f3f9fb3712c4ac718c1f1ba9b' class='InputfieldFileItem InputfieldImage ui-widget'>\n\t\t<p class='InputfieldFileInfo InputfieldItemHeader ui-widget ui-widget-header'>\n\t\t\t<i class='fa fa-fw fa-sort HideIfSingle'><\/i>\n\t\t\t<i class='fa fa-fw fa-caret-right HideIfMultiple'><\/i> \n\t\t\t<a class='InputfieldFileName pw-modal pw-modal-large' title='dsc00181.jpg (1623x1080)' href='\/siae-promo\/web\/gestione\/page\/image\/edit\/?id=1023&file=1023,dsc00181.jpg&rte=0&field=cover' data-buttons='#non_rte_dialog_buttons button' data-autoclose='1' data-close='#non_rte_cancel'>dsc00181.jpg <i class='fa fa-pencil ui-priority-secondary'><\/i><\/a> \n\t\t\t<span class='InputfieldFileStats'>96 kB, 1623x1080 <\/span> \n\t\t\t<label class='InputfieldFileDelete'><input type='checkbox' name='delete_cover_3dbec45f3f9fb3712c4ac718c1f1ba9b' value='1' title='Delete' \/><i class='fa fa-fw fa-trash'><\/i><\/label>\n\t\t\t<a class='InputfieldFileMove InputfieldFileMoveBottom' href='#' title='Move to bottom'><i class='fa fa-fw fa-angle-double-down'><\/i><\/a> \n\t\t\t<a class='InputfieldFileMove InputfieldFileMoveTop' href='#' title='Move to top'><i class='fa fa-fw fa-angle-double-up'><\/i><\/a> \n\t\t<\/p>\n\t\t<div class='InputfieldFileData ui-widget ui-widget-content'>\n\t\t\t<div class='InputfieldImagePreview'>\n\t\t\t\t<a class='InputfieldFileLink' target='_blank' href='\/siae-promo\/web\/site\/assets\/files\/1023\/dsc00181.jpg?nc=1429127148'><img height=\"50\" src=\"\/siae-promo\/web\/site\/assets\/files\/1023\/dsc00181.0x100.jpg?nc=1429127149\" alt=\"\" data-gridsize=\"50\" \/><\/a>\n\t\t\t\t<div class='InputfieldImageActions'>\n\t\t\t\t\t<a title='dsc00181.jpg (1623x1080)' href='\/siae-promo\/web\/gestione\/page\/image\/edit\/?id=1023&file=1023,dsc00181.jpg&rte=0&field=cover' class='pw-modal pw-modal-large' data-buttons='#non_rte_dialog_buttons button' data-autoclose='1' data-close='#non_rte_cancel'><i class='fa fa-fw fa-crop'><\/i><\/a>\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t\t<div class='InputfieldFileDescription'><label for='description_cover_3dbec45f3f9fb3712c4ac718c1f1ba9b' class='detail'>Description<\/label><input type='text' name='description_cover_3dbec45f3f9fb3712c4ac718c1f1ba9b' id='description_cover_3dbec45f3f9fb3712c4ac718c1f1ba9b' value='' \/><\/div>\n\t\t\t<input class='InputfieldFileSort' type='text' name='sort_cover_3dbec45f3f9fb3712c4ac718c1f1ba9b' value='0' \/>\n\t\t<\/div>\n\t\t\t<div class='ui-widget-content crops'><p class='description'>Thumbnails (hover to preview, click to crop)<\/p><a target='_blank' data-thumburl='\/siae-promo\/web\/site\/assets\/files\/1023\/thumbnail_dsc00181.jpg' class='crop' href='\/siae-promo\/web\/gestione\/page\/image-crop\/?filename=dsc00181.jpg&prefix=thumbnail&width=100&height=100&pages_id=1023&field=cover&modal=1'>thumbnail<\/a><\/div>\n\t<\/li>","replace":false,"overwrite":0}] The PHP logs: [15-Apr-2015 21:45:34 Europe/Rome] PHP Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0 [15-Apr-2015 21:45:34 Europe/Rome] PHP Warning: Cannot modify header information - headers already sent in Unknown on line 0 [15-Apr-2015 21:45:34 Europe/Rome] PHP Warning: Cannot modify header information - headers already sent in /Users/andreamontaldo/Sites/siae-promo/web/wire/core/admin.php on line 15 [15-Apr-2015 21:46:41 Europe/Rome] PHP Notice: Undefined index: id in /Users/andreamontaldo/Sites/siae-promo/web/wire/core/Process.php on line 313 [15-Apr-2015 21:46:41 Europe/Rome] PHP Notice: Undefined index: id in /Users/andreamontaldo/Sites/siae-promo/web/wire/core/Process.php on line 313 [15-Apr-2015 21:46:41 Europe/Rome] PHP Notice: Undefined index: id in /Users/andreamontaldo/Sites/siae-promo/web/wire/core/Process.php on line 313 [15-Apr-2015 21:46:41 Europe/Rome] PHP Notice: Undefined index: id in /Users/andreamontaldo/Sites/siae-promo/web/wire/core/Process.php on line 313 [15-Apr-2015 21:46:41 Europe/Rome] PHP Notice: Undefined index: id in /Users/andreamontaldo/Sites/siae-promo/web/wire/core/Process.php on line 3131 point
-
I think it is much easier to manage this kind of redirects with modules rather than manually in htaccess. Check those out: http://modules.processwire.com/modules/process-jumplinks/ http://modules.processwire.com/modules/process-redirects/ Sorry for not answering your question directly, but I am really sure it is a better way (as you do not have to care about manually upgrading htaccess while upgrading Processwire).1 point
-
we would need to see the output, not only the php code - i don't think there is anything in your code that would cause the form to submit twice; it probably has to do with how you are using the hanna code; can you post the html output? this form posts to itself, so somewhere in there some variable is allowing it to process twice. this PHP file also needs to have access to the api since you are using api vars. http://cheatsheet.processwire.com/ so it can't be a file just sitting in the root, in case that's what you are doing - it needs to be a template file; you might want to test this not using a hanna code and see if that works; you could simply make a template for the contact page and then include that file there.1 point
-
// maybe a link to the PDF is enough echo "<a href='{$page->showPdf->url}' target='_blank'> download a nice PDF here </a>";1 point
-
I did not mean to criticise or offend you. Its great that you shared your work.I just did not understand what made you write the module and not use the other one from the intro provided with this post and thought it might be of help if you tried to answer that question here. I asked for the USP if you want to call it that way.1 point
-
Hello cstevensjr, Hope you're fine. In this case, enough secure not to risk compromising the website via it I suppose. I thought about this form again yesterday. I've just tried to comment out if(empty($emailTo)) $emailTo = $users->get($config->superUserPageID)->email; but it doesn't change anything apparently. EDIT: online debuggers say I have a problem (starting) at the following line: 'Nom' => $sanitizer->text($input->post->fullname), Ex.: PHP Notice: Undefined variable: sanitizer... PHP Fatal error: Call to a member function text() on null in... Or Fatal error: Call to a member function text() on a non-object on line... I don't know if it's related in some way to the issue I have.1 point
-
Thanks for all the praise and feedback. Unfortunately it's a theme that the client wanted and bought. So we are aware of those problems but are not going to change it as the it was never planned and no budget.1 point
-
Looks really nice soma. Just wondering the reasoning behind the fake scrollbar? It is actually quite hard to drag - testing on Chrome/OSX. You have to get the very left edge of it - any further right and you hit the window resize handle. It reminds me of IE's scrollbar-base-color. For those too young to have ever used this: https://msdn.microsoft.com/en-us/library/ie/ms531155%28v=vs.85%29.aspx1 point
-
1 point
-
Hi BernhardB, Thanks You are right, thanks for mentioning this. I'll add the check! The current system is secured that you must choose the templates allowed to generate PDF files. If a user does change the page ID and the template of the requested page is not allowed to create PDF's, nothing happens. However, if the template can generate PDFs and at the same time has restricted access, then this is a problem.1 point
-
Locking in LazyCron is done with a file (https://github.com/ryancramerdesign/ProcessWire/blob/dev/wire/modules/LazyCron.module#L149). That works no matter how your module is called or instanciated.1 point
-
thank you for that suggestion - unfortunately that has no effect. ha - often asking for help brings up the solution: saving the field before adding the new file does the trick $page->codefile->removeAll(); $page->save('codefile'); $page->codefile->add($filename);1 point
-
@Soma I agree with avoiding new window links, the reason I was going use that for the blog is because my blog is a tumblr blog that doesn't have a way back to my site.... well now it does, I spent some time customizing my tumblr template to have the same branding and menu as my website, so now they are all self links. I just made my first Processwire site live! www.markojokic.com The home page menu is made with MarkupSimpleNavigation -> I made a dummy page for the external blog link, whose template uses a URL Field for my tumblr link (ext_url). Each child page has an images field called "gallery_preview_image". Both of these were taken care of easily in the "item_tpl" line below, which is one of the options for MB. That little piece: {ext_url|url} uses the ext_url field if it exists, if not then just regular url. (Am I right about that?) 'item_tpl' => '<a href="{ext_url|url}"><img src="{gallery_preview_image}" class="img-responsive"> <h1>{title}</h1></a>', This ended up being a simpler option than MB since my page tree is straight forward, other than the one external link. @kongondo I actually built the menu out in MB as well, and I realized that it is for more specific needs. I really liked being able to add pages regardless of my site structure. I will be coming back to it for other sites I plan to build. Thanks both for the assistance/lessons. Honestly I am not ready for the depth of all of the answers I got, but I am pretty sure I will be referring back to this thread in the future for reference, and to try some of the more advanced concepts out. My head's spinning after redoing my whole site in Processwire over the past few days, but I am loving it!1 point
-
Same issue as you got here https://processwire.com/talk/topic/5857-using-pages-in-custom-function/?fromsearch=1 and lostkobrakai explained there too ...1 point
-
I'm talking about actual copy&past of the array. Nothing fancy here. $this->addHookBefore('InputfieldForm::render', $this, 'modifyMarkup'); public function modifyMarkup($event){ $form = $event->object; $form->setMarkup($yourModifiedMarkupArray); }1 point
-
1 point
-
@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.1 point
-
@markoj There's plenty of options to handle opening link in new window. But you shouldn't. http://www.smashingmagazine.com/2008/07/01/should-links-open-in-new-windows/ If you still insist. You can for example use jQuery. $("a[href^='http://']").prop("target", "_blank"); Or a hook with MSN to modify item string: https://github.com/somatonic/MarkupSimpleNavigation#hook-for-custom-item-string-new-in-120 $nav = $modules->get("MarkupSimpleNavigation"); function myItemString(HookEvent $event){ $child = $event->arguments('page'); // current rendered child page // any logic with $child possible here if($child->ext_url){ // set the return value of this hook to a custom string $event->return .= "<a href='$child->ext_url' target='_blank'>$child->title</a>"; } } // setup the hook after on "___getItemString($class, $page)" method $nav->addHookAfter('getItemString', null, 'myItemString'); echo $nav->render();1 point
-
1 point
-
I'll make this quick since these are pretty boring given the fact that in both cases, the original design was not done by me but is based on print designs originally intended for flyers. Both sites actually belong to the same client, a local non-profit organization providing help and counceling for women (abuse, domestic violence, mobbing, stalking but also pregnancy, divorce etc.). Both sites used to be static pages (both technically and design-wise), they have now been upgraded to responsive designs powered by PW. frauennotruf-oh.de (the main site of the organization) maedchenberatung-in-oh.de (a one-pager tailored to girls and young women who prefer counceling via email) The most remarkable part was (once again, I might add) how easy it can be to convey using a CMS with PW. None of the client's editors had ever worked with a CMS before, yet we still managed to get the CMS training done in 90 minutes for both sites. Everyone was pretty surprised how easy it can be to manage your own website with PW.1 point
-
Teppo got me to realize that I can simply do $page->$field->address = $value. So now map marker address can be imported which means it's time to tackle the repeaters... oy.1 point
-
With further analysis I have found I was wrong about the use of Ajax. The client side script in InputfieldFile.js was using Ajax based file upload but it was just not working and not returning any errors. As soon as I commented out the following code block and replaced it with InitOldSchool() both image and file uploads worked fine not using Ajax. * if (window.File && window.FileList && window.FileReader && $("#PageIDIndicator").size() > 0) { * InitHTML5(); * } else { * InitOldSchool(); * } So any guess as to why Ajax based file uploads have stopped working or how I can debug this? I have tested this on both IE, Chrome and FF with no change. It must be a hosting config issue.1 point
-
New addition: retinafy! this was created on request from @jjozsi here in this post. . * retinafy // create a pageimage with any method you like $image = $page->images->first()->size(400, 300); // call retinafy on it echo $image->retinafy(); // it outputs a markup string like this, where width and height is populated with half the sizes of the pageimage <img src="/site/assets/files/1234/basename.400x300.jpg" width="200" height="150" alt="description" /> . . The default markup template has the default replacements URL, WIDTH, HEIGHT and DESCRIPTION. <img src="[URL]" width="[WIDTH]" height="[HEIGHT]" alt="[DESCRIPTION]" /> You can change that to any markup you like in the modules Configpage! . . If you have additional properties populated with pageimages in your system, you can provide an array with those property names: // if you need custom properties in your markup, define the template in the modules config page with those placeholders, // please only use UPPERCASE and wrapp these [ ] around them <img src="[URL]" width="[WIDTH]" height="[HEIGHT]" data-custom1="[CUSTOM1]" data-custom2="[CUSTOM2]" /> // call retinafy with custom property names $customPropertyNames = array("custom1", "custom2"); echo $image->retinafy($customPropertyNames); // it outputs a markup string like this, where width and height is populated with half the sizes of the pageimage <img src="/site/assets/files/1234/basename.400x300.jpg" width="200" height="150" data-custom1="custom-value-1" data-custom2="custom-value-2" /> . . Regarding to the technique described in the article @jjozsi linked to in his post it would make much sense to use a low quality setting sitewide by defining it in the ImageSizerOptions, also available on the Pia Configpage. Otherwise, if this is not possible, you need to call your images for that you want the retinafy markup with the quality option set: // create a pageimage with any method you like echo $page->images->first()->size(400, 300, array("quality"=>35))->retinafy();1 point
-
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 Link1 point
-
New addition to contain: weighten! If you want to put some images of different aspect ratio onto a webpage and you want that they are displayed more equal visual weightened, you can use this method and options now: . * contain with option weighten $image->contain('square=90, weighten=on'); . . There is also the possibility to prioritize portrait or landscape oriented images: . $image->contain('square=90, weighten=x1'); // landscapes are a bit larger than portraits $image->contain('square=90, weighten=x2'); // landscapes are a bit more larger than portraits $image->contain('square=90, weighten=y1'); // portraits are a bit larger than landscapes $image->contain('square=90, weighten=y2'); // portraits are a bit more larger than landscapes . . Have a look to this output here: . . . . . PS: @Martijn: I have taken your code for the calculations and set the percent value hard coded to 38. This way we only need to turn weighten on or off and have not to deal with values here. The only thing I have added to the calculation is an adjustment to fit better with the largest dimension into the initial bounding box dimensions. (Github)1 point
-
Hi Horst, Many times I need to output a lot of logo's. Those logo's need to have the same visual weight. Some logo's need to be wider others need to be higher. May I purpose a new method 'logo' or something ? Pia is dancing nicely with crop contain and cover, but could you let her swing with logo ? I have a starting point here that works great (used it many times)1 point
-
@Adrian: thanks for the feedback. Here she is a bit to modern I believe. I will change this soon!1 point
-
thanks for the nice words. 1) unfortunately Pia only assist with preparing and delegating values to the images engines. She isn't able to process images by herself. What you are requesting is "canvas", it is provided by Pim. I don't know yet if Pia dynamically should support shortcuts depending on other installed modules or not. It can become a bit confusing. On the other hand I see how comfortable it could be if Pia would assist here too. 2) I will do so when finding a bit time for it. yes, she is!1 point
-
Was going to mention this earlier but it slipped my mind, so: Nico, what's your take on the storage method this module uses (saving all content to module config, i.e. the data column of related Modules table entry) and the obvious limitations it causes? Based on some quick testing, using suggested description length, this module should be able to store data for roughly 300 pages -- though actual number depends a lot on the stored data itself. I was just wondering if it would make sense to reconsider the storage method, offer an alternative method for large sites, mention this somewhere.. and/or perhaps make the module aware of how much "quota" it still has? I'm asking 'cause this seemed like an interesting choice for some of our sites, but it's not that rare for those to have hundreds or even thousands of pages.. so if the client ever gets too enthusiastic, there's going to be a problem Also: you might want to add garbage collection for removed pages. That's going to limit the scope of aforementioned scalability issue a bit.1 point
-
yep referring to that. But thanks for the great list I did have an overview of the page you linked to. Lisandi, when you want a module that controls it all you're left with a tool build on assumptions. Nico has build a great tool especially for the smaller websites. We're in a business sending 100.000+ newsletters a week. We have 4 big news portals and multitude of articles are published everyday, you have to automate SEO (read custom build functions). No ready to use tool could be used here, many things can't be controlled in a reasonable way with inputfields and you can't have one tool to do the job.1 point
-
Andi, nico has build an SEO tool not an encyclopedia.1 point
-
1 point
-
Just a couple of notes - firstly, for anyone reading into throwing 404s in ProcessWire the preferred (as in used more in code samples here) way of doing this now seems to be this: throw new Wire404Exception(); Also, I tried using an include file at the top of my template called global.inc that does some global bits and pieces and I noticed that it seems impossible to throw Wire404Exception in an included file - it amusingly throws an exception1 point
-
Well you've come to the right place, because a very high percentage of messages posted here have snippets of code. At least half of the messages I post have at least some code snippet. But we really try to focus on using code snippets to teach, and not so much for copy/paste. The reality is that ProcessWire is quite simple once you have a few basic concepts down. And once you've got them, you won't care about copy/paste, because you'll know how to do anything you could ever want. So our goal here is always to teach you how to fish rather than give you fish. That being said, there are no rules in that regard and all useful snippets are welcome.1 point