joe_g
Members-
Posts
395 -
Joined
-
Last visited
Everything posted by joe_g
-
Cannot redeclare class FieldtypeTextLanguage after copying site
joe_g replied to joe_g's topic in General Support
thanks, deleted sessions on both sites, no effect tho j -
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
-
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;
-
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?
-
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
-
ahhh yess! I somehow missed the $config->prependTemplateFile thing ProCache AND correct URL thanks!!
-
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..
-
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...
-
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>
-
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
-
thanks! didn't know about the date archiver module.
-
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
-
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
-
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
-
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
-
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
-
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
-
Hi, I ran into an issue with the multiple page names module. When a page is created from a page field ( The "Allow new pages to be created from field?" checkbox), it is only published in the default language. So I wonder if there is a way to get these automatically created pages get published in all languages per default. thanks, J
-
Hi, I'm doing a bilingual site, but I'm trying to avoid multi-language page names. I don't want the editor to be able to unpublish things per language, and one url is enough per page. If i uninstall multi-language page names, the possibility for language urls disappear (/en/url, /nl/url) – what would be the best way to get these urls without multi-language page names? I'm aware of the old method by having gateway templates and pages (/en and /nl) but this method complicates url segments, so I was hoping there was a more 'core' way of doing it. thanks J
-
sweet thanks, all i have to do is if(!$config->ajax) { echo $pages->get('/')->render(); } else { ...stuff } ..no fiddling with .htaccess
-
I'm trying to write a site where all urls/routing happens client-side via pushstate/popstate (I'm a bit new to pushstate). My problem is how to separate client side request and server side requests. Ideally I'd like to use the same structure for both client side and server side, like: 1. access /url 2. with htaccess rewrite / is served - (SPA app-style) 3. my JS loads /url and shows it This way I can use a $page->url like it's a classic server side site. One solution is to add ?ajax=true to all ajax calls and let RewriteCond pass these through (http://stackoverflow.com/questions/10708273/redirect-ajax-query-by-htaccess) Another solution would be to put all server side content in a separate folder somehow I'm not sure what would be the cleanest most future-proof way of doing this, maybe someone else did this and have some insights? thanks! J
-
Remove all line breaks from file shown to visitor
joe_g replied to Lars282's topic in General Support
Perfect! thanks / bedankt! -
Remove all line breaks from file shown to visitor
joe_g replied to Lars282's topic in General Support
is there any server side solution to this ? Otherwise I should maybe try and write a module myself. All the client side solutions a pretty awful. I started using inline-block instead of float – much better, except for the space issue. j