Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/14/2015 in all areas

  1. A ProcessWire Fieldtype storing files in a customized location, outside the web root. This module is primarily useful if you need to store sensitive data which should not be accessible directly from the web. Normally, ProcessWire stores all files under /site/assets/files. Direct URL access to these files can be restriced by setting $config->pagefileSecure = true. Still you need to make sure that your template permissions are setup correctly. If something goes wrong, those files could be accessed from outside. GitHub: https://github.com/wanze/FieldtypeSecureFile Modules Directory: http://modules.processwire.com/modules/fieldtype-secure-file/ How does it work? After installing this module, you can create a new field of type SecureFile. Enter your configuration under the "Details" section when editing the field: Storage Location Enter a path outside the web root where the files are stored. You need to create the directory manually. Also make sure that the user running the web server has write permission. Roles allowing to download a secure file Users with a role selected here are able to download the files if a download is requested via the API. Allow Download in Admin If checked, users having a role selected above can download the files when editing a page. I needed this functionality for a recent project, so I created this module and thought to share it, mabye this is useful for someone else Consider it beta, I'm using it on one site but I'm sure it could be improved here and there. Feel free to suggest additional features! Cheers
    11 points
  2. I guess you need to pass path and no URL, try $config->paths.
    2 points
  3. It's because your nickname. Try CoffeeCodeCoffee instead
    2 points
  4. Try this, but it can only work for direct descendants, not for a whole tree. parent.status!=hidden To get the whole tree excluded you'd need a more advanced selector, which only works on db calls and not for runtime filtering: has_parent!=[status=hidden] This does first call all hidden pages and then exclude them with the has_parent selector
    2 points
  5. A couple of ways I have dealt with static file versioning in PW: 1. Use AIOM+ for your CSS and JS files. AIOM+ is sensitive to what is contained in your files though - I got an error when my CSS contained a background image path to a PHP script (for generating translucent PNGs for older browsers that don't support rgba colours). 2. A function that renames static files according to the last modified time (adapted from this article). Include somewhere before your template head is generated... function autoVer($url){ $name = explode('.', $url); $lastext = array_pop($name); array_push($name, filemtime($_SERVER['DOCUMENT_ROOT'].$url), $lastext); $fullname = implode('.', $name); echo $fullname; } Use as follows for your CSS and JS... <link rel="stylesheet" href="<?php autoVer('/site/templates/css/mystyles.css'); ?>"> <script src="<?php autoVer('/site/templates/js/myscript.js'); ?>"></script> Add to your .htaccess, after "RewriteEngine on"... # Versioned static files RewriteCond %{REQUEST_FILENAME} !-s RewriteRule ^(.*)\.[\d]+\.(css|js)$ $1.$2 [L]
    2 points
  6. The latest 99Lime website, http://www.yucatanliving.com. Everything you ever wanted to know about living and experiencing life in the Yucatan. This was a huge project with a ton of different sections and templates. With Processwire we created a very large site with a lot of different content types and information without making the administration complex. We are very happy with how this project turned out and our clients love it! Processwire rocks the casbah! Shoutout to: Orlando world's most awesome processwire dev. Notable features Galleries Categories Search Advertising page /es Getting started 100% responsive Polls Event lists Custom Calendar of Events Module Custom Advertising Modules 404 Dynamic CSS colors Users and profiles. A few details. Over 1600 articles 20 templates A ton of Fields HTML KickStart jQuery Custom roles ProcessWire Modules used Custom CRON Module FieldTypeColorPicker FieldTypeConcat FieldTypeFontIconPicker Map Marker ProFields FieldTypePoll FieldTypeSelect Form Builder Migrator WordPress Migrator Batcher JumpLinks Comments Manager ListerPro New Comments System Video embed for YouTube/Vimeo Custom-built Advertising platform module. Custom-built Recurring Calendar module. Jquery Modules used Remodal ImageLightbox Sticky-kit BxSlider FitVids Jquery-Touch-Swipe-Drag
    1 point
  7. Actually if you want it to save to the assets/files/pageid folder for the current page, this is what you want: $page->filesManager()->path(); But do you want to save it directly, or would you rather just add it to a files field for the page? $page->pdfs->add("invoice.pdf"); If you went that route you could do: $mpdf->Output('/tmp/invoice.pdf', 'F'); $page->pdfs->add("/tmp/invoice.pdf"); unlink("/tmp/invoice.pdf"); or something like that
    1 point
  8. UPDATE I was able to figure out where I was going wrong in this module's configuration. For anyone who may not check Github, listed below is the resolution of the issue I opened there. Resolution @adrian, thanks again for your quick follow-up and troubleshooting expertise.
    1 point
  9. @CodeCoffeCode Don't worry, we've all been in this situation before
    1 point
  10. Then your <h1><?php echo $page->title; "Holiday Cottages"; if($page->editable()) echo "<p><a href='$page->editURL'>Edit</a></p>"; ?></h1> also outputs title of cottage and edit link? It's like you overwrite $page somewhere (header.inc?) or just the template like $page->template = "something" instead of $page->template == "cottage" ... Strange, and I don't see what's wrong. Only thing I know is that you're viewing a page that template doesn't have pagination enabled.
    1 point
  11. Soma, LostKobrakai, Wanze Many thanks for your time helping me try to figure this out... I did a fresh install of PW and imported the templates and fields (not including the cottage template). When I attempted to create a "region" page using the region template, I was thrown this error: Error #2 is what was causing the problem!!!! As it happens I had this line of code in my "head" template (TMP_head.inc): <div id="wrapper" <?php if ($page->template = cottage): echo 'class="cottage-listings"'?> <?php endif ?>> When it should have been: <div id="wrapper" <?php if($page->template == location) echo 'class="cottage-listings"'?>> What an idiot I am ... Thank you all once again for your assistance and support.
    1 point
  12. Hey, so after having used the Fieldtype Select for a few project I had some customers that wanted a radio version of this so I decided to modify it (not heavily) and make it work with radio buttons instead. I have it hosted up on github here so check it out and let me know if you have question or comments.
    1 point
  13. It isn't installed by default, so just go to Modules > Core > Select Options and install
    1 point
  14. Hi abmcr Do any of your templates use the settings found under the Family tab? This ensures that new pages using certain templates can only be children of specific pages. I think that's fundamental to seeing the Add New option in the Pages menu,
    1 point
  15. @quickjeff, Found a bit of time to work on this. The Authors' Dashboard was also relatively slow. Worked on that as well. Using a combination of $pages->count() (thanks @adrian) and raw SQL queries (as explained here) and testing using 10,011 posts, the main Dashboard loads in 0.3 seconds on my machine. I think that's an acceptable time (given the 10+ seconds it took me to load main Dashboard with 5K posts). Although I tested with a minimal comments count, I don't think this will make much difference where there's lots of comments (using SQL for the counts). I will also look at Categories and Tags (in cases where these could run into thousands) just to be sure. Posts Dashboard loads fast as usual. Unfortunately, I still don't have time to merge the new changes any time soon.
    1 point
  16. 1 point
  17. I really like the domain sharding option of AIOM. I even grab this setting in my templates to deliver all images from a cookiless domain (usually in combination with minimize.pw). It looks something like this: // cache cookieless domain for static content as set in AllInOneMinify configuration $my_static_domain_setting_source = wire('modules')->getModuleConfigData('AllInOneMinify'); $my_static_domain = $my_static_domain_setting_source['domain_sharding']; // use static domain in the template like this echo '<img src="' . $my_static_domain . $page->image->minimize()->url . '" />'; While this works, it’s a bit laborious. Wouldn’t it be a good idea to add an additional checkbox in the module’s settings to set an option “deliver all images from cookiless domain”? Hooking into the page rendering process and replacing every relative image source (= not starting with "http") or image source starting with “http://” and the site’s default domain as set in config.php should do the trick – if I’m not too naive.
    1 point
  18. Yep, 0,1,2,3 has nothing to do with the frame the image is taken from, they are just "names" for certain thumbnails. Here is a good thread detailing all the available images: http://stackoverflow.com/questions/2068344/how-do-i-get-a-youtube-video-thumbnail-from-the-youtube-api Actually on that note, I see that I am missing "sddefault", so I will add that now.
    1 point
  19. Great. To use it in a AdminTemplate I had to change it to $table = $modules->get("MarkupAdminDataTable"); $table->headerRow( ["Title", "ID", "Created", "User"] ); foreach($pages->find("created_users_id=".$user->id) as $page){ $data = array( // Values with a sting key are converter to a link: title => link $page->title => $config->urls->admin."page/edit/?id=".$page->id, $page->id, date("F j, Y", $page->created), $page->createdUser->name ); $table->row($data); } // $table->footerRow( $someArray ); echo $table->render(); and ad a missing $ Or would you recommend to use it as a modul over a custom admin template? And how to integrate the view/edit etc Buttons as in the tree view?
    1 point
  20. Rails uses MD5's for asset filenames, which is awesome, but requires some sort of build process so that the process isn't run on every page load when using PHP. We're looking to eventually build this into our MVC Boilerplate, as cache busting is a bit of an irritant.
    1 point
  21. It was an issue with vagrant. I have had the issue setting up laravel also. To fix it I just changed the user/group for apache to vagrant. Generally this wouldn't be safe at all in a production environment but access to the VM is limited to me, so I am not too concerned. To change the user/group will depend on your OS. In ubuntu the config file is located in /etc/apache2 and it is apache2.conf. Sometimes "apache2" will be swapped out for "http.d". You can edit the file using vim/nano and then save and restart apache.
    1 point
  22. @kyle: in case that this is related to creating files on the disk, have you considered installing SessionHandlerDB, i.e. moving sessions to database? If you can't log in to install it, you can do this with a very simple external script: <?php require 'index.php'; // path to PW index.php wire('modules')->install('SessionHandlerDB');
    1 point
  23. In 2.3, there are also these two additions (so far, undocumented). Either one returns the number of visible children: $page->numChildren(true); $page->numVisibleChildren; I will be adding these to the API pages, along with all the other 2.3 additions very soon.
    1 point
×
×
  • Create New...