Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/05/2014 in all areas

  1. I'm currently working on a couple modules that require newer versions of ProcessWire and newer versions of specific modules (as dependencies). Currently, there is no way to specify versions with module dependencies other than having your install() method throw an exception. As a result, module dependencies have been updated (on dev branch, 2.4.1) to include support for module versions, as well as PHP and ProcessWire versions. The best way to describe it is to show an example of how you'd use it. I'll take an example from the first post here and update it (note the 'requires' line at the bottom): public static function getModuleInfo() { return array( 'title' => 'Log Master (Process)', 'version' => 100, 'author' => 'Lumberjack Bob', 'summary' => 'Displays the logged actions in the admin', 'requires' => 'ProcessHello>=101, ProcessWire>=2.4.0, PHP>=5.4.0', ); ); The 'requires' line above specifies that this module has the following requirements: ProcessHello module version 1.0.1 or newer ProcessWire version 2.4.0 or newer PHP version 5.4.0 or newer If no particular version of a module is required then you'd simply omit the operator and version, as you've done with dependencies in the past. Another thing to note above is that the 'requires' line accepts a CSV string. Before, you had to use an array if you wanted to specify multiple dependencies. You can still use an array if you want to, but it's not required. The above 'requires' line as an array would look like this: 'requires' => array('ProcessHello>=1.0.1', 'ProcessWire>=2.4.0', 'PHP>=5.4.0') For ProcessWire or PHP versions, you need to specify a 2-3 part version string like "2.4.0". But for modules, you can specify either an integer or a 3 part version string. It's more consistent, and thus a little bit preferable to specify an integer (like in my first example) since that is already how versions are specified in the getModuleInfo 'version' property (i.e. 101 rather than 1.0.1). However, it doesn't really matter.
    6 points
  2. Another approach would be to have a duplicate of your template folder where you use diffferent code inside your templates. I use this a lot for development in a live site, but its an easy solution to use it for a mobile website too. When your normal site is finished (or while developing) make a duplicate of the template folder and name it "templates-mobile". The goal here is to have exactly the same template files in both folders. Paste the following code at the bottom of the /site/config.php file and change the m.domain.ext to your needs if($_SERVER['HTTP_HOST'] == 'm.domain.ext') { $config->urls->templates = '/site/templates-mobile/'; $config->paths->templates = $rootPath . $config->urls->templates; } This way when you visit your website on m.domain.ext it will use the templates out of the templates-mobile folder while it still uses the same data from the database, assets folder and the modules.
    6 points
  3. Or difficult like this: echo $page->images->implode(function($item) { $large = $item->size(1200,800); $thumb = $item->size(400,300); return "<li><a href='$large->url'><img src='$thumb->url' alt='$item->description'></a></li>"; }, array('prepend' => '<ul>', 'append' => '</ul>'));
    5 points
  4. Hi Everyone, Just launched SharesPost.com. Thoughts?
    5 points
  5. When projects become more complex and need more logic, mostly I end up only using PHP. So never escaping HTML. ProcessWire has changed how I quote HTML. Before PW: <body class="tralala"> Now with PW: "<body class='tralala'>"
    4 points
  6. Further down the rabbit hole…. A function for responsive (retina) slideshows using Filament Group's responsive carousel and picturefill function slideshow(){ $page = wire('page'); // Resposive Carousel from Filament Group // https://github.com/filamentgroup/responsive-carousel $out = "<div class='carousel arrows' data-paginate data-autoplay data-interval='8000'>"; foreach ($page->images as $image){ // create required images sizes (based on 16:9 aspect ratio) //large $large = $image->size(920,518); $large_2x = $image->size(1840,1036,array('quality' => 25)); //medium $medium = $image->size(720,405); $medium_2x = $image->size(1440,810,array('quality' => 25)); //small $small = $image->size(540,304); $small_2x = $image->size(1080,604,array('quality' => 25)); //extra small $xsmall = $image->size(300,169); $xsmall_2x = $image->size(600,338,array('quality' => 25)); // serve 2x thumb to all devices $thumb = $image->size(200,106,array('quality' => 50)); $out .= "<div data-thumb='{$thumb->url}'>"; $out .= "<span data-picture data-alt='{$image->description}'>"; // extra small $out .= "<span data-src='{$xsmall->url}'></span>"; $out .= "<span data-src='{$xsmall_2x->url}' data-media='(max-width: 399px) and (min-device-pixel-ratio: 2.0)'> </span>"; //small $out .= "<span data-src='{$small->url}' data-media='(min-width: 400px)'></span>"; $out .= "<span data-src='{$small_2x->url}' data-media='(min-width: 400px) and (min-device-pixel-ratio: 2.0)'></span>"; // medium $out .= "<span data-src='{$medium->url}' data-media='(min-width: 800px)'></span>"; $out .= "<span data-src='{$medium_2x->url}' data-media='(min-width: 800px) and (min-device-pixel-ratio: 2.0)'></span>"; // large $out .= "<span data-src='{$large->url}' data-media='(min-width: 1000px)'></span>"; $out .= "<span data-src='{$large_2x->url}' data-media='(min-width: 1000px) and (min-device-pixel-ratio: 2.0)'></span>"; // Internet Explorer 8 and older have no support for CSS3 Media Queries // serve large image to older version of IE desktop. $out .= "<!--[if (lt IE 9) & (!IEMobile)]>"; $out .= "<span data-src='{$large->url}'></span>"; $out .= "<![endif]-->"; // Fallback content for non-JS browsers. Same img src as the initial, unqualified source element. $out .= "<noscript>"; $out .= "<img src='{$large->url}' alt='{$image->description}'/>"; $out .= "</noscript>"; $out .= "</span>"; // end picturefill // use image description field to generate a caption $out .= $image->description ? "<div class='caption'>{$image->description}</div>" : ""; $out .= "</div>"; // end slide } $out .= "</div>"; // end carousel return $out; } In your template <?php // render slideshow if there are images if (count($page->images) > 0){ echo slideshow(); } ?> *gah, formatting got a little mangled in the forum. You get the idea.
    4 points
  7. Output Formatting is basicly what it says. When you attach a TextFormatter to a field, Clean text from the database goes through the TextFormatter & changing the text on output. So **bold** wil be changed to <strong>bold</strong> when you use it. (TextformatterMarkdown) Say if you save the page with data, you must be sure that the saved text is clean. You want to save **bold** to the database, and not <strong>bold</strong> (TextformatterMarkdown). Setting of(false) will put all Formatters off, so clean text storage is insured. offtopic: $page->setOutputFormatting(true|false) $page->getUnformatted("field")
    4 points
  8. It is a nice concept but you can achieve more or less the same with dropbox with symlinks. Just put a symlink of any folder inside the dropbox folder, and dropbox will happily let itself fooled.
    4 points
  9. While that's one way of dealing with a mobile site, the other way would be to use a mobile-first front end framework (such as Bootstrap 3 or Zurb Foundation 4/5) and develop your site at your abc.com domain. I would be very interested to know why Baidu thinks (for SEO purposes) that the separate mobile site is better than a consolidated website (mobile and responsive) at the same domain.
    4 points
  10. yep Tom, this community makes learning fun.
    3 points
  11. Slideshows can get complicated quickly. Especially when serving different image sizes and resolutions like the example above. Then you can start intermingling video slides, and well, the rabbit hole goes further and further... I only look smart because I hang around here and absorb everyone's great examples. So, you are doing the right thing.
    3 points
  12. They set a index for the field in table. It's for optimizing when query database. Indexed field are faster to search.
    3 points
  13. Have a look at eq(n) - if you want to target a particular image....this is in the cheat sheet ....but maybe does not answer you question...but the usual suspects are about...so your question will be answered ....
    3 points
  14. If all you want is to comply to baidu suggestion, just make a responsive site in abc.ext and point m.abc.ext to it like you probably did with www.abc.ext
    3 points
  15. Greetings, First, let me say that I am always very impressed with CMS Critic. As for ideas, I think it would be great to shed some light on who votes most for which CMS. Of course, there are limits to this, and as Joss said you can easily ask for too much data. But within reason it might be nice to ask questions like this: Considering the ways you use a CMS, how do you view yourself: 1. I am more of a designer 2. I am more of a developer (coder) 3. I am a designer/developer It would be great to present some kind of visualization that (hopefully) shows how (if) certain people cluster around particular CMSs. I have always wanted to parse out the data on CMS use. I think most comparisons on the web leave out the fact that not all systems can be compared because they appeal to very different people. It is the rare syatem that appeala across the board. Since you're doing the vote, you have people's attention. It seems you could use this to creatively get some more insights. Thanks, Matthew
    3 points
  16. You guys are too smart. I'm learning a lot today.
    2 points
  17. <ul class="rslides"> <?php foreach ($page->images as $img):?> <li><img src="<?=$img->url;?>"></li> <? endforeach ?> </ul> Thanks for that example.
    2 points
  18. <ul class="rslides"> <?php foreach ($page->images as $img):?> <li><img src="<?=$img->url;?>"></li> <? endforeach; ?> </ul>
    2 points
  19. Just! Phew.... Back to the questions...yeah, @PWired, why not just use foreach? Why do you have to identify the images by index? Note, there is also last(), FYI PHP starts anywhere you have this <?php......and ends here ?> Btw, do you have to use those inline CSS styles?
    2 points
  20. can you just foreach the images and output each slide? otherwise $page->images->eq($n);
    2 points
  21. 2 points
  22. Thanks for helping me debug this. I'm not the developer of the stylesheets and so I'm still learning how this particular part is supposed to work. But the #top-buttons css in global.css is not something that I added there. It's always been there as far as I know. It's there because the mobile-first technique being used in the stylesheets dictates that the buttons don't show on mobile. But if you look in the layout.css file, which comes later in the CSS order, it has code to reveal them for the desktop views. It had a display: block for #top-buttons, but also needed a display: block; for #top-buttons .wire-button. I added it in there and that seems to have fixed it. But it's still a mystery to me why, as I don't think there had been any changes to these stylesheets for anything to do with the #top-buttons. But clearly there must have been. I think I can only blame it on not drinking my coffee fast enough one morning this week.
    2 points
  23. a more feature rich solution: http://mobiledetect.net
    2 points
  24. I have an idea for a module that I think might be useful. When I was on WP, we had one we could install that would auto search for whatever the user was trying to find whenever it encountered a 404 error page and present a list of matching options. As I have a few 404's showing up on my MOZ.com report, I wondered if this would be something other members would find useful as well. I thought I'd throw it out there if someone thinks it might be useful. I'd be happy to donate a few bucks to the development of it if there's someone willing to take it on.
    1 point
  25. Good Morning Everyone! As you know, we're a proud Processwire website that (thanks to this awesome CMS) hasn't looked back since moving from WordPress. We're so pleased, we're launching a couple of new sites also based on the same feel that Mr. Amazing (Ryan) developed. (For future reference, he shall now henceforth be referred to as Mr. Amazing whenever I write a post). I'm planning out the upcoming 2014 Critics' Choice CMS Awards and would love to hear some creative thoughts as to how to use Processwire (or some other method) to come up with a creative voting and nominations process. Last year, I used FormBuilder and made a simple form that people needed to submit and while it worked fine, I'm wondering if there's a better solution that might be a bit more engaging. I'd love to hear anyone's ideas / thoughts as to what options might be out there. Thanks in advance for your time! ~Mike (ps: processwire rocks)
    1 point
  26. 1 point
  27. It's -18C at the moment. The only thing I'm ever going to be surfing is an icy highway
    1 point
  28. LOL. 8. I like pictures of cute animals and surf them all day while pretending to be working.
    1 point
  29. Keep in mind — If you have a lot of images the very first page view will take a bit while all the different sizes get created. After that it will be fast.
    1 point
  30. Thanks for the second code example renobird. I am going to do this in 3 steps. First your easy example, then your second example for studying the how and what, and third replacing it with a show off slide show which I already have but do not know how to implement yet.
    1 point
  31. Normally, you don't want PHP inside your HTML files as the code will not be executed (unless you configure your server to do so)...there could be other issues/perspectives as well. But, HTML inside a PHP file is OK and the preferred way....though the debate never ends about how much HTML should be in your PHP file I use inline CSS styles only when it is absolutely necessary...
    1 point
  32. quick on the draw kongondo. I don't think responsiveSlides (looks like what you are using) needs custom markup for individual slides, but you probably have a reason.
    1 point
  33. Soma posted about this in the past how to do this the straight way: backup your database.sql backup the site folder install processwire on the new host replace the site folder with the backup site folder import your backup database.sql
    1 point
  34. 5. I am a technology enthusiast
    1 point
  35. *************** currently in hiding...for misleading everyone hehe******************
    1 point
  36. Oops, at the same time I've been changing display: none to display: block in global.css Is this going to cause an issue ryan? I'll leave it to you since two people editing CSS at the same time usually ends in disaster and overwritten styles!
    1 point
  37. @r2d2 - very nice - i like the multicolored main nav - the design is really pro! here are some considerations: 1.) no favicon, i use this http://realfavicongenerator.net/ 2.) Activate server side compression (gzip)? 3.) combine minify assets? AIOM is very good 4.) put more js at bottom?
    1 point
  38. Thanks kongondo for pointing out my post! I should have explain more!
    1 point
  39. Heh, just reading Felix's post, maybe you should require all voters to send a video vote so you can see who they are and who is in disguise! (joke)
    1 point
  40. We've just implemented a voting functionality for a site which is currently under heavy development (i'll post it here, soon). Users can send in Videos/Photos and win prizes. Every entry can be voted. The way we've done it is like this: - Users can vote via FB and Twitter without any further authentication (social network id, origin + timestamp stored in db) - Users can Vote with their E-Mail Adresses. To avoid fake votes they can vote for as much entrys as they want but their votes aren't counted until they click a link in an opt-in mail. After the adress is validated they are handled the same as twitter/fb users. E-Mails Adresses are Checked against a list of disposable/trash-mail services before storing them (E-Mail Users got a seperate table with a is_confirmed flag) We've also discussed using a service like https://www.rafflecopter.com/ or http://www.voycer.biz/en to use their (very cool) social voting features (tweet to win...) but most of them are either created explicitly for raffles that are based on a single question/item or just support facebook as sign-on mechanism.
    1 point
  41. Ok, how's this work for you? http://modules.processwire.com/modules/process404-search/
    1 point
  42. Maybe just replace slashes in the url with + and send those terms to the search page? Sounds pretty simple to achieve. Not tested ... $this->addHook('ProcessPageView::pageNotFound', $this, 'search'); public function search($event) { $request = parse_url($_SERVER['REQUEST_URI']); $path = $request["path"]; $result = trim(str_replace(basename($_SERVER['SCRIPT_NAME']), '', $path), '/'); $result = explode('/', $result); $term = implode('+', $result); $session->redirect("/search/?q=$term"); } Might be more things to consider. Maybe no real need to explode/implode. Maybe just a str_replace('/','+', $result), but you get the idea.
    1 point
  43. The problem is in css as below: media="all" #top-buttons .wire-button { display: none; }
    1 point
  44. Hi Jonathan , yes, in this function paths are filtered to prevent directory traversal attacks. AIOM+ loads only allowed files that are located in the template folder. I think about it, in one of the upcoming versions, introduce a whitelist for asset folder. For a workaround change the following line (749) in AllInOneMinify.module: $_path = str_ireplace(array('../', './', '%2e%2e%2f', '..%2F'), '', (wire('config')->paths->templates.$_file)); to $_path = wire('config')->paths->templates.$_file; I have not tested it and I can not recommend it too.
    1 point
  45. You don't have to put it in a function, you can as well just put all this inside a if statement <?php if (condition) : ?> <form id='search-form' action='<?php echo $config->urls->root?>search/' method='get' class='hide-for-small'> <div class="row collapse"> <div class="small-9 columns"> <input type="text" name="q" value="<?php echo $sanitizer->entities($input->whitelist('q')); ?>" placeholder="" /> </div> <div class="small-3 columns"> <button type='submit' class="button prefix">Search</button> </div> </div> </form> <?php endif; ?> or, if this complicates the code on that template too much, you can have have it exactly as it is in a file, and include it from inside the condition. if (condition) { include('form.inc'); }
    1 point
  46. I am not having any issues specifically with the description not being available. However, I notice that the toggle expansion arrows for each field are not showing. Maybe there is a clue with that though? Just about to post this when I saw that you have fixed it - seems like it was related to the missing toggle arrows
    1 point
  47. currently I'm back working on the ImageManipulator. I've put it into a module that extends PageImage. It integrates nicely into PWs workflow. There are only a few things that I have to solve before I can release it: finishing and testing the watermark-methods write documentation and some examples provide support for imageVariations, namely: removeVariations() with point 3, I already have a method that can be called when in PIM-mode (PageImageManipulator-mode) which unlink all PIM-created files, but I think it would be more comfortable if a user calls one of the PageImage-methods getVariations() or removeVariations() if the PIM-created variations are included in the collections. EDIT: in the meantime, we have had a release already: http://processwire.com/talk/topic/4264-release-page-image-manipulator/ ----- here are a screenshot of my current Testpage
    1 point
  48. A truly epic write up Ryan. I'm sure all those who visit this forum will benefit from your knowledge. Thanks for sharing it.
    1 point
  49. Hey all, I've converted the ProcessWire 2.3 rules to Nginx. Hope this will help some people Greetings, Niek server { listen 80; listen 443 ssl; root /var/www/example.com/public_html; server_name example.com www.example.com; ssl_certificate /etc/pki/tls/certs/example.com.crt; ssl_certificate_key /etc/pki/tls/private/example.com.key; client_max_body_size 50m; access_log /var/www/example.com/_logs/access.log; error_log /var/www/example.com/_logs/error.log; # ----------------------------------------------------------------------------------------------- # Set default directory index files # ----------------------------------------------------------------------------------------------- index index.php index.html index.htm; # ----------------------------------------------------------------------------------------------- # Optional: Redirect users to the 'www.' version of the site (uncomment to enable). # For example: http://processwire.com/ would be redirected to http://www.processwire.com/ # ----------------------------------------------------------------------------------------------- if ($host !~* ^www\.) { rewrite ^(.*)$ $scheme://www.$host$1 permanent; } # ----------------------------------------------------------------------------------------------- # Access Restrictions: Protect ProcessWire system files # ----------------------------------------------------------------------------------------------- # Block access to ProcessWire system files location ~ \.(inc|info|module|sh|sql)$ { deny all; } # Block access to any file or directory that begins with a period location ~ /\. { deny all; } # Block access to protected assets directories location ~ ^/(site|site-[^/]+)/assets/(cache|logs|backups|sessions|config|install|tmp)($|/.*$) { deny all; } # Block acceess to the /site/install/ directory location ~ ^/(site|site-[^/]+)/install($|/.*$) { deny all; } # Block dirs in /site/assets/ dirs that start with a hyphen location ~ ^/(site|site-[^/]+)/assets.*/-.+/.* { deny all; } # Block access to /wire/config.php, /site/config.php, /site/config-dev.php, and /wire/index.config.php location ~ ^/(wire|site|site-[^/]+)/(config|index\.config|config-dev)\.php$ { deny all; } # Block access to any PHP-based files in /templates-admin/ location ~ ^/(wire|site|site-[^/]+)/templates-admin($|/|/.*\.(php|html?|tpl|inc))$ { deny all; } # Block access to any PHP or markup files in /site/templates/ location ~ ^/(site|site-[^/]+)/templates($|/|/.*\.(php|html?|tpl|inc))$ { deny all; } # Block access to any PHP files in /site/assets/ location ~ ^/(site|site-[^/]+)/assets($|/|/.*\.php)$ { deny all; } # Block access to any PHP files in core or core module directories location ~ ^/wire/(core|modules)/.*\.(php|inc|tpl|module)$ { deny all; } # Block access to any PHP files in /site/modules/ location ~ ^/(site|site-[^/]+)/modules/.*\.(php|inc|tpl|module)$ { deny all; } # Block access to any software identifying txt files location ~ ^/(COPYRIGHT|INSTALL|README|htaccess)\.(txt|md)$ { deny all; } # Block all http access to the default/uninstalled site-default directory location ~ ^/site-default/ { deny all; } # ----------------------------------------------------------------------------------------------- # If the request is for a static file, then set expires header and disable logging. # Give control to ProcessWire if the requested file or directory is non-existing. # ----------------------------------------------------------------------------------------------- location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|eot|woff|ttf)$ { expires 24h; log_not_found off; access_log off; try_files $uri $uri/ /index.php?it=$uri&$args; } # ----------------------------------------------------------------------------------------------- # This location processes all other requests. If the request is for a file or directory that # physically exists on the server, then load the file. Else give control to ProcessWire. # ----------------------------------------------------------------------------------------------- location / { try_files $uri $uri/ /index.php?it=$uri&$args; } # ----------------------------------------------------------------------------------------------- # Pass .php requests to fastcgi socket # ----------------------------------------------------------------------------------------------- location ~ \.php$ { # Check if the requested PHP file actually exists for security try_files $uri =404; # Fix for server variables that behave differently under nginx/php-fpm than typically expected fastcgi_split_path_info ^(.+\.php)(/.+)$; # Set environment variables include fastcgi_params; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # Pass request to php-fpm fastcgi socket fastcgi_pass unix:/var/run/example.com_fpm.sock; } }
    1 point
×
×
  • Create New...