Jump to content

joe_g

Members
  • Posts

    239
  • Joined

  • Last visited

Everything posted by joe_g

  1. @Robin S I can confirm that this works really well. it's a relief, honestly - I expected having to dive deep int sql for this. One thing that doesn't seem to work is to match things in quotations "Alice One" and "Alice Two" will both be considered related because of the same first name "Alice", regardless of quotes or not. But that's fine in my case.
  2. Thanks!, I edited my post above while you responded. In the mean time I've realized that my misunderstanding is that I can't replace parent regions, then the child regions will be destroyed. Like, I can't have this and update both foo and bar directly using replacement <div id="region1"> foo <div id="region2"> bar </div> </div> i would have to do <div id="region1"> <div id="region1inner"> foo </div> <div id="region2"> bar </div> </div> However, as you suggest, I can add to the parent like (using the code from my previous post) <div id="maincontent" pw-append> added this to main </div> <div id="testregion"> replaced </div> ..as long as i don't replace the whole parent. This makes sense, since I suppose this is some form of string replace behind the scenes awesome, and thanks again Ryan! J
  3. Thanks for getting back about this! Here is a test (using tailwind css). _main.php (global) <body> <div id="maincontent"> </div> </body> _testregion.php (appended to template 'test' under files tab) <div id="testregion" class="border border-red-600"> default value from _testregion.php </div> test.php (actual PW template) - note the nested divs, how testregion is inside maincontent. <div id='maincontent'> <div class="p-8"> <div id="testregion"> should be inside red border? </div> </div> </div> What I'm trying to do is to apply my own "markup pattern" called testregion to an arbitrary position, but it doesn't do what I expect. Instead of getting "Should be inside red border" inside the red boder, i get _testregion.php appended after the output of _main.php. The result looks like this: However, it does work if I specify the innermost region in test.php, like <div id="testregion"> should be inside red border? </div> That means i can't match arbitrary regions that are inside each other, it would always have to be the innermost region(s)? This means that the site structure (the markup hierarchy) has to be entirely defined inside _main and I can never specify some markup that is simultaneously a parent and child. Maybe this is a good thing, I'm not sure. But this is what got me before.
  4. Hi there, I just discovered markup regions while looking for some templating solution. I've got a couple of layouts that are shared across a bunch of regular PW templates, and I'm looking for a way to abstract this, so that i don't need to have the same code duplicated across multiple places. I would like to keep the HTML "direct", so rather <div class="<?=$somePhp?>"> than, say echo "<div class=\'{$somePhp\}"> I think that rules out all regular delayed output strategies. Markup regions seemed perfect on the first look, but there are some limitations, if I understand it right 1. There is only one global markup region file (ie. _main). I can't use an arbitrary template file for some specific situation (like _myArticleLayout, for example) 2. I cant inherit templates, or chain, or stack them, or similar. I can't apply first _main, and then another one _article, for example 3. Related to this, I can only do appendTemplateFile globally in config.php, but I was hoping I can do this in the top of each template, or maybe even for parts of templates Now, some questions. Is there a better way to do this? Another templating engine? Is there a way I can use the magnificent markup region replacement engine myself, separately? Or did I simply misunderstood how this works? As a sidenote it seems I can't get nested regions to work, perhaps because I'm not using this the intended way? many thanks
  5. Hello, I'm lost with my Matrix (profield) and how to look for data using selectors: I have a matrix ("grid"), it has a 'matrix repeater type' mp4 that contains the fields 'mp4' and 'ratio' (and others): Under admin / repaters in the backend, things look a bit cryptic: Now, how do I find the mp4s that doesn't have a ratio? I would imagine something like wire('pages')->find("template=repeater_grid,mp4!='',ratio=''"); ..but I can't get any meaningful results back. If I could only get all mp4's, that would already be a good start... many thanks J
  6. Thanks, I used your code and did this: if($input->get('setlang')) { $session->set("userLanguage", $user->language->id); } else { $langId = $session->get("userLanguage"); if($langId) { $newUrl = $page->localUrl($langId); if ($session->get("userLanguage") && $langId !== $user->language->id) { $session->redirect($newUrl); } } } ..but then I realized it doesn't work together with caching... Duh. I guess it's localstorage or nothing?
  7. Hi there, I've got a client who would like to store the selected language, if it's not the default language. The only way I can think of is to use localstorage from js, but that would mean loading the whole front page, then reloading it again in the right language - ew! Is there a better way that vibes with the built in language functionality? I'm hoping to avoid session cookies and such. Also, I'm not sure how the language redirect really works. I suppose it's done in htaccess somehow, but to capture it before it happens I wouldn't know where to 'inject' that functionality. maybe the best solution is to not bother?
  8. Thank you both! I feel I have a lot to discover now! Hopefully I won't make another vue app for a while 🙂 J
  9. Hi there, I had a brief look at livewire and hotwire - and I love the concepts behind them. I really dislike having to choose between making a SPA or a server side site, the two paradigms are so different and hard to mix. If I understand live-/hotwire right it could mean a single paradigm for both client and server data manipulation, which I haven't experience since visual basic 6 :P To be able to model a regular PW site and then sprinkle it with app-like behaviours here and there would be absolutely incredible. I almost considering stepping over to Laravel for this reason, but it's a big step for me. Neither livewire or hotwire seems to exist without Rails or Laravel. So this seems to be a must. Anyone had experience with this, or something similar? Is there something similar that would work with PW?
  10. Oh wow, if this works the way i think it does this could really be it. I can combine **= with limit=20, for example and only get the most related. Thanks! ps. I've been meaning to learn more about selectors, they've really expanded last couple of years.
  11. Popularity has it's use, and I'm doing that as well for a different visualization. But in this project I'm mainly looking for similarity. "obscure" similarity is more important than "popular" similarity. Lets say a project have 1000 project that share some popular tags, but there is only 2 that share the same (obscure) tag - on top of the popular ones - those 2 are the most important to show. If I prioritize popularity those 2 projects will be buried somewhere. This probably needs to be some custom sql, just not sure how to write it.
  12. Thanks both. RockFinder looks great, didn't know about that module before. But I wonder if it can do what I need. I suppose bot findRaw and rockFinder would need to first load all pages that has 1 or more keywords in common - in my case that can be a lot of pages since some keywords are very generic. Lets say I have 20k projects and half of them might have the keyword "collaboration". What I need is the intersection of the most common, and only the first 'X first' hits. I suppose the only way that can be done is with sql, since the data is purely relative (unlike how rockFinder works, there is no dataset to "start" with - i can't start with 10k pages). Now, how to solve it haha - that's going to be a bit challenging.
  13. Hi there, Is there I can sort by "number of things in common". For example, I have "projects" with "tags". I'd like to show the 20 projects that is "most related". So first show the projects with 3 tags in common, then 2 tags in common, etc. Perhaps something like: $pages>find("template=project,limit=20,tags={$tags},sort=in-common-[tags]") Is there a way I could do this in a scalable manner? (As in, avoid getting all results and loop through them)? Custom SQL? thanks!
  14. Thank you! Indeed it worked, after adding the namespace. It's embarrassing but I still don't full understand namespaces. Or rather, I kinda do but I'm not sure when I need to declare "namespace ProcessWire;" in a PW template...
  15. Hi all, I'm trying to generate .ics / iCalendar files from PW, but PW strips custom headers. Is there a way I can do this? Many thanks. (This is a repost, sorry - trying a better title for better traction)
  16. Hi there, If I try to add a custom header it gets removed by PW header('Content-type: text/calendar; charset=utf-8'); I can see that $http->setHeader was introduced in v.193, but not yet in the stable branch. I assume it should work with the new way to set a header. What can i do to achieve this in the stable branch? thanks!
  17. Very nice. That worked, thanks. That lead me to try at set the access. check_access=0 feels like a workaround. But, somehow it doesn't work with guest access enabled - You wouldn't happen to know why?
  18. Hi, selecting repeater items only works if i'm logged in If i'm not logged in this gives an empty result $pages->find('template=repeater_times') How can I make this work when I'm logged out? thanks
  19. oh i see "repeater_times" does the job
  20. Hi there, How can I select all repeater items in a selector. Lets say I have a template "event" with the repeater "times". I'd like to get all "times" and store them in a PageArray, regardless from where in the site they are. I this possible? I would like to be able to do something like ->find('template=event.times,startdate>'.now()); I know I cant do that....., but is there a way to do something similar? tx! J
  21. Amazing. Thank you! It works perfectly. What wasn't clear to me is how the dependencies translated to PW. Now I know: 1. look in the source for all dependencies recursively until I there is no more 2. download all of them 3. add all of them to PW 4. enable all of them 5. profit What's your thoughts on using the online ckeditor builder? When I try it out it gives a whole package with lots of stuff - of which some would maybe conflict with PW's install, perhaps. Table, for example is already installed. The whole CKEditor ecosystem is seemingly really powerful, but would be good to have a more automated process for installing it. J
  22. Hi there, I'm trying to install the 'detail' plugin https://github.com/akilli/ckeditor4-detail But, after enabling it i get a 404 in the network tab and the text field doesn't display at all: http://domain.com/wire/modules/Inputfield/InputfieldCKEditor/ckeditor-4.12.1/plugins/api/plugin.js?t=2015030801.162 The plugin isn't supposed to have any dependencies.. I think. Also the 'api' folder doesn't exist under plugins. So now I'm not sure how to go troubleshoot this further. thanks! J
  23. Thanks! Not using a lot of cache on this particular site, maybe 30 is normal and i just need to simply cache more...
  24. Hi there, On one site (on tsohost.com) i get this error message that I'm using too many db connections. The site will hang for half a minute then work again. I wonder, is max 30 low, or normal? It's the first time in a decade I encounter this issue in PW. I'm doing some custom logging so i do new Page() and ->save() for some pages, could this mess with the db connection pooling? Do i need to explicitely close any connections?? I would imagine I don't need to do anything like that, or? many thanks J
×
×
  • Create New...