Jump to content

szabesz

Members
  • Posts

    2,922
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by szabesz

  1. @maxf5 Did you try it with <pw-region> too? Sure, they should be the same, but still... To tell the truth, I never really understood why having all these variations of the same thing is good. It just makes things more confusing, more time to debug but adds no additional feature. It's like having similarly named methods doing the same thing. Well, at least they are supposed to do the same
  2. more ideas: https://modules.processwire.com/modules/fieldtype-yaml/ https://modules.processwire.com/modules/fieldtype-matrix/ ProFields: Page Table in the core.
  3. Would be great to see a working example. An exported site profile maybe? Thanks advance!
  4. Hi @Gideon So You might want to ask Hostgator's support since this issue is probably server related. As for .htaccess, I have no idea what the source of the error message can be, but apache should look for .htaccess in each directory or else how could it interpret them? Sure enough, if you have no such file there, then it is strange to see such a message.
  5. Sure, you are right, there is and in my post I just briefly mention how to deal with addon domains because in my experience they are easier to manage since if one uses cPanel's "Create an Addon Domain" feature then by default the domain server will point to the given document root directory and all is setup well. At least in a properly configured cPanel account of course. So I really never had issues with addon domains. That is why my blogpost is mostly about how websites of addon domains and the website of the main domain can live happily together side-by-side in subdirs of public_htm/www. Regarding your issue, is seems to me that your files and directories do not have the permission/owner settings your server requires. Did you check those? EDIT: probably this is the most extensive guide we have in the docs: https://processwire.com/docs/security/file-permissions/
  6. Hi, The short answer is that you can't. The long one is that ProcessWire site profiles are not like themes you can just simply replace. You need to refactor your current template files. Or am I misunderstanding your question perhaps?
  7. Yep, it does not. Maybe because config.php is already included? I should check it Anyway, because of such issues I recently switched to using __DIR__, eg: require_once __DIR__ . '/./creds.php';
  8. include_once "creds.php" and similar do work for me. Maybe is it something about your setup?
  9. Hi, I guess you have permission issues. In my cPanel blog post I show my own setup, you might be interested in it.
  10. Hi and welcome to ProcessWire, First of all, I do not think 10k+ sub-pages would be an issue for ProcessWire, but as the database grows optimized queries and caching are a must which is possible with PW, especially if your server is fast enough since you can delegate some logic to PHP as well when that can cut down on SQL queries. What you will not get with ProcessWire out of the box are things like "sales graphs, shipping methods & costs, order status, payment status (for bank transfers for example) etc..." Padloper can help you there but even Padloper is more like a skeleton then an out of the box solution. I've never used it but that is what I have gathered by reading about it. I have experience with WooCommerce and Magento v1, I wouldn't recommend any of them though. Magento is "over engineered" I think (they call it enterprise level, I call it unnecessarily complicated) and WooCommerce is just WordPress, so you know what it means... If you feel confident with Symfony then the alternatives you found sound viable options to me. I am working on a ProcessWire ecommerce site at the moment but I'm free in choosing external tools like Snipcart which is an alternative way to cut down on development. Hope this helps a bit. Others might join in the discussion with more info on the topic.
  11. I should have gone to bed last night instead of... It does work indeed (PW 3.0.62) I was probably on the wrong page of the site to test it but around midnight it is sometimes hard to tell things apart Thanks for your help @thetuningspoon and @Robin S!
  12. You mean this one? https://github.com/processwire/processwire/blob/master/wire/core/WireInput.php#L504 https://processwire.com/api/ref/input/http-url/ Does not seem to work. I get no query string. Not to mention the lack of urlSegmentsStr support, at least I cannot see it or looking at a completely wrong place... I dunno At least your snippet works fine. Thanks once more!
  13. I have turned it into a Page method: /* Returns the complete URL of a Page. * * @param int arguments[0] Pass false to exclude the pageNum of the Paginator * @return string */ $wire->addHookMethod('Page::siteCompleteUrl', function($event) { $withPageNum = isset($event->arguments[0]) ? $event->arguments[0] : true; $full_url = page()->url; if (input()->urlSegmentsStr) { $full_url .= input()->urlSegmentsStr; } if ($withPageNum && input()->pageNum > 1) { $full_url .= "/" . config()->pageNumUrlPrefix . input()->pageNum; } $event->return = $full_url; }); Small changes were applied to it: "/" is added in the second "if" to avoid double slashes on the pages of the paginator first argument can be used to exclude the page number of the paginator, defaults to true
  14. Could be turned into an optional core feature Thanks for sharing anyway!
  15. So maybe it is me who has not spent too much time on it? I see what you mean now. Yep, I guess the label did change but Page == Page Reference, so the latter is more appropriate.
  16. Hi, I guess you just do not spend too much time setting up ProcessWire fields If you need a "Page field" you have to choose "Page Reference", it has always been the case since it stores references to Page objects not the Pages themselves. I guess Notifications is used by the Notifications Module but I've never checked it as it looks obvious. Hope this helps.
  17. Regarding your first issue: and in mystyles.js: CKEDITOR.stylesSet.add( 'mystyles', [ { name: 'Warning Paragraph', element: 'p', attributes: {'class': 'uk-alert-warning', 'data-uk-alert': ''} }, { name: 'Success Paragraph', element: 'p', attributes: {'class': 'uk-alert-success', 'data-uk-alert': ''} } ]); This setup works for me in ProcessWire 3.0.62. Is it what you are looking for? Also, something like this is my config-body.js: I have not yet worked with contents.css/contents-inline.css, it is still on my todo list...
  18. I have just tested @owzim's other great module InputfieldAceExtended which works perfectly if we want to use syntax highlighting for YAML. However, @Robin S's suggestion to fix the error changes the Details Tab, making it impossible to configure the InputField Type as seen in the screenshots below: original: after applying the suggestion:
  19. Aha, yes! Thank you! I keep forgetting that we have unformatted values too. I updated both methods in my original post. Cheers,
  20. Hi @Zeka Sure, however the most convenient way to do it is "just to save" what you've put together in the admin. Besides, site editors could do it too, just like working with Find's Bookmarks or ListerPro's Listers.
  21. Thank you @ryan, pretty impressive so far! Just one question: are we going to be able to save "presets" too? So that predefined export/import settings can be made available when needed.
  22. @owzim Hi, any chance of applying this fix? Thank you in advance.
  23. Hi PW fanatics In this post I share two of my addHookMethods for those interested. As you surely already know (if not, time to take a look at it) the Wire::addHookMethod() and the Wire::addHookProperty() API methods can be used to "breath some extra OOP" into your projects. Using addHookMethods and addHookProperty are alternatives to "Using custom page types in ProcessWire". The methods I want to share: basically the idea here is to get the URL pointing to images uploaded in the admin without writing much code in the template files. With methods like these below, it does not matter what Formatted value is set to the images, because some predefined defaults are used in all circumstances. #1 Example template file code: <?php $img_src = $latest_article->siteFeaturedImage(); ?> <img src="<?= $img_src ?>" alt="<?= $page->title ?>"> addHookMethod goes into /site/init.php <?php /* Returns URL of the original Pageimage of Article. * Image field's value can be either null (default missing image), Pageimage or Pageimages. * * @return string */ $wire->addHookMethod('Page::siteFeaturedImage', function($event) { $page = $event->object; if ($page->template != "article") { throw new WireException("Page::siteFeaturedImage() only works on 'Pages of article template', Page ID=$page is not such!"); } $article_featured = $page->getUnformatted('article_featured'); //always a Pageimages array if (count($article_featured)) { $img_url = $article_featured->first()->url; } else { $img_url = urls()->templates . "assets/img/missing-article_image.jpg"; //we show this when image is not available } $event->return = $img_url; }); ?> #2 Example template file code: <?php $img600_src = $page->siteProductImageMaxSize(600, 600, ['rotate' => 180]); ?> <img src="<?= $img600_src ?>" alt="<?= $page->title ?>"> addHookMethod goes into /site/init.php <?php /* Generates image variations for Product images. Returns URL of Pageimage. * Image field's value can be either null (default missing image), Pageimage or Pageimages. * * @param int arguments[0] Max allowed width * @param int arguments[1] Max allowed height * @param array arguments[2] See `Pageimage::size()` method for options * @return string */ $wire->addHookMethod('Page::siteProductImageMaxSize', function($event) { $page = $event->object; if ($page->template != "product") { throw new WireException("Page::siteProductImageMaxSize() only works on 'Pages of product template', Page ID=$page is not such!"); } $width = isset($event->arguments[0]) ? $event->arguments[0] : 48; //default width $height = isset($event->arguments[1]) ? $event->arguments[1] : 48; //default height $options = isset($event->arguments[2]) ? $event->arguments[2] : $options = array(); //default empty options $product_image = $page->getUnformatted('product_image'); //always a Pageimages array if (count($product_image)) { $img_url = $product_image->first()->maxSize($width, $height, $options)->url; } else { $img_url = urls()->templates . "assets/img/product-missing-image.jpg"; //we show this when image is not available } $event->return = $img_url; }); ?> BTW, you can find more examples here: How can I add a new method via a hook? Working with custom utility hooks Adding array_chunk support to WireArray addHookProperty() versus addHookMethod() Have a nice weekend!
  24. Hello @madknight and welcome to the ProcessWire Forums, Have you already seen this? https://processwire.com/docs/tutorials/ especially: Installing a CSS Framework How to structure your template files also, in the newest versions of ProcessWire we have Markup Regions: https://processwire.com/blog/posts/processwire-3.0.62-and-more-on-markup-regions/ and Field Rendering: https://processwire.com/blog/posts/processwire-3.0.7-expands-field-rendering-page-path-history-and-more/ I use the above two to better structure my template files. In my setup Markup Regions is used for various page layouts where I can also dinamically add additional script and css files to a given page when needed (e.g. only the home page needs a slider JS and its CSS, etc...) I use filed rendering to render the "Main Content div" and also some fields when appropriate. I also use include when rendering fields is not possible (there are no such fields...), eg.: include __DIR__ . '/../../partials/article-lead-home.php' But there are various ways to do it. Some use templating engines for example, such us Twig, Latte, etc... You can find modules which support working with them more easily. In ProcessWire first you need to figure out your own way of setting site profiles up. It takes time, but it is worth it because you can build your "frontend theme" – which we call Site Profiles BTW – the way you want. Hope this helps. Also you can seach the forum for more ideas. Just use Google like this or similar.
×
×
  • Create New...