Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/23/2015 in all areas

  1. ∞Textformatter Normalize UTF8 uses a lightweight PHP class (Patchwork UTF-8) for UTF8 normalization. Use it if .. If you check the page with the W3C HTML5 validator, you'll maybe get the following warning: Text run is not in Unicode Normalization Form C. Or if you notice strange output in some browsers (bold letters, shifted characters, ..).What it does In Unicode it is possible to produce the same text with different sequences of characters. For example, take the Hungarian word világ. The fourth letter could be stored in memory as a precomposed U+00E1 LATIN SMALL LETTER A WITH ACUTE (a single character) or as a decomposed sequence of U+0061 LATIN SMALL LETTER A followed by U+0301 COMBINING ACUTE ACCENT (two characters). világ = világ The Unicode Standard allows either of these alternatives, but requires that both be treated as identical. To improve efficiency, an application will usually normalize text before performing searches or comparisons. Normalization, in this case, means converting the text to use all precomposed or all decomposed characters. There are four normalization forms specified by the Unicode Standard: NFC, NFD, NFKC and NFKD. The C stands for (pre-)composed, and the D for decomposed. The K stands for compatibility. To improve interoperability, the W3C recommends the use of NFC normalized text on the Web. -- W3C
    8 points
  2. There is quite a lot of WP bashing going on here in the forums. I can totally understand the reasons for that and agree with most of what is being said. What I don't understand is why people feel the need to go into this over and over again. No offense intended here. I think that in the long run people who responsibly build and maintain websites will eventually move away from WP to other platforms like PW. I introduced PW to an agency that I'm freelancing for and since then they started to do most of their projects with PW. Seeing the fast growing PW community also indicates that people are able to make choices based on their experience with other platforms and what they see can be achieved with PW. From an energetic point of view it is preferable not to put your energy into something that you don't want or like. Any energy that we put into those things will most likely help to support them even if we don't intend to do so. So I just leave WP be what it is and concentrate on all the wonderful things that I can do with PW
    6 points
  3. Luckily I do not have to work with WP sites, as I'm also build very less sites, mostly private things. There is only one site that was built with WP, it's a private site for my son and me. We haven't made any updates to it since two years. And I want to port it to PW since I know PW, but haven't found the time until now. My 10 years old son has made some photos that he wants to see on the homepage there and I need to remember where the admin / backend / login page was. I tried some URLs that all fail. Than I opened a FTP client and looked to the directory structure and found the name of the subfolder which contains the wp-admin folder. After typing this URL and failing again I got a bit dazzled and was talking / grumbling to myself. My son began to laugh and rolling over the floor and shouts: "You are not able to write wp-admin you have written pw-admin. Everything you can think of is PW!". And he is right: after finding PW, I just want to wipe out any past memory regarding WP. After porting this site I can fullfill this to 100%. Until then I have to live with mistakes like pw-admin.
    5 points
  4. ProcessWire API has methods for session handling: $session To set your custom session variable you can use $session->set($name, $value) or $session->$name = $value and later retrieve it with $session->get($name) or $session->$name So in your case it would be if($config->ajax) { $session->test = "test"; } Here test will only be set if you make an ajax call to the page. From your question it is not clear whether you made that ajax call before trying to get the test value on a normal page load. To retrieve the value you can use $test = $session->test;
    3 points
  5. Thank you horst, this is exactly what I was looking for. For those interested, this is my working module below, which adds in icons based on an select options field. <?php class DynamicIcons extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Dynamic icons for the page tree based on field values', 'version' => 1, 'summary' => 'Module to change the icon on the page tree depending on field values.', 'singular' => true, 'autoload' => true, ); } public function init() { $this->addHookAfter('ProcessPageListRender::getPageLabel', $this, 'addPageListLabelItems'); } public function addPageListLabelItems($event) { $page = $event->arguments('page'); $page->of(false); // Check options field for correct value if($page->content_type == '1') { // Add fontawesomeicon $styleItem = "<i class=\"fa fa-file-text-o\"></i>"; // Add to pagetree $event->return = $styleItem . $event->return; } } } (This just shows one options but obviously you could add in additional icons for different field values)
    3 points
  6. I've just found the Killer Wordpress Checklist... http://capsicummediaworks.com/killer-wordpress-checklist/ Beside it is funny to read points like these (with some comments compared to PW): development and launching checklist have some very general hints so the are in fact important but some special WP ones i'm getting some bad feelings... Change DB Table names (kidding?) Delete Sample Config File (what?) Remove Default Content (this i've done with the installation?) Make a Plugin List - few recommended Plugins <about 20 items list> (Hmm lets see i think i need my favorite 5 Helper modules to get started and watching for special needs) Implement Security (Is this weird my whole cms should be secure i need not to "implement" this..hmm) And at the end the two funniest points are for sure security and maintaince...some hand picked prevent directory access (PW default) use iThemes Security (Ahh right i've to implement security somehow...no need in PW) The most points are very general on Webdesign or building a blog...but some funny things are listed and it such "lists" are maybe a Marketing Tool if some designer have spare time we could setup a sleeker checklist for a "best practice" PW website? regards mr-fan
    2 points
  7. Actually there are some useful tips on the checklist that are valid for many CMSes too (and also for WordPress ). Bashing WP is something people devs would normally do in a Pub - but wait, aren't we there?
    2 points
  8. Hi @tourshi, welcome to PW. If you want do "things" with / from a page in a function, you best pass the $page as parameter or get its handle with the wire() function: function getTitle($page) { $t = $page->title; function getTitle() { $page = wire("page"); $t = $page->title; But if you only want one of two field values, depending if it is populated or not, as I can see from your code, you don't need a function for that. You can use it directly in your template with an OR selector as follows: $t = $page->get("long_title|title"); This will give you the value of long_title if there is one, OR, if it is empty, it gives you the value of title. Coming back to the function: fastest way is to pass the variable into the function, because the variable is an object what is passed by reference. There is no drawback or overhead, its the fastest way. If you, for what ever reason, cannot pass a API variable to a function, you always can get there handles via the wire("nameofapivar") function. This works everywhere, but has a (very little) overhead. Also I don't think it is measurable with a few calls, (less than 100).
    2 points
  9. I like the "increase memory limit" part the best Btw here's an Advanced WordPress Development Checklist: DONT
    2 points
  10. Pia - Pageimage Assistant Hello, today I can tell you that Pia Ballerina want to assist you with Pageimages and that can become really helpful! . . . Pia, in its current state, version 1.0.0, provides: a GUI (the module config screen) for quick and easy changes to the sitewide Pageimage default options an alternative way for calling the Pageimage resizing methods with PW selector strings three new methods as shortcuts to the resizing functions a new method called retinafy and its alias hiDPI, (introduced in version 0.2.0) . . . 2) Instead of ->width(), ->height(), ->size() you can call ->pia() now. With a PW selector string you tell Pia what image variation you want to have : . $image->pia("width=100, quality=80, sharpening=medium")->url; . If you want process ->width() just define width. If you want process ->height() only define height. If you want process ->size() just define width and height. If you want process ->size() with equal values for width and height, just define only size, or use the alias square: . $image->pia("width=480")->url; $image->pia("height=320")->url; $image->pia("width=400, height=300")->url; $image->pia("size=350")->url; $image->pia("square=350")->url; . So, yes, - I see. Now you may think: "Ok, nice looking girl, - and she can dance very well, - but for what should it be good that she is involved here? My very old buddies width, height and size - and me, - we don't need any Ballerinas between us!" . Yeah, I see what you mean. But this above is not what Pia is good for, this is just a little warming up for you. . In some cases one need to specify more than just width and / or height. If it comes to that you need explicitly populated options with the individual pageimages, Pia will become faster and more comfortable at some point. Also the code is looking more readable with Pia, at least to me: . // regular style #1: $image->width(800, array("upscaling" => false, "cropping" => true, "quality" => 80, "sharpening" => "strong")); // or regular style #2: $options = array("upscaling" => false, "cropping" => true, "quality" => 80, "sharpening" => "strong"); $image->width(800, $options); // now lets Pia dance: $image->pia('width=800, upscaling=0, cropping=1, quality=80, sharpening=strong'); $image->pia('width=800, upscaling=off, cropping=on, quality=80, sharpening=strong'); . For me it is that not only Pia begin to dance, my fingers do so too when writing selector strings instead of the regular array code. . Ok, last thing before we can go to stage: "You already may have noticed that Pia accepts few different values for boolean expression, yes?" for TRUE you can write these strings: "1, on, ON, true, TRUE, -1" for FALSE you may use one out of "0, off, OFF, false, FALSE" Ready? Ok, lets go to stage. . . . 3) Pia provide three new methods as shortcuts. This means that when using one of the shortcuts you have pre-populated options, regardless of the sitewide default settings: crop :: does what the name says contain :: is equal to the regular method: ->size($width, $height, array("cropping" => false)) cover :: this, Pias third child, is a new kid on the block . Let's have a closer look and compare it. We use Pias image from above as source for this example. (It's dimensions are 289 x 400 px) . . * crop $image->crop('square=100'); . it is 100 x 100 px and the name is: pia-ballerina_titel.100x100-piacrop.jpg . . . * contain $image->contain('square=100'); . it is 73 x 100 px and the name is: pia-ballerina_titel.100x100-piacontain.jpg . . . * cover $image->cover('square=100'); . it is 100 x 139 px and the name is: pia-ballerina_titel.100x139-piacover.jpg . . . Ok, you got it? . "Crop" crop out the area, "Contain" fits the image into the area, and "Cover" calculates the needed dimensions for the image so that the area is completly covered by it. . Following is a link with lots of those crop-, contain-, cover- variations. I have stress-tested it a bit: much variations . ---------- . . Later Additions: . * contain with option weighten Since version 0.0.6 contain can take an additional param called "weighten". (read more here) . . . * retinafy Since version 0.2.0 retinafy is added. It returns a markup string, e.g. a HTML img tag, where placeholders are populated with property values from the pageimage. Default properties are: URL, WIDTH, HEIGHT, DESCRIPTION. The method also can take an optional array with CustomPropertyNames. You also can use the alias HiDPI if you like. (read more here) . . ---------- . . You can get the module from the modules directory or from the repo on Github: . git clone https://github.com/horst-n/PageimageAssistant.git your/path/site/modules/PageimageAssistant . . Bye! . Classical ballet performance at the Aalto Theatre in Essen, in the context of the Red Dot Award ceremony 26 June 2007, Act III, Sleeping Beauty, the wedding reception Photos: Horst Nogajski - www.nogajski.de
    1 point
  11. Hi, I have a client which has a PageTable with a long list of PageTable entries. He feels annoyed that he has to scroll down the whole list in order to see the "Add" buttons at the bottom of the list. I would like to build a module which adds a second set of "Add" buttons at the top of the PageTable. I took a look at InputfieldPageTable.module and can see that the buttons get added in the function "___render" at line 117: // render the 'Add New' buttons for each template $btn = ''; foreach($this->rowTemplates as $template) { $button = $this->wire('modules')->get('InputfieldButton'); $button->icon = 'plus-circle'; $button->value = count($this->rowTemplates) == 1 ? $this->_x('Add New', 'button') : $template->getLabel(); $url = $this->wire('config')->urls->admin . "page/add/?modal=1&template_id=$template->id&parent_id=$parentID"; if($this->nameFormat) $url .= "&name_format=" . $this->wire('sanitizer')->entities($this->nameFormat); $btn .= "<span class='InputfieldPageTableAdd' data-url='$url'>" . $button->render() . "</span>"; } $out .= "<div class='InputfieldPageTableButtons ui-helper-clearfix'>$btn</div>"; Since there is no hookable method for adding the buttons alone, I think that there are two routes to take now: - Replace the whole ___render() method or - call the existing render method and parse the $event->return for css class "class='InputfieldPageTableButtons" and copy it on top of $event->return (DOM manipulation) Both ways feel clumsy and not future-proof in case of PageTable module upgrades. Is there a better route I should take?
    1 point
  12. It would be awesome users could size their images for the RTE (rich text editor) using preset cropping sizes. This could really help ensure consistency across a site for editors that need to add images and reduce the amount of training needed when dealing with images. third part image crop fields do this really well, but do not offer a way to use the crops in the RTE. Image: Look next to the cancel button, there is a pulldown for image size presets. Drop down menus allows users the ability to select some preset image cropping dimensions. Crop guides would keep the aspect ratio, and return the desired image size. Pick custom size and the cropping guides would work as they normally do (free form) Other approaches: ProcessPageImageSelect could be made hookable in a way that images from third party image modules can add images to the RTE image selection page. i've been trying to get a preset image crop sizes into the RTE editor for a while now. I tried to use the hooks in ProcessPageImageSelect in-combination with the CroppableImage module but there is no hooks for this as (as far as I know). $this->addHookAfter('ProcessPageEditImageSelect::execute', $this, 'HookPageImageSelect'); The hook above will allow me to add images to the image selection modal, but I still can't get images that image to be addable to the Rich Text Editor on click. I was able to get the desired functionality by modifying core module ProcessPageImageSelect. Maybe if ProcessPageEditImageSelect->getImages() was hookable images from other modules could be added without modifying core modules.
    1 point
  13. For a PageTable field, I have selected multiple templates that are allowed as items, and I entered an automatic page name format. It seems that even though this can be entered, the automatic page name format only applies in the same circumstances as for when adding pages, i.e. when only one template is allowed as child. 1. I would suggest to add the following to the description for automatic page name format entry for PageTable fields: "In order to work, a single (1) template must be selected for the "Select one or more templates for items" field on the Details tab." 2. How can I get around this restriction? It is for maintaining parts of a page, where the name really does not matter at all - and it is only confusing my users that they need to enter just anything to proceed. I am assuming this will be "solved" for PageTable fields as soon as it is "solved" for adding pages in general - I looked into this before but go stuck: https://processwire.com/talk/topic/9979-name-format-for-children-for-multiple-allowed-templates-for-children/ Can someone help on where to hook to in order to also "catch" pages that allow multiple templates as children in order to jump the Add Page screen? Thanks a lot!
    1 point
  14. For the PageTable field, when allowing lots of templates, I think there should be some space between the rows of buttons. See for example:
    1 point
  15. 1 point
  16. Great that you got it working, however you need to upgrade your PHP from 5.2.x at your earliest convenience. That version has been depreciated for quite some time.
    1 point
  17. Got it working! I had a zipped copy of the version of PW I had installed, and replaced the wire directory with the old version. It must have been something with the file system...which is strange. I'll keep an eye on things but a little worried it'll happen again. Thanks for jumping in and helping out cstevensjr
    1 point
  18. Troubleshooting your issue is not impossible, however you should know that you first need to seriously think about making some changes to your website configuration. The requirements for Processwire 2.0 are: REQUIREMENTS --------------------------------------------------------------------------- 1. A web server running Apache. 2. PHP version 5.2.4 or greater. 3. MySQL 5.0.15 or greater. 4. Apache must have mod_rewrite enabled. 5. Apache must support .htaccess files. I'm quite sure there still are individuals that can remember or still support that version. Hopefully they will chime in to help solve your present issue. Otherwise, There are very detailed instructions on how to upgrade Processwire (even from version 2.0) at: https://github.com/ryancramerdesign/ProcessWire Suggested places to start: 1. Ensure that you are running at least PHP 5.3.8 at a minimum. Note: The latest version of PHP available to your hosting platform would be preferable. 2. Follow the detailed instructions to bring ProcessWire up-to-date. The current official release or the previous release (2.5.x) is where you should be trying to get to. 3. If you still are having problems after upgrading, please come back here (letting us know what PHP, MySQL, and ProcessWire versions you are running) and we will be better able to assist you
    1 point
  19. Nothing should break the pw bootstrap process, this topic is about the security issues of skipping it. The .htaccess line which prevents the polymer loading is blocking access to .php/.tpl/.inc and .html (see first post). The first three file extentions do have the potential to be dependent on processwire runtime variables, therefore accessing them should be handled by processwire. The last extention is in that rule, because before polymer nobody needed to access .html files directly from the client. They were only used by the .php files internally. So it was in the best interest to block access to them, too, so users cannot access those html chunks. Now with polymer that's not the case anymore, so just remove the .html from the rule to use them with polymer. Allowing more subfolders is also possible by editing the .htaccess rules and as long as there are only static files (js/css/html/img/…) it should not matter from a security standpoint.
    1 point
  20. No need to feel sorry at all I didn't take any offense from your post. Guess, you took a look at that list for a reason. If that reason is you having to setup a WP-site then I feel sorry for you. (Now I'm being the WP-basher ) @tpr I really like your constructive approach to the topic
    1 point
  21. Maybe it is possible for you to switch to croppableImages as it returns pageimages that you can resize further. The original CropImage does return a URL, not a pageimage object.
    1 point
  22. @gebeer You are completly right! Sorry for that post...it just was some irritation for me to read some points on this list...since they are not akzeptable and sounds weird. It's a common kind of organisational blindness, every System like PW, too can fall into such structures. It's a great luck that Ryan sensitive checks all benefits of a new feature and how it helps to make PW better. But you are completly right bashing is not good - and i wouldn't appear arrogant. Just was confused at the first deeper view of this list. Sorry mr-fan
    1 point
  23. I think it has to do with people like Jeffrey Zeldman, he likes wordpress and founded Alistapart. We all know Alistapart has done very good for the web developing world.
    1 point
  24. Sorry, in a bit of a rush, so I won't answer your question directly, but if you want to generate an export specifically for Excel, I would take a look at making use of something like: https://phpexcel.codeplex.com/ If you want to stay with the CSV route, the Batch Child Editor module (https://processwire.com/talk/topic/6102-batch-child-editor/) might satisfy your needs. It comes with an admin CSV export, and also an API method that can be used like this: // delimiter, enclosure, file extension, names in first row, multiple field separator, array of field names $page->exportCsv(',', '"', 'csv', true, "\r", array('title','body','images','textareas')); This will export the defined fields from all child pages of the current page. Of course I don't know your exact needs, but thought I'd point out these, just in case they are useful.
    1 point
  25. I really loathe this "Strategy" it's not flexible and quite difficult to have logic in it, I prefer using this method, not sure what to call it <?php $Data=$pages->get("name=team-members"); $content=wireRenderFile("ui/about.php",array( "item"=>$page, "members"=>$Data->children() )); it's highly flexible and you can have logic in it with ease and even swap out templates based on the condition.
    1 point
  26. That's my article, using Ajax is quite easy in PW, just make an Ajax call to your page, now the HTTP Header contains Ajax header in it, so $config->ajax will flag as true when it is an Ajax call and false if not, Do this 1. Make an Ajax Call to the Page 2. var_dump something if Ajax and exit and you will see your result 100% cleaner than WordPress and i stick to that statement, also thanks for reading my blog. If you have something you want me to write on please let me know, quite bored at home.
    1 point
  27. Hey, here is the most recent website I build: http://www.wimacamp.de/ What do you think?
    1 point
  28. One way can be to not set an default icon to the template(s) but set it manually like here with other things: https://processwire.com/talk/topic/5609-display-a-template-icon-base-on-date-field/ I use this in a project where I need to show the workflow states and the current authors shortcut. There are used 3 different icons and 3 different colors. public function addHookAfter_ProcessPageListRender_getPageLabel($event) { $page = $event->arguments('page'); if ('aki-faq' == $page->template) { $iconTpl = $iconTpl1 = '<i class="icon fa fa-fw fa-file-text [_STATUS_]"> </i>'; $iconTpl2 = '<i class="icon fa fa-fw fa-check-circle-o [_STATUS_]"> </i>'; $iconTpl3 = '<i class="icon fa fa-fw fa-newspaper-o [_STATUS_]"> </i>'; if ($page->editStatus > 2) $iconTpl = $iconTpl2; if ($page->editStatus > 5) $iconTpl = $iconTpl3; $icon = str_replace('[_STATUS_]', 'editStatus' . $page->editStatus, $iconTpl); $kuerzel = str_pad($page->aki_bearbeiter->kuerzel, 3, ' ', STR_PAD_RIGHT); $bearbeiter = (0 == $page->aki_bearbeiter->id || false === $page->aki_bearbeiter) ? ' <span class="akiPageListItem kuerzel warning">---</span> ' : ' <span class="akiPageListItem kuerzel">' . $kuerzel . '</span> '; $event->return = $icon . $bearbeiter . $event->return; } }
    1 point
  29. You could add them with some JS with Admin Custom Files http://modules.processwire.com/modules/admin-custom-files/ Something like: $(".InputfieldPageTableButtons").each(function(){ $myButtons = $(this); $myTableContainer = $myButtons.closest(".InputfieldPageTableContainer"); $myButtons.clone().prependTo($myTableContainer); }); (written in the browser and not tested)
    1 point
  30. I had already reported this issue on Github, where I posted a problem-solution that works. Hope it helps. https://github.com/kongondo/MenuBuilder/issues/22 David
    1 point
  31. You may do this by a module like that: public function init() { $this->addHookAfter('ProcessPageListRender::getPageLabel', $this, 'addPageListLabelItems'); } public function addPageListLabelItems($event) { $page = $event->arguments('page'); // then you do your conditionals and your styling, like for example: if($page->myField >= $myMinValue && $page->myField <= $myMaxValue) { // add your styling here } // or like that: if('architekt'==$page->template) { // add the styling here $styleItem = $page->ortarchitekt == '' ? ' <span class="jhpPageListItemEmpty"><strong style="color:white">kein Ort eingetragen</strong></span> ' : ''; // now add the new style item to the existing output $event->return = $event->return . $styleItem; } } This way I get outputs like that: EDIT: Ah, have found it: here is a module from Soma: http://modules.processwire.com/modules/page-list-image-label/ that adds a Thumbnail to the list. That was the startingpoint for my customized PagetreeList. If you are not (yet) familiar with modules please have a look to the HelloWorld-Module or ask here for further assistance
    1 point
  32. This is not a straight answer to your question but if you work a lot with messy data, cleaning and data transformation you could take a look at Google Refine . This is a really powerfull tool and not hard to use. I haven't used it for a while but i think it would be quite easy to transform the data to the format you desire.
    1 point
×
×
  • Create New...