Jump to content

bytesource

Members
  • Posts

    220
  • Joined

  • Last visited

Everything posted by bytesource

  1. I found the answer myself. In the Foundation Site Profile, $useMain is initially set to true in _init.php and checked in _main.php: /templates/_init.php (line 40) /* * Whether to include the _main.php markup file? For example, your template * file would set it to false when generating a page for sitemap.xml * or ajax output, in order to prevent display of the main <html> document. * */ $useMain = true; /templates/_main.php (line 14) // if any templates set $useMain to false, abort displaying this file // an example of when you'd want to do this would be XML sitemap or AJAX page. if(!$useMain) return;
  2. Just like described above I have a page with a template that is called via ajax. In order to disable $config->appendTemplateFile (named _done.php in my case), I put the following line in _init.php: $useMain = !$config->ajax; However, _done.php still gets called. Is $useMain some kind of special variable? Cheers, Stefan
  3. Handling the PHP file as a PW template worked like a charm! Thanks a lot for your help!
  4. Hi, I am trying to handle a form submit using the JQuery ajax function. However, the following always results in a 404 page not found error: <?php $subscribe = $config->paths->templates . 'includes/partials/' . 'subscribe.php'; ?> [...] $.ajax({ url: "<?php echo $subscribe ?>", data: $('#subscribe').serialize(), type: 'POST', [...] After submitting the form, I always get the following error in Google Chrome's page inspector: Including PHP files into template files has not caused any problems before, but here something seems to be different, and I suspect it has to do with how POST requests are handled. Cheers, Stefan
  5. I am using Ubuntu locally. Also, on my computer everything is working without problems, although the table name is still in lowercase (as are all other table names as well). Renaming processredirects to ProcessRedirects using PHPMyAdmin gets rid of the error but results in a 404 page not found when trying to access /processwire/admin on the server. But I guess that is an unrelated problem I will check out later. So although I successfully renamed the table, I still don't know how I got this problem in the first place. Does anybody have any idea? Cheers, Stefan
  6. After importing my database to a staging server I get the same error message whenever trying to open the login screen at /processwire/admin/ The table does exist, but its name is in lowercase: processredirects As I can log in at localhost/processwire/admin/ on my Ubuntu machine, I am wondering where this problem is originating from. Also I am not quite sure where and how I should rename the table name. I therefore would be grateful if someone could help me out. Cheers, Stefan
  7. I found my mistake. I assumed adding the names of the custom fields to be displayed in the admin would automatically add them to the selected template. This, however, is not the case. So after also adding each custom field to the template, everything was working.
  8. I finally found some time to try out the new PageTable field type, but I ran into some problems. I created a field sidebar_slogans of type PageTable and set up the table fields like this: headline=33 summary=33 image=33 However, after assiging sidebar_slogans to a template, I was not able to add any data in the admin. Clicking on the cells did nothing (please see the attached screenshot). Maybe PageTitle does not support the field types of my custom fields? These field types are as follows: headline: TextLanguage summary: TextareaLanguage image: PageImage I have installed Processwire version 2.4.3. Any ideas of how to solve this problem are highly welcome! Cheers, Stefan
  9. That is exactly what I don't understand, either. Maybe I should add that the file main.css is the result of using the SASS compass plugin stitching together several SASS (SCSS) files. But then again, without AIOM everything works fine, so I don't think using a CSS preprocessor is what causes the problem here. I guess I just have to keep looking... Cheers, Stefan
  10. I wanted to bring up this question again as I haven't found a solution yet. Does anyone have any idea of why the paths inside a CSS file are not translated correctly?
  11. @MadeMyDay Why do you think there probably is no need for a smaller version of the image viewed fullscreen on mobile devices? For me this use case is my main concern as I have relatively large images with a width of 1400px that I don't want to show on smaller screens. Cheers, Stefan
  12. I like the idea of going with the future standard as proposed by @MadeMyDay. The only problem I see is that this approach probably does not work in situations where the large image is linked to a href attribute, as is the case with most galleries a la Lightbox. I also like the idea of taking advantage of the CropImage plugin. However, it would be great if CropImage could free me from the tiredsome work of cropping different sized versions for each image. For example, being able to define the focal point (the center of the crop) in the Admin would be real timesaver in this case. Here is some more information on the focal point. Cheers, Stefan
  13. I am positively surprised about how much I have learned about different solutions to adaptive images so far in this thread. Though I am not an expert, I would like to add my personal observations: Bandwidth detection: I get this feeling that this is mostly useful for dedicated mobile websites, as these solutions seem to always be serving an image of the same size, albeit at different resolutions. But I would not want to serve a large image to a mobile device, even if bandwidth was not an issue. Instead, I would prefer a smaller version of the original image but at the same resolution. Image URL: The Adaptive Images plugin I mentioned in my first post scans all <img> tags in order to later set the image url of the src attribute according to the user's screen width. However, I am often more concerned with the presentation of large images in image galleries, and these images tend to be loaded via JavaScript targeting the href attribute of a surrounding <a> tag: <a href="path/to/large-image.jpg"> <img src="path/to/thumbnail.jpg"/> </a> Because of this, any solution to adaptive images should be able to let me determine the path to the actual image. Cheers, Stefan
  14. adrian, Thanks for your answer. Now I have a good reason to play around with the dev branch Cheers, Stefan
  15. Hi, I have heard about the new field type PageTable available in the next version of Processwire (2.5) that is supposed to work like repeaters but with much better performance characteristics. That got me interested, but I haven't been able to find any further information of how to use this new field type. Did I miss some thread, or does PageTable work just like a Repeater? Cheers, Stefan
  16. Hi, I was looking into using the Adaptive Images plugin on my updated website to reduce the load on mobile devices. This plugin serves differently sized versions of the same image depending on the visitor's screen size. However, I definitely also want to install the ProCache plugin, which - if I am not mistaken - makes my site static. So, I was wondering if a plugin like Adaptive Images would actually be usable on a site that has the ProCache plugin installed. If anyone has been using both plugins on the same site I would love to hear about it. Cheers, Stefan
  17. Hi Marvin, Thanks for your reply. Everything is much clearer now. Cheers, Stefan
  18. Hi Phillip, I have a question regarding the support of the ProCache module. You wrote: I have to admit I don't quite understand the limitation of this one PHP call you mention. Does it in any way affect the performance or effectiveness of either of the two modules? Cheers, Stefan
  19. Sorry, I copied the wrong code above, which probably made my question completely incomprehensible. I edited my previous comment and hope that now everything is correct.
  20. Hi David, sorry for my late response. I missed the notification email and thought there was no new reply. You suggestion was spot on! The problem was in fact a syntax error in my Javascript code. Once I fixed that, AIOM worked again. Today I have one other question: When using AIOM, the paths to background images, icons, etc. in my CSS files somehow get changed and cannot be found anymore. Here is an example CSS code .some-class { background: url(images/sprite.png); } This path works // _init.php $cssPath = $config->urls->templates . 'styles/stylesheets/'; // _done.php <link href="<?= $cssPath . 'main.css' ?>" rel="stylesheet"> Path: background: url(h ttp://localhost:8080/processwire/site/templates/styles/stylesheets/images/sprite.png.); This path does not work <link href="<?= AIOM::CSS('styles/stylesheets/main.css') ?>" rel="stylesheet"> Path: background: url(re/htdocs/site/templates/styles/stylesheets/images/sprite.png); Do you have any any idea what is happening here? Cheers, Stefan
  21. @adrian Using the relative path from the template folder did the trick and so the following code is working: // _init.php // Relative path from the templates folder to the javascript folder $relativeJSPath = 'styles/js/'; // _init.php $page->jsFiles = array( 'jquery.min.js', 'bootstrap.min.js', 'jquery.fancybox.pack.js', 'jquery.isotope.min.js', 'jquery.sticky.js', 'retina.js', 'scripts.js', ); $jsFiles = array(); foreach ($page->jsFiles as $js) { $fullPath = $relativeJSPath . $js; $jsFiles[] = $fullPath; } $minified = AIOM::JS($jsFiles); echo "<script src='{$minified}'></script>"; However, now the code in scripts.js, where I initialize all plugins, does not work anymore. Only when I copy its content inside script tags below the javascript file produced by AIOM does it work again. This is regardless of whether the javascript files have been minified or just been merged into a single file (developer mode). Does anyone have any idea what might have happened here? Cheers, Stefan
  22. @horst Thanks for your reply. Unfortunately, replacing $config->urls with $config->paths lead to the same result and at the same time got me 'Page not found' errors for all script files added the normal way: // _init.php $jsPath = $config->urls->templates . 'styles/js/'; // _init.php $page->jsFiles = array( 'jquery.min.js', 'bootstrap.min.js', 'jquery.fancybox.pack.js', 'jquery.isotope.min.js', 'jquery.sticky.js', 'retina.js', 'scripts.js', ); // _done.php foreach ($page->jsFiles as $file) { $fullPath = $jsPath . $file; echo "<script src='{$fullPath}'></script>\n"; } // Output: // <script src='/home/sovonex/Programs/rubystack-2.0.0-12/apps/processwire/htdocs/site/templates/styles/js/jquery.min.js'></script> // <script src='/home/sovonex/Programs/rubystack-2.0.0-12/apps/processwire/htdocs/site/templates/styles/js/bootstrap.min.js'></script> // <script src='/home/sovonex/Programs/rubystack-2.0.0-12/apps/processwire/htdocs/site/templates/styles/js/jquery.fancybox.pack.js'>// // </script> // <script src='/home/sovonex/Programs/rubystack-2.0.0-12/apps/processwire/htdocs/site/templates/styles/js/jquery.isotope.min.js'></script> // <script src='/home/sovonex/Programs/rubystack-2.0.0-12/apps/processwire/htdocs/site/templates/styles/js/jquery.sticky.js'></script> // <script src='/home/sovonex/Programs/rubystack-2.0.0-12/apps/processwire/htdocs/site/templates/styles/js/retina.js'></script> // <script src='/home/sovonex/Programs/rubystack-2.0.0-12/apps/processwire/htdocs/site/templates/styles/js/codeslider.js'></script> // <script src='/home/sovonex/Programs/rubystack-2.0.0-12/apps/processwire/htdocs/site/templates/styles/js/scripts.js'></script> I installed Processwire via the Bitnami stack, that's where the long path names are coming from. To be fair, I am not quite sure, when to use $config->paths and when to use $config->urls most of the time. As for CSS and javascript files, I chose $config->urls, because I saw it done this way on the skyscraper installation: https://github.com/ryancramerdesign/SkyscrapersProfile/blob/master/site/templates/_out.php#L42 Cheers, Stefan
  23. AIOM minifies my CSS file without any problems, but for some reason I have not been able to minify any javascript files. While outputing javascript the old way works: // _init.php $jsPath = $config->urls->templates . 'styles/js/'; // _init.php $page->jsFiles = array( 'jquery.min.js', 'bootstrap.min.js', 'jquery.fancybox.pack.js', 'jquery.isotope.min.js', 'jquery.sticky.js', 'retina.js', 'scripts.js', ); // _done.php foreach ($page->jsFiles as $file) { $fullPath = $jsPath . $file; echo "<script src='{$fullPath}'></script>\n"; } // Output // <script src='/processwire/site/templates/styles/js/jquery.min.js'></script> // <script src='/processwire/site/templates/styles/js/bootstrap.min.js'></script> // <script src='/processwire/site/templates/styles/js/jquery.fancybox.pack.js'></script> // <script src='/processwire/site/templates/styles/js/jquery.isotope.min.js'></script> // <script src='/processwire/site/templates/styles/js/jquery.sticky.js'></script> // <script src='/processwire/site/templates/styles/js/retina.js'></script> // <script src='/processwire/site/templates/styles/js/scripts.js'></script> Using AIOM as shown below always resulted in a file with the content of /** Generated: Thursday, 8th of May 2014, 11:36:39 PM // Powered by AIOM+ (All In One Minify) by www.flipzoom.de **/: // _done.php $jsFiles = array(); foreach ($page->jsFiles as $js) { $fullPath = $jsPath . $js; $jsFiles[] = $fullPath; } $minified = AIOM::JS($jsFiles); echo "<script src='{$minified}'></script>"; // Output // <script src='/processwire/site/assets/aiom/js_d41d8cd98f00b204e9800998ecf8427e_dev.js?no-cache=1399617391'></script> I also tried to output each javascript file one by one using AIOM, but this did not work, either: foreach ($page->jsFiles as $file) { $fullPath = $jsPath . $file; $minJS = AIOM::JS($fullPath); echo "<script src='{$minJS}'></script>\n"; } Output: // <script src='/processwire/site/assets/aiom/js_d41d8cd98f00b204e9800998ecf8427e_dev.js?no-cache=1399617391'></script> // <script src='/processwire/site/assets/aiom/js_d41d8cd98f00b204e9800998ecf8427e_dev.js?no-cache=1399617391'></script> // <script src='/processwire/site/assets/aiom/js_d41d8cd98f00b204e9800998ecf8427e_dev.js?no-cache=1399617391'></script> // <script src='/processwire/site/assets/aiom/js_d41d8cd98f00b204e9800998ecf8427e_dev.js?no-cache=1399617391'></script> // <script src='/processwire/site/assets/aiom/js_d41d8cd98f00b204e9800998ecf8427e_dev.js?no-cache=1399617391'></script> // <script src='/processwire/site/assets/aiom/js_d41d8cd98f00b204e9800998ecf8427e_dev.js?no-cache=1399617391'></script> // <script src='/processwire/site/assets/aiom/js_d41d8cd98f00b204e9800998ecf8427e_dev.js?no-cache=1399617391'></script> Interestingly, each time the same file is output. I installed AIOM version 3.1.3 with Processwire 2.4 I am probably missing the obvious, but I haven't been able to spot it. Cheers, Stefan
  24. @netcarver I noticed that the array on line 35 of TextformatterTextile.module was not closed. After fixing the typo and updating the modules in the module section of the admin, I wanted to install Textile Field. However, the install button was diabled as can be seen on the attached screenshot. Do I need to first uninstall the old Textile module and then reinstall the updated one from within the admin? What I did was replacing the old folder with the new one before hitting 'Check For New Modules'. I was afraid that reinstalling the old version first might de-attach the Textile formatter from its respective fields. Cheers, Stefan
  25. @netcarver Thanks a lot for this update! I agree adding an additional formatter is a good choice, as it does not break existing code. Cheers, Stefan
×
×
  • Create New...