Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/29/2014 in all areas

  1. PlaceholderImage A simple placeholder class to generate base64 data uri string that can be used to create placeholders for prototypes or as placeholders for lazy-loaded images. Original credits for the PHP Class go to Patrick van Marsbergen. https://github.com/marsbergen/PHP-Placeholder Use this module in templates to generate placeholder images. It doesn't create a physical image but a base64 data uri string to use as the src of image tag. You can get the base64 code or the complete img tag for convenience. Example chained call: $base64 = $modules->PlaceholderImage->width(640)->height(480)->background('DDDDDD')->render(); Then insert the string as the src like: <img src="<?php echo $base64?>"> Or pass true to render() to get a complete <img> tag $imgTag = $modules->PlaceholderImage->width(640)->height(480)->render(true); Or static calls for convenience: $base64 = PlaceholderImage::image(150,100); $base64 = PlaceholderImage::image(150, 100, 'FF0000', 'FFFFFF', 'Custom text'); $imgTag = PlaceholderImage::imagetag(150, 100, 'FF0000', 'FFFFFF', 'Custom text'); Github repo https://github.com/somatonic/PlaceholderImage On PW modules http://modules.processwire.com/modules/placeholder-image/ Live Example on lightning.pw http://radium-0rq.lightningpw.com/
    12 points
  2. Here is a beta version for anyone who wants to test. [updated Link Below] Use an asterisk to specify a wildcard. Example: /somepage/* This will (should) catch everything under /somepage/ The main differences: - Hook is now "addHookBefore" - SQL has changed to allow searching for wildcard - Alternate Domain config field under module settings.
    5 points
  3. Add this to your site/template/admin.php before the require() line in there $whitelist = array( '127.0.0.1' ); if(in_array($_SERVER['REMOTE_ADDR'], $whitelist)){ if(!$user->isLoggedin()) $session->login("admin", "xxx"); }
    5 points
  4. Hi aren, I just committed an update to Custom Upload Names for you. It now has an option to generate a random string at a length of your specification. Please take a look and let me know if you need any assistance.
    4 points
  5. When I have done this before, I have grabbed the page id and used that. $faq->id Saves a lot of messing with counts (careful how you say that in your dublin accent) Edit - Damn, Kongondo got there first! Also, I think there is a thing about using a number for a class or id in css, so you need to do something like: href='#accord{$faq->id}' And the the corresponding id on the element in the same way
    3 points
  6. A small AdminCustomFiles hack to have all dropdowns open: #main-nav > li > ul{ display: block !important; } #main-nav > li { background-color: #e2e9ef !important; }
    3 points
  7. This is what you are looking for - some of teppo's handiwork https://processwire.com/talk/topic/6556-module-textarea-markup-inputfield/
    3 points
  8. I have tracked it down to this: The last executed Lines in FieldtypeFile.module are: public function getInputfield(Page $page, Field $field) { $inputfield = null; if($field->inputfieldClass) $inputfield = $this->modules->get($field->inputfieldClass); if(!$inputfield) $inputfield = $this->modules->get($this->defaultInputfieldClass); $inputfield->class = $this->className(); When this is called, $this holds an empty defaultInputfieldClass. Therefore $inputfield becomes null, what is returned from modules->get($this->defaultInputfieldClass) in line 58. (sure, it cannot get a module "") And thus it crashes! When the FieltypeFile is initialised, it has this line in construct(): public function __construct() { $this->defaultInputfieldClass = str_replace('Fieldtype', 'Inputfield', $this->className); } but in my case, at this time $this holds an empty className AND an empty defaultInputfieldClass. (it must have to do with load priority or if a module is autoload or not, I think) Later, when coming to getInputfield() at lines 56-58, className is populated with the right name! Now once more calling the line from constructor, it goes a bit further: if(!$inputfield) { if(!$this->defaultInputfieldClass) $this->defaultInputfieldClass = str_replace('Fieldtype', 'Inputfield', $this->className); $inputfield = $this->modules->get($this->defaultInputfieldClass); } $inputfield->class = $this->className(); It loads the Field-Editpage, but lacks a InputfieldType: Session: Missing required value (inputfieldClass) I think, somewhere between running the constructor and coming to getInputfield, there must be a same situation like above, where it fails to populate a variable, I think. Does someone know if Fieldtype- and / or Inputfield- modules can / should be set to autoload? Autoload doesn't help here.
    2 points
  9. I'd forget about incrementing anything...you already have unique numbers in page->id. Use faq->id and problem sorted, unless for some other reasons you need to start from 1....
    2 points
  10. @reems: in this case, you and your client have done it completely thewrong way around Your client has uploaded already compressed JPEGs (maybe with a quality of 80%) and you have rendered them uncompressed with quality 100. Your client should upload images with max quality and those originals never should passed as frontend output. They only should serve as source for variations! This way round you get nicer looking images, and if you need more compression than the GD-lib can serve, use Philipps service. . If you need, for what ever reason the exact original sized image output on frontend, you can call it like: $image = $page->images->first(); echo "<img src='{$image->width($image->width)->url}' />";
    2 points
  11. This has caught me out previously. The assumption in my head is that by setting it a hundred you are setting it to be the maximum it was originally, but of course, it doesn't work that way, it just produces a high quality version of what your image was. It doesn't look nicer, but all the original faults are being rendered wonderfully!
    2 points
  12. (If you used JPGs) You've set the quality to 100. While the reduced image with might make the image smaller, the higher quality level will render it at a larger size. This can result in larger file size..the problem you've probly encountered. This also happened to PNGs with PW 2.4 but I think it got fixed with 2.5... ? You could try to use a lower quality setting (IMO 100 is never useful) or use e.g. the ProcessImageMinimize module linked in my signature
    2 points
  13. This works with an autoload module hooking into ProcessPageEdit::buildForm() protected function hookPageEditForm(HookEvent $event){ $page = $event->object->getPage(); if($page->template == "basic-page"){ $form = $event->return; $contentTab = $form->find("id=ProcessPageEditContent")->first(); $field = $this->modules->InputfieldMarkup; $field->label = "Some Label"; $field->value = "Some Text"; $contentTab->prepend($field); } }
    2 points
  14. Jan's approach above would work but it is an all or nothing solution meaning, all members (irrespective of your 'sub-roles') will only be able to edit certain fields. If, however, you want say, Junior members to be able to edit fields A,B, Senior members A,B,D and Elder members A,B,C,D,E, then this approach would not work. For that you would probably need a module like 'Page Edit Field Permission' (Enables you to limit edit access (by role) to any field in the page editor.)
    2 points
  15. This is made by design to avoid problems with handling files on wide range of server OCs. At least, this is how I inderstand it. You can solve the problem by renaming files on upload with this Adrian's module. Have not tried it myself, so please report back if you choose to go this way )) Actually I would like to read more about this myself, if someone could share some links.
    2 points
  16. Now I have going true that list with no result. On some points even the homepage got 500 error but nothing helpt on the hole site. Solution was at the bottom in .htaccess file: (I changed the # as it says) # RewriteRule ^(.*)$ index.php?it=$1 [L,QSA] # ----------------------------------------------------------------------------------------------- # 500 NOTE: If using VirtualDocumentRoot: comment out the one above and use this one instead. # ----------------------------------------------------------------------------------------------- RewriteRule ^(.*)$ /index.php?it=$1 [L,QSA]
    2 points
  17. Hey Max, Try this in your template for the articles parent page: foreach($page->children as $article){ echo "<a name='".$article->name."'><h2>".$article->title."</h2> <p>".$article->body."</p>"; } That will create the posts one after the other with the title and body and with an <a name> tag that is the fragment identifier. The to link directly to a specific article it would simply be: www.mysite.com/posts/#post-name To create these links in your teaser section you might do something like this: $articles = $pages->get("/articles/")->children("limit=4"); echo "<ul>"; foreach($articles as $article) { echo "<li><a href='/articles/#".$article->name."'>".$article->title."</a></li>"; } echo "</ul>"; That should work just fine!
    2 points
  18. Since users are already simply pages under Admin->Access->Users, you probably won’t need to create separate profile pages. You can simply add more fields to the user template. All fields you add there will also apppear in the module configuration of the core module “User Profile”, where you can select those you want individual users to modify themselves. If you still want to use separate pages, you can bind them to users by adding a page-field to the user template. Hope this helps.
    2 points
  19. On the National Geographic case study, I found it interesting that the developers moved the whole site to ProcessWire in the background and *then* brought this up with the client. Had they asked if they could move from Drupal to PW, the answer would likely have been negative. Perhaps a risky strategy for some but as my old boss once said: "Ask for forgiveness. Don't ask for permission"
    2 points
  20. I pushed some updates to github. Outside cropping works now if $image->size() is called with height=0 or width=0. See my first post for updated API examples to get images with the same ratio as the focusarea Another thing I think I should mention: If you are testing the different cropping options make sure you prevent getting cached versions. In the moment you have to set the 'suffix' option by yourself. Maybe the module should to this automatically? (Edit: Since version 0.4.0 the suffix option is set internally by the module, I remove the suffix setting from the example code) btw, I do my testing like this: <?php $image = $page->focusimages->eq(0); $image->removeVariations(); $sizes = array( array(400, 400), array(400, 300), array(400, 200), array(400, 100), array(300, 100), array(200, 100), array(100, 100), array(100, 200), array(100, 300), array(100, 400), ); $croppings = array( // 'center', 'align', 'inside', 'outside' ); $upscaling = true; ?> <?php foreach ($croppings as $cropping): ?> <div class="row"> <h1>cropping: <?= $cropping ?></h1> <?php foreach ($sizes as $size): ?> <?php $img = $image->size($size[0], $size[1], array('cropping' => $cropping, 'upscaling'=>$upscaling)); ?> <div class="cropping-example"> <span class="info">Size: <?= $size[0] ?>×<?= $size[1] ?></span> <img src="<?= $img->url ?>" width="<?= $img->width ?>" height="<?= $img->height ?>"/> </div> <?php endforeach ?> </div> <?php endforeach ?>
    2 points
  21. This module adds CSV import and export functionality to Profields Table fields on both the admin and front-end. http://modules.processwire.com/modules/table-csv-import-export/ https://github.com/adrianbj/TableCsvImportExport Access to the admin import/export for non-superusers is controlled by two automatically created permissions: table-csv-import and table-csv-export Another permission (table-csv-import-overwrite) allows you to control access to the overwrite option when importing. The overwrite option is also controlled at the field level. Go to the table field's Input tab and check the new "Allow overwrite option" if you want this enabled at all for the specific field. Please consider limiting import overwrite option to trusted roles as you could do a lot of damage very quickly with the overwrite option Front-end export of a table field to CSV can be achieved with the exportCsv() method: // export as CSV if csv_export=1 is in url if($input->get->csv_export==1){ $modules->get('ProcessTableCsvExport'); // load module // delimiter, enclosure, file extension, multiple fields separator, names in first row $page->fields->tablefield->exportCsv('tab', '"', 'tsv', '|', true); } // display content of template with link to same page with appended csv_export=1 else{ include("./head.inc"); echo $page->tablefield->render(); //render table - not necessary for export - just displaying the table echo "<a href='./?csv_export=1'>Export Table as CSV</a>"; //link to initiate export include("./foot.inc"); } Front-end import can be achieved with the importCsv() method: $modules->get('TableCsvImportExport'); // load module // data, delimiter, enclosure, convert decimals, ignore first row, multiple fields separator, append or overwrite $page->fields->tablefield->importCsv($csvData, ';', '"', true, false, '|', 'append'); Please let me know if you have any problems, or suggestions for improvements. Enjoy!
    1 point
  22. This with the photos on user pages was discussed here before. But I do not remember a solution, only that people have created extra pages and bound them to the userpages, like Kongondo has said above. https://processwire.com/talk/topic/5644-images-in-user-profile/ not necessary to read the whole thread, just scroll down to where ryan has posted and read the few posts around that. You also may reopen the related issue at GitHub: https://github.com/ryancramerdesign/ProcessWire/issues/444
    1 point
  23. @Joss They're quick alright. If you look at the "who's reading this topic", they're like seagulls on a hot chip variable in summer.
    1 point
  24. Also (this may be helpful), I find it sweet to use multiple users (or profiles) in Chrome. Because each instance has its own session storage you can be logged in in one instance of Chrome and logged out in the second, so you see both the admin and client versions of the website you are developing (assuming they differ) without having to constantly login/logout. .
    1 point
  25. The video embed module (http://modules.processwire.com/modules/textformatter-video-embed/) works fine with CkEditor.
    1 point
  26. Could it be this FastCGI issue? https://processwire.com/talk/topic/5388-admin-pages-displaying-with-no-css/ https://processwire.com/talk/topic/4309-no-css-rendering-in-admin/
    1 point
  27. Glad it worked! Was this with a particular hosting company? If so, it is worth noting in case anyone else has an issue.
    1 point
  28. Maybe you can add inputfield markup with the api to your temple. I never test this however
    1 point
  29. Nice one soma! Gonna try this as an alternative to placehold.it.
    1 point
  30. Just added demo example using lightning.pw http://radium-0rq.lightningpw.com/
    1 point
  31. @interrobang: If I get this right, with Pageimage / Imagesizer you can use the lately (2.4.? but before 2.5.0) introduced images option "forceNew" to tell Pageimage::size to always create this desired variation new: $image->size($width, $height, array('forceNew'=>true)) No need to call $image->removeVariations(); anymore! If you are speaking about something different here, - sorry, I'm a bit in a hurry and haven't read carefully or twice. --- IMO, the suffix should be added internally by your module as with your example above. And what is if the user want to set an individual suffix? Well, this could be added to the default suffix from your module by simply concatenate together with a "-": // somewhere in your module, after you have selected one out of "inside, outside, align, center": $suffix .= isset($options["suffix"]) ? '-' . $options["suffix"] : ''; // $options is the options
    1 point
  32. I would give it a little bit more time. It's not always true that no older files than 'current time - 86400 seconds' should exist. probability/divisor = 1/100 = 1% : The garbage collector will run once per 100 new sessions, and then clear all files older than 86400. Although, if you already have 7000 session files, it should be pretty close to exactly 86400 seconds.
    1 point
  33. Mary, I am sure you will get some pointers here. Sorry I cant help. But I am so familiar with your <snipped> statement above. There must be a name for it...
    1 point
  34. I've just foolishly made two changes, and although it now works, I don't know which it was! First I put this on the page that loads the form: $modules->get("EmailNewUser"); Second I refreshed the module And now it works!
    1 point
  35. Ok, it all makes sense now Ideally it would be best if you could hook into the point before the form builder saves the page - not sure what that hook is - sorry. But, if you want to quickly test, the autoload = true option works, you just have to remember to refresh your modules: Modules > Refresh after you make that change to the info.json file that I mentioned above. Do that and I think the emails should send fine even via the formbuilder user page creation. It shouldn't be a huge problem to leave the module autoload because it checks to make sure that the page being saved has the user template, so it shouldn't affect any other pages on the front-end. Let me know if that works for you.
    1 point
  36. Agree. I think you're all nuts. Thankfully I'm not allergic to nuts. Here's another thing my old boss used to say to me : "Pete me auld flower. That's not just allowed. That's in fact encouraged". Stay nuts
    1 point
  37. Thanks Adrian! Worked as soon as I took it out of the <td>'s. Ivan thank you also. Great support here.
    1 point
  38. There is another side to this community which transcends anything ever found on slashdot.
    1 point
  39. Fortunately for me, I was able to get a screen capture before you edited your post
    1 point
  40. One problem I have had on a recent migration with fields apparently not existing in the db is that names are shown in PascalCase in the error while in the db itself they are all lower names. Changing the field name in the db through phpMyAdmin (to e.g. FieldtypeMapMarker rather than fieldtypemapmarker) worked for me, but your mileage may vary. No idea why it's a problem on some servers, though...
    1 point
  41. Money is a bad motivator as it only works as for a limited amount of time. Eagerness and willingness is way stronger and can keep you going like a good ol diesel. When you want to succeed your goal you have to do more over here then in the other camp I guess. But in the end you'll become a real fisher and you're be able to catch sharks in any ocean.
    1 point
  42. When you're satisfied with that position then ProcessWire is not the right tool for you I Guess. But when you're willing to learn, then jump in we're here to help. ProcessWire has that nasty side effect that non coders become coders after using it for a while. You don't need much scripting at all to get started. Go ahead and follow the link provided by Joss.
    1 point
  43. Thanks for feedback! How would you initialize the hooks? @ole: If I find the time I will update my to-do list and add some more features. I think I need to restructure it first to make it more flexible again.
    1 point
  44. On the google developer page the whole procedure is described. In fact its nothing more than placing a piece of javascript inside your HTML. Once you have a finished site, create an adsense account, follow the instructions and wait for google to approve your website. http://www.google.com/adsense/start/how-it-works.html
    1 point
  45. @muchdev I went ahead and submitted a new version with a option to turn off automatic script injection. See https://github.com/somatonic/AjaxSearch#module-settings for further infos as you need to output the js config var used by the AjaxSearch.js manually too. After all I'm not sure why you need this module at all. Just take the AjaxSearch.js and deinstall the module, as there's no reason to have it installed at all. This module was more a little fun helper back then, I'll maybe remove it from the modules.processwire.com.
    1 point
  46. One more update - The module now applies its rules during the adding of a new page (not just editing like before). Obviously there is no affect for the "Initial Differences Protected" setting, but all other settings are relevant and now work.
    1 point
  47. Something like this should work... $t = $templates->get('basic-page');//get the template $f = $t->fieldgroup->getField('summary', true);//get the field in context of this template $f->description = "This should be the description";//value of the field $fields->saveFieldgroupContext($f, $t->fieldgroup);//save new setting in context Edited for clarity... In this example, we are changing the description of the field 'summary' in the context of the template 'basic-page'.
    1 point
  48. I tried the solfe this problem by myself and it works for me. Maybe i forgot something but Im sure that this is an nice and useful little update for your module. so I changed two files /site/modules/FieldtypeCropImage/InputfieldCropImage/InputfieldCropImage.js $(document).ready(function() { $("a.crop").live("hover", function(e) { if( e.type === 'mouseover' || e.type === 'mouseenter') { url = $(this).data('thumburl') + "?timestamp=" + new Date().getTime(); $(this).append("<img style='position: absolute; z-index: 999;' src="+url+" />"); } else { $(this).find("img").remove(); } }); // Grid Configurations function setGridMode($parent) { $parent.find("i.fa-th").replaceWith($("<i class='fa fa-list'></i>")); $parent.find(".InputfieldFileLink").each(function() { var $a = $(this); var $img = $a.children("img"); $a.css('background', '#000 url(' + $img.attr('src') + ') center center no-repeat'); if($img.width() > 99 && $img.height() > 99) $a.css('background-size', 'cover'); }); $parent.addClass('InputfieldImageGrid'); } function unsetGridMode($parent) { $parent.removeClass('InputfieldImageGrid'); $parent.find(".InputfieldFileLink").css('background', 'none'); $parent.find("i.fa-list").replaceWith($("<i class='fa fa-th'></i>")); } var $listToggle = $("<a class='InputfieldImageListToggle HideIfSingle HideIfEmpty' href='#'></a>") .append("<i class='fa fa-th'></i>"); $(".InputfieldCropImage .InputfieldHeader").append($listToggle); $(document).on('click', '.InputfieldImageListToggle', function() { var $parent = $(this).parents(".InputfieldCropImage"); if($parent.hasClass('InputfieldImageGrid')) unsetGridMode($parent); else setGridMode($parent); return false; }); $(".InputfieldCropImage").find(".InputfieldImageDefaultGrid").each(function() { setGridMode($(this).parents(".InputfieldCropImage")); }); $(".InputfieldCropImage .InputfieldFileList").live('AjaxUploadDone', function() { $("a.InputfieldFileLink", $(this)).fancybox(); // NEW Check for default Settings for Image View var $parent = $(this).parents('.InputfieldGridImage'); if($parent.is(".InputfieldImageGrid")) setGridMode($parent); }); }); and /site/modules/FieldtypeCropImage/InputfieldCropImage/InputfieldCropImage.css .crops { border-top: 0; overflow: hidden; padding: 1em; margin-right: 5px; } .crops p { margin: 0 0 0.5em 0; } .crops a { display: block; float: left; margin-right: 10px; } .crops a img { background: white; margin: 0; padding: 10px; box-shadow: 2px 2px 5px #333; max-width: 100%; } .InputfieldCropImage .InputfieldFileData { margin-bottom: 0; } /** * Grid mode icon fixes * */ .InputfieldCropImage .InputfieldHeader .InputfieldImageListToggle { float: right; padding-right: 1em; position: relative; } .InputfieldStateCollapsed .InputfieldHeader .InputfieldImageListToggle { display: none; }
    1 point
  49. (I get to answer my own question!) The issue seems to be the version of PHP my host was using. I was literally just playing around with settings and seeing what happened (real smart, I know, but the site's not live and I have a back-up ) I changed the PHP version from 5.3.27 FastCGI to 5.5.6 CGI (Latest) and... voila! The admin area is displaying as it should.
    1 point
  50. Found it, could be useful for others people: Apparently Media Temple Grid has PHP by default as FastCGI and this doesn't go well with PW. Luckily you can still change it to CGI, see attach Regards Sylvio
    1 point
×
×
  • Create New...