Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by tsdtsdtsd

  1. Thanks for all the answers guys. I changed the JS structure a bit to solve my problem. There are enough ways around this problem, but I still want to point out that I think that any kind of automation should be fail-safe as possible. A totally generic regex is not slightly fail-safe. It's not even code related, I could have "require(..." as a static text on a page. Don't get me wrong, I don't want to bash PW. As I said, I think there are enough ways to work around this problem. But an automation should be sane or at least point out it's obvious traps and disadvantages in the first place. Anyway, cheers for your help!
  2. Hi BitPoet, thanks for your answer. Sadly your solution is not an option for this site. Guess I will have to set proper namespaces by myself or find another workaround.
  3. Hi there, I recently updated to PW 3 and I'm using the AUTO-mode for the compiler. Everything worked like a charm, but now I'm getting a strange behavior which I would classify as a bug. I have the following in a template (which I'm including in the sites real template): <script> require(['hljs'], function(hljs) { hljs.initHighlighting(); }); </script> Plain old HTML+JS. Now, when I open up the site, the compiler made this: <script> require(\ProcessWire\wire('files')->compile(['hljs'],array('includes'=>true,'namespace'=>true,'modules'=>true,'skipIfNamespace'=>true)), function(hljs) { hljs.initHighlighting(); </script> Seems to me that the compiler touches something that it should not. I couldn't find anything related here... bare with me if this is something well known. Cheers
  4. Ahahaha this is great Thanks for Gor mate, awesome product!
  5. Hi guys, I'm learning Go since a few weeks and every now and then I stumble over some great tools for web development. This one I found yesterday is awesome if you work with large scale systems: https://github.com/buger/gor/ Under the hood it works with raw socket connections, like a sniffer, pcap or wireshark, but without using the well known libpcap. I guess the performance impact is the smallest possible. Take a look at the github page if you like, it has some very interesting features. Maybe a handy tool for some of you Cheers
  6. I have a similar problem, but I guess there isn't much to do here. The problem derives from MySQLs fulltext search. If you have root access, you can always change the letter minimum (http://stackoverflow.com/questions/1585611/mysql-full-text-search-for-words-with-three-or-less-letters) and rebuild indexes (be aware of performance impacts). SQL fulltext searches are very basic and imperfect. They are fine for most of us, but if you need a real reliable, tolerant/fuzzy site search you would need to implement something more professional. There are many products on this topic, like elasticsearch (awesome), Lucene or Solr, but they all need a server with root access. The topic is comprehensive. Easy to learn, hard to master. If you can't be bothered with that, there is still this Lucene implementation from Zend, which is just a buch of PHP files without a full blown server (http://framework.zend.com/manual/current/en/modules/zendsearch.lucene.searching.html), badly documented though. It's a nice start and you can learn the very basics of search engines/indexers with it. But, naturally to PHP, this solution will not be able to handle big amounts of data. Af few thousand documents in the index and the fun is over already.
  7. @SiNNuT Thanks for the feedback! The contrast thing is worth a look, I'll see what I can do. And nice catch on the typo
  8. I just relaunched a new version of the site. Jsut a graphical overhaul, still nothing extremely interesting to see, still only in German. But maybe I can get some feedback http://www.about-orkan.de
  9. This topic can be handled in a simple way like Tom suggests (or even simpler) or in a very complex way, like using machine learning algorithms and tools (e.g. https://prediction.io/ From a non-technical view, you want to recommend: - products that are similar (comparing attributes/specs of products) and/or - products based on behaviour of other visitors (user A looks at product X; previously user B, who also looked at product X bought a similar product Y, so recommend Y to A). Another simple way could be to reccomend based on visit statistics and categories: the users looks at a t-shirt -> recommend him the most viewed t-shirts.
  10. I had the same problem a few days ago when I tried to add 40 highres images in one go. On localhost. There were only like 3 images in the assets folder, rest didn't make it, except into the db. I mixed things up pretty bad, sorry. Had that installation still lying around and refreshed my memory: I had a problem with images, but not nearly close to this one (was about generating lots and lots of thumbnails).
  11. Hey tpr, you are absolutely right and tbh I didn't think of that option. The reason is maybe a little specific to my projects. Usualy I build my sites out of individual elements/widgets, which are placed on/called by the templates. These elements get rendered by a new TemplateFile object. I could pass the $bigList along to the $teaser to use your method too. Guess it made more sense for me to make the elements as autonomous as possible, with little to no dependencies. So they rather fetch information as they need it, instead of depending on the template. Thought that makes my code a little better readable and nicer to follow. And I have a reusable workflow Cheers
  12. Oh, and here is already a downer for you: Beware of thy cache! When using markup cache, this module is naturally not able to collect the pages from cached code. Subsequent selectors may include pages from cached content. Currently I'm storing some metainfo to the cache as an addition to evade the problem on personal projects. Not sure how this could be handled more globally.
  13. Hey there, this is a little helper I'm using on some sites, thougth mabe someone is interested. With this simple module you can easily add pages to a global blacklist and use it for filtering of subsequent selector queries. The idea is the following: Let's assume you have something like a blog. You have a simple list of articles in the main column of the page, showing the newest articles from every category. Also you have a small teaser on the right sidebar, showing the latest articles filed under a special category, like news. Now you possibly don't want that teaser to include articles, which are already in the big list in the main column. PageBlacklist is a small module, helping you to implement blacklisting on for such cases. Assuming the scenario on the top, your code could look something like this: // Retrieve the maincol list and add to blacklist $bigList = $pages->find('template=article, sort=-created'); $pageBlacklist->add($bigList); // Possibly you will output $bigList here // Retrieve the sidecol teaser, excluding blacklisted articles $teaser = $pages->find('template=article, parent=news, sort=-created, ' . $pageBlacklist); // Basically, this will alter the selector to something like: // 'template=article, parent=news, sort=-created, id!=1012,1031,1153' I would love to hear ideas to improve this helpfull little module. You can find PageBlacklist on GitHub: https://github.com/tsdtsdtsd/PageBlacklist
  14. Thanks horst. I'll just change it, but still, i'm puzzled and would love to know the cause. I couldn't reproduce this, neither on linux nor windows. Sometimes I just want to slap myself really hard... I did not get the error previously because I'm running PHP 5.6, where my code is allowed, but not in older versions. I'm already so used to 5.6 -.- Prior to 5.6, properties are not allowed to be expressions (in my case, the concat of constants and strings). Thanks guys & cheers
  15. Hi nfil, thanks for the report, but could you possibly give me more information? I couldn't reproduce your issue. There's really not much on line 40, I'm a little puzzled protected $_pathToTemplates = DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR;
  16. You could add a Page field, which links from one page to another. If it is filled, use the data from the linked page instead of the current one and use its URL to set a canonical for google.
  17. Plyr Media Player for ProcessWire ! beta status. This module is "work in progress" v0.2 ! Please be patient as this is my very first public module ^^ This module adds the Plyr HTML5 Media Player (plyr.io) to ProcessWire. Plyr is basically a wrapper for the natural media interface in modern browsers. It adds the ability for easy styling via CSS and a sprite, while being fully responsive. Also Plyr gives you full controll over the player with its great javascript interface. MarkupPlyrMediaPlayer incorporates Plyr for ProcessWire. -> GitHub -> Module directory Current capabilities After installation, you will notice some module configuration options. These are: - Automatic Mode If enabled, this option will automaticaly add all needed resources into your pages output. - Use CDN Use the official Plyr CDN (Content Delivery Network) for resources? The following resource options are only required if you don't wish to use the CDN: - Path to CSS file (Path to your CSS file, required to style the players.) - Path to Plyr library (Path to the Plyr javascript library, required for the functionality.) - Path to SVG sprite (Path to your SVG sprite image file, required to style the players.) Automatic mode If automatic mode is enabled, the module hooks after the page rendering and automatically adds the stylesheet to HTML head. Also adds an AJAX call to fetch the SVG sprite and the Plyr javascript library right before the ending body-tag. Also, while in automatic mode, that extra markup will only be rendered if a template made a render request for a Plyr player. So there will be no unnecessary load on your site. Get module $plyr = $modules->get("MarkupPlyrMediaPlayer"); Add a video player to your template echo $plyr->renderVideoPlayer($poster, $mp4, $webm, $captions); The $captions-Array contains details of the caption tracks: $captions = $caption = array(); $caption['label'] # Something like "English captions" $caption['src'] # http://...movie_captions_en.vtt $caption['srclang'] # en|de|ru|... $caption['default'] # true|false array_push($captions, $caption); Add an audio player to your template echo $plyr->renderAudioPlayer($mp3Path, $oggPath); Add the YouTube-wrapper to your template echo $plyr->renderYoutubePlayer($videoId); Manual mode If automatic mode is disabled, you have to render these parts manualy in your page template. Important: This method will not check if a player was requested. In the HTML head: <html> <head> ... <?php echo $plyr->renderHeadLink(); // Basicly just a <link rel="stylesheet" href="..."> ?> </head> ... And in the footer somewhere before the closing body-tag: ... echo $plyr->renderScripts; // AJAX call for SVG and JS library inclusion </body> </html> Where is this going? Before getting a v1.0.0 stable release, this module should be capable of following features: - [done] Load resources from CDN or local files - Reliable automatic mode with fallback to local - Brings specific Inputfields for video, audio and youtube for the backend and frontend markup rendering - Every Plyr javascript setting can be handled via module configuration
  18. That's very likely. I had a similar problem with a webfont once. On a side note, if SEO is important for you: You should have not more or less than exactly one h1-tag per page. Change those headlines to h2 or even h3.
  19. TL;DR: $node->children->has($page) Guessing that you iterate over your pages. Let's say your page-2 is currently held in $node, you could do something like: $class = ''; if($node->children->has($page)) { $class = 'current'; } echo '<li><a .... class="' . $class . '">...';
  20. @LostKobrakai Very nice, thanks for sharing. I use similar logic in some cases but never made a module out of it... @BernhardB Let's say you have an element in your page header that echoes a text field and that element is mandatory. Most of the times your element will show a text related to the current category, but you want to be able to overwrite that text in some cases on some child pages. With this module (well, with a Text version of it instead of Integer) you can do that easyly and even see it in admin.
  21. If it's not a huge overhead for your script, you can just bootstrap the processwire installation. You can find the documentation here: https://processwire.com/api/include/
  22. Clearly it is. But hell, repetition keeps people thinking.
  23. ^ This! And well, I liked the idea behind it, but McD already declined -.-
  24. Huge site man, nice work! Looks like a ton of sweat and tears. I noticed that you have HTML tags in some meta-tags, which at least W3C and Chrome doesn't like. For example on this site: http://www.yucatanliving.com/art/mayaland-stained-glass-windows <meta name="description" content="If you are going to Chichen Itza, consider walking out the back entrance towards <a href="http://www.mayaland.com/">Mayaland </a>(or driving around and parking there) to check out these beautiful stained glass windows..." /> Same in the og:description-meta. If you don't mind some criticism: one thing that really bugs me is the navigation. I feel a little lost with all those links, which don't seem to be structured in any way (or I just didn't get it ). I just don't feel 'guided', hope you know what I mean. Cheers
  • Create New...