Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by joe_g

  1. Hi, I got this error happening sometimes (I only notice it in the logs, and I can't see any problem on the site) 2014-11-21 03:59:00 guest http://subdomain.domain.com,domain.com,www.domain.com/http404/ Error: Exception: Method Page::localUrl does not exist or is not callable in this context (in /home/domain.com/public_html/wire/core/Wire.php line 320) I'm not sure where/how to debug this since I don't know when or where it happens. The error sends an email, othewise I wouldn't have noticed. Is there a way to get a full stack trace for this error somehow? j
  2. heyhey, here is something off topic: Are there any MEAN/node devs here? Just a general question, I'm interested in nodejs, but what's holding me back is that to get to the same level of slickness of an admin interface as processwire seems to be very hard work. It seems easy enough in both RoR and Django, for example, but with node, not as easy. Making admin interfaces is such an incredible drag, this is one of the reasons why I love PW. Clients love that slick custom admin they get to work with. Just curious to hear if anyone had any experience with writing an admin interface based on MEAN/node, from a processwire perspective. - CRUD with - relationships (like pages in PW) - users - access levels / groups - access rights - multilingual (very important) I should mention that I'm not looking for any presentation layer (templates/views, etc). Only a way to handle the data (with some custom data model) in a client-friendly way. cheers, J
  3. Hi there, Locally I can only be logged in to one PW install at a time. It's becoming a bit cumbersome, since I'm juggling about five different project at a time (all PW installs), so every time i switch project I need to login again. Is there any way to avoid this? thanks!, J
  4. I could do this I guess, and then the name will be calculated? $default = wire("languages")->get("default"); $p->title->setLanguageValue($default, 'blablabla'); thanks, j
  5. Hello, this works: $user->language = wire("languages")->get("default"); $p = new Page(); $p->parent = $pages->get('/things'); $p->template = $templates->get('mytemplate'); $p->title = 'blablabla'; $p->save(); ..but this doesn't (in pw2.4): $user->language = wire("languages")->get("english"); $p = new Page(); $p->parent = $pages->get('/things'); $p->template = $templates->get('mytemplate'); $p->title = 'blablabla'; $p->save(); i get Can't save page 0: /en/things/: It has an empty 'name' field any ideas how to get around this? J
  6. I solved it like this: https://processwire.com/talk/topic/2598-fatal-error-cannot-redeclare-class-sessionloginthrottle-on-update/ I deleted the /wire folder, then pasted in the /wire folder from a different (totally unrelated) project the difference in my case was that it was happening locally
  7. thanks, deleted sessions on both sites, no effect tho j
  8. Hello, I get this error after copying a v2.4 site (from /xx to /yy) Somehow the copy have a reference to the old location. So on the new site (/yy) i get: Fatal error: Cannot redeclare class FieldtypeTextLanguage in /Applications/MAMP/htdocs/xx/wire/modules/LanguageSupport/FieldtypeTextLanguage.module on line 17 This error message was shown because site is in debug mode ($config->debug = true; in /site/config.php). Error has been logged. What can I do to make the new copy (/yy) forget about the old location? - I tried deleting the module cache. - .htaccess is identical in both cases, there is no reference to /xx - $config->httpHosts = array('localhost:8888', 'localhost'); // also identical - deleted the sessions on both /xx and /yy
  9. I tried looping through the repeater values and publishing them for all languages, but no luck so far: (site is 2.4) $pages->setOutputFormatting(false); $pps = $pages->find('has_parent=/processwire/repeaters/for-field-116/'); foreach($pps as $p) { foreach($languages as $lang) { if($lang->isDefault()) continue; $p->set("status$lang", 1); echo "set status$lang" . $p->title . ' <br>'; $p->save(); } } die;
  10. I ran into this issue again, and ryans file works, but only for new entries (after fix is applied). I've got a project with lot of repeater data that I can't enter all over again. Is there a way to loop through all repeaters and publish them for all languages?
  11. Hello again, This solution isn't 100% working yet: - an url /page redirects to /maindomain/nl/page/ instead of /nl/page/ I can see how this will give problems in the long run when the wrong url get indexed by google - also with 404's - it still redirect to /maindomain/nl/404page/ - and also the admin is running on the wrong url /maindomain/processwire/ It does feel a bit hacky to set $config->urls->root = '/'; I suppose the most reliable thing is to make sure the site runs in it's own webroot? j
  12. ahhh yess! I somehow missed the $config->prependTemplateFile thing ProCache AND correct URL thanks!!
  13. I can't get the combo to work - maybe because my site is multilingual. I suppose the /nl/ or /en/ redirect happens before anything else, to the $config->urls->root = '/'; should happen just before that? On top of my templates, might be already too late? If I put it on line 196 in index.php the url is correct, but ProCache doesn't like that..
  14. Thanks! Indeed it works, but this trick seems incompatible with ProCache :/ If I do this, ProCache stops serving cached results. But then it gets weird: With ProCache I don't need this trick! BOTH the right and wrong URL's work fine, so I guess I just have to make sure the wrong URL never gets used by string-replaceing, or something like that...
  15. Thanks! They are all commented out (like your example). But I've tried RewriteBase / RewriteBase /maindomain/ RewriteBase http://subdomain.maindomain.com/maindomain/ RewriteBase /maindomain (error) RewriteBase maindomain/ (error) no luck so far... But after looking around in the forum I should check that the server allows overrides (i think?) <Directory "/"> Options All AllowOverride All </Directory>
  16. Hi there, I have a hosting/path issue: I have a website running on, say subdomain.maindomain.com when I go there, processwire redirects to subdomain.maindomain.com/maindomain/, instead of staying on subdomain.maindomain.com/ $config->urls->root is "/maindomain/" but should be just "/" $config->paths->root is "/home/someotherdomain/public_html/maindomain/" According to my host this is a comon problem and I recieved som instructions how to fix this for wordpress, but I can't decipher how to fix this for PW: instructions from host: Options + FollowSymlinks RewriteEngine On RewriteRule ^ / * (* [^ /] [^.]) $ Http (+ /.): //% {HTTP_HOST} / $ 1 $ 2 / [L, R = 301] - Open the database of your WordPress installation - Open the table 'wp_options' - Top Click 'Explore' - Adjust the following fields 'option_value' on - Siteurl: the url of the website - Home: the url of the website I have in my config.php: $config->httpHosts = array('subdomain.maindomain.com'); Anyone have a clue whats up with these urls? thanks! J
  17. Hi, is there a way to get the backend search function to search the titles of all languages instead of just default? And equally (if possible) I'm using the PageAutocomplete module, and if that one could also go through all languages instead of just default? thanks! J
  18. thanks! didn't know about the date archiver module.
  19. Hi, is there a faster/better way to do this? With events containing startdate (mandatory) and enddate (optional) - I'm looking up what years has one or more events: The result is a list of years that contains events. It works fine, but it's a bit slow. <?for($i=2014;$i>=1980;$i--) { $date_start = new DateTime(); $date_end = new DateTime(); $date_start = $date_start->setDate($i, 1, 1); $date_end = $date_end->setDate($i+1, 1, 1); $date_start_ts = $date_start->getTimestamp(); $date_end_ts = $date_end->getTimestamp(); $e = $pages->get('/event')->numChildren("enddate!='',enddate>$date_start_ts,startdate<=$date_end_ts"); $e2 = $pages->get('/event')->numChildren("enddate='',startdate>$date_start_ts,startdate<=$date_end_ts"); $tot = $e+$e2; if($tot>0) { echo $i; //print year since it has events } } ?> tx, j
  20. Heyhey, Writing entirely isomorphic (http://nerds.airbnb.com/isomorphic-javascript-future-web-apps/) websites with processwire is not possible. But are there any steps that could be taken in that direction? I write a lot of double code (both and client and server) because I want to use PW, but control what parts gets loaded where with ajax. Currently I use crossroads for client side routing. It's a bit of a mess with the double logic. Maybe the idea might be a bit outlandish, but I kind of would want to export the inclusion logic (what get rendered where) to javascript so I only have to write the server including in one place (x->render() in page y, etc). But maybe there are better ways to approach this. I figure I'm not the first to run into this issue. I'm hoping there would some tricks to make this a bit easier, or at least a bit more DRY, without abandoning PW. J (This is an attempt to rephrase an old question (https://processwire.com/talk/topic/6436-ajax-and-caching-structural-problem/) in a better way
  21. To conclude my lengthy rant: 1. Any ajax page combining parts of html fragments must be re-done server side. I guess there is no way around that everything has to be done twice (both server and client side). The alternative seems to be node (but then missing all the processwire goodness): http://stackoverflow.com/questions/20588865/node-framework-to-render-on-both-ends 2. Then my other problem I had is that any html fragment used for ajax loading can't have conditionals combined with caching (if ajax then), but that's quite obvious really. cheers, J
  22. Thanks Teppo, appreciate the help. My issue might be more about general pushstate/AJAX than processwire, probably. Sorry if the question is a bit sweeping. Maybe I can be more clear with an example (ignoring SEO for now): What I do now: 1. I have an url /list/open/first-item/ that shows a list of things where the first item is selected 2. The request is not ajax, so / gets sent instead 3. Client side, I load the two parts /list/ and /first-item/ and put them in place It works, but I can't cache /list/. In other words the URL's collide. I have to make sure the ajax fragments have separate urls (option 1 above). What I probably should be doing: 1. The url /list/open/first-item/ should recreate the exact same output as if it was done client side 2. send response to client, done In general, what I think I have to do is: 1. create separate url's for all fragments like (/list-fragment/ and /open-item-fragment/first-item/) so that the urls doesn't collide. 2. For every url, server side, paste together a response that is identical if it would be done client side. Is there any good way to do the double logic both server and client side? To at least try and do this as DRY as possible ? thanks! J
  23. Hi, I think I fell into a bit of a structural trap. I built a site using pushstate and client side routing. On the top of all pages I check if the request is an ajax request like so: if(!$config->ajax) { echo $pages->get('/')->render(); } else { ...serve the page } ...if the user ask for /an/url/ they will get / instead but the clientside routing will handle the path. And, in the future, it would be easy to check if the request is from a search spider, then I would also just serve the content straight up. Clever, I thought. Except it doesn't work with caching. (doh!). With this method an url using client side routing cannot be the same as the 'real' url underneath. How do you experts solve this? I was hoping there was a generic method that would work with all urls. I would like to have the same client side structure as server side structure as possible. I can see my options being 1. making separate urls for ajax request for everything /url and /url-ajax (ugly and high maintenance) 2. prefix the client side url with something client side /site/url/ maps to server side /url/ (easy and generic, but a bit weird for the user) 3. prefix the ajax calls with /ajax/url/ then server side get /url/ and remap all url segments (cleanest but url segments will cause trouble) 4. The traditional web app way: Use .htacces to serve / instead of /url/ if it's not a ajax call. (this might be the best option perhaps? Although I'm not an expert with .htaccess, this is what puts me off). I suppose with this method I could still use the caching, since the pages are effectively always ajax from processwire perpective (except root "/"). But this solution won't work with procache, I assume. Is there an easier way that I've missed? I have a feeling I'm missing some common knowledge, since this might be a common problem? I guess it would have been handy if /url/?ajax would create a separate cache entry than /url/, then I could simply append ?ajax to all ajax calls. But I think I understand that won't work since any GET variables basically turns off the caching, as far I understand. Any thoughts, tips, or comments are highly appreciated. thanks, J
  24. Actually, come to think about it, in this case I could skip the language prefixes and rely on a good old session variable instead. j
  25. Thanks, main reasons are - i don't want the editor to be able to unpublish per language (because it makes language-switching easier when everything is available in all languages, and I rather display a message "text is missing in english" with the un-translated text in dutch than not having a page at all) - Usability-wise: What happens when you want to switch from Dutch to English on a page that doesnt exist in English? (the EN button disappears? EN button is disabled? You get redirected to the home page? You get a message "page missing") Not good usability in any of these options, as far as I can see. - a page is either unpublished or published (for all languages, not per language). Conceptually simple. - the additional complexity for multiple urls, and what they mean, is confusing for the editor. The concept of having to care for the URLs at all is already a barrier. - avoid this issue https://processwire.com/talk/topic/5979-allow-new-pages-to-be-created-from-field-only-creates-in-default-language-when-using-multiple-page-names-module/ I'll look into the hook thing, but I have a feeling I might end up with the language-gateway solution in the end ... : P j
  • Create New...