Jump to content

thomas

Members
  • Posts

    196
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by thomas

  1. Hello, I have the task of rebuilding a rather large cataloque of products as well as adding another dimension to it. The structure looks like this: - bikes -- full-suspension --- product A --- product B --- product C -- hard tail --- product A and so so forth ... Now I need to add model years to it. So when a new model is released, the product can be duplicated, edited, and is now the default product, with the old one still being viewable via a direct link I am trying to decide if it is better to keep the page structure as it is or change it to a flat structure with all products under one parent, with it's category in a page field (as well as the model year in a page field). I could then build the URLs with URLSegments Is there any disadvantage to this approach? My main concern is of course speed, since this cataloque is rather large and bound to grow with the introduction of model years. Is listing pages in a tree find("parent=/bikes/hardtail/") much faster than finding by page field ("category=/bikes/hardtail,year=2015")? Or is there another approach to consider? Thanks for ideas, hints and thoughts -thomas
  2. Short question: Is it possible? Longer explanation: I have a rather big product cataloque which is viewable for registered users only. We now want to open it to the public. In the valued spirit of "I'd rather take 30 minutes to script something than 20 minutes to do it manually" I am looking for a way to change the access of 50 or so templates to "viewable for guest" but I can't find an API method. Can anyone help? Thanks, thomas
  3. Hello everyone, I'm having the same problem. Funny thing is, it worked until I left for a week. Came back, no more luck ... The subdomain homepage works //sub.domain.de/ Every child page //sub.domain.de/page/ gets redirected to //sub.domain.de/ Then I get Notice: Undefined index: it in /site/modules/Multisite/Multisite.module on line 68 Accessing //domain.de/sub.domain.de/page works fine I tried debugging it using error_log at a lot of places but can't figure it out. Apeisas original module does the same but without the notice. Something tells me it could be a server configuration issue since all I did was update Apache. Everything works fine though so I can't see a reason why this won't work. Has anyone found a solution? I'm halfway in my project and need multisite for this to work! Thanks, thomas
  4. Hello, has anyone here thought about building a PW backend as a Chrome App to support offline mode? The editors using the backend of the pages I built often travel to remote places without any internet access so they asked me if it was possible to draft the articles offline and then simply upload them once they have access again. My first idea was to build a Chrome App that stores all data locally until it's explicitly told to upload everything and publish the articles. I've never built a Chrome App but from what I've figured it would mean packing an entire PW installation, modifying the database and file upload classes to use local storage and add an online status listener to provide the upload functionality. Makes sense? Or is there another way to achieve this? Thanks, thomas
  5. That was it, thanks Soma!
  6. Hello, a long time ago I learned in this forum that a nice way of making something accessible throughout my site is public function ready() { $company = wire('pages')->get(...); $this->fuel->set("company", $company); } in a module. I use this so I only need to declare $company once and then use it in all of my templates. Now my question is twofold: - is this a good way of doing this? - I often use little scripts outside the template folder which bootstrap PW and do little things, mostly via Ajax or sometimes in the terminal. Now how can I make $company available to those? I tried a lot of combinations of wire('company'), $this->fuel->get and so on but no success. Who can help? Thanks, thomas
  7. Yes, normally every MarkupCache expires on any page save. You can disable this and then build your own caching logic with a hook on save() like Martijn suggested. So you tell it when to expire instead of when not to expire ...
  8. Thanks for the info! I found the error, it was my cache clearing module that kept looking for not-yet-existing cache files to delete.
  9. Hello, I have a site that writes a lot of MarkupCache files. I use a hook after save() to delete only the ones for the changed ID. Since these are a lot of cache files (up to 20.000 right now) this process takes a long time so I need to make sure it only happens when neccessary. My idea was this: Whenever a page gets saved entirely ($page->save()) I clean the cache for it. When only parts are saved ($page->save(field)) I don't. So I'd like to know: - Is there a way to save several fields (have a $fields array) or do I have to $page->save($field) for every single one? - is there a way to find out in the hook if a field was given or the entire page is to be saved? Also on another note, has anyone got any great tips on how to delete (expire) seleted files from the MarkupCache directory? I use remove() from cacheFile which uses directoryIterator. This takes a long time! Thanks, thomas
  10. Hello, I noticed that creating new pages and saving them is getting really really slow on my production server. One parent has 1500 pages and when I add another one, it can take up to a minute for it to be created. For a different parent with only 300 pages it's fast as usual. I am using a frontend where users can register and create new pages so making them wait for over a minute isn't quite ideal. It can't be my codes fault though because it takes just as long in the admin ... Thanks for any hints, thomas
  11. You are probably right Martijn. I now default to german, since that's where the company is based. English speaking customers can easily change the language, that shouldn't be too much to ask. Still impressed by the multi-language capabilities of PW! It's the first time I used the module. Thanks, thomas
  12. Hello Ryan, thanks for your answer. I completely changed the code and now it works. The idea was, to automatically send the user to the appropriate language but HTTP_ACCEPT_LANGUAGE didn't even work consistently in my two browsers.
  13. Hello, I built a bilingual site with a little language switcher in a module. problem is, it works *most of the time* ... and the solution was to add a simple message line in the module. Here's the code: $this->addHookBefore('Page::render', $this, 'changeLanguage'); public function changeLanguage (HookEvent $event) { $lang = wire('session')->language; if(!$lang) { if(strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'],'de')) $lang = 'de'; else $lang = "eng"; } $lang = wire('input')->get->lang?wire('input')->get->lang:$lang; if($lang != wire('session')->language) { $this->message(__('Sprache geändert zu')." ".$lang); # IMPORTANT!!! $l = ($lang == 'de') ? 'deutsch' : 'default'; wire('user')->language = wire('languages')->get($l); wire('user')->save('language'); wire('session')->language = $lang; wire('session')->redirect($event->object->url); } } if I leave the $this->message() bit out, i get everything from working, via "Trying to get property of a non-object in LanguageSupportFields line 131", to simply not working at all. Can anyone explain?? Thanks, thomas
  14. Hello, is there a way to sort pages by a computed value other than using raw MySQL? I have about 2000 pages which all have a "views" field. Now I'd like to sort them by "views per day", so calculate the age of the post in days and divide the views by the age. I thought about a LazyCron which computes this value every now and then and writes them into a field but this would mean the value is always outdated and I'm not sure how long the cron would take on a large number of pages ... Has anyone got any suggestions on how to do this? Thanks, thomas Solved. Sorry. Next time I think before I post I now update the "views per day" value every time the "views" value is updated. This is of course a bit inaccurate since the views might not get updated for a couple of days but I figured that's a small price to pay for not having a cron iterate over the pages every so often.
  15. Unfortunately no. I cleaned the image field before trying deleteAll()
  16. Hi Adrian, thanks for the tip but unfortunately it doesn't change anything. I ran $video->of(false); $video->teaserbild->deleteAll(); $video->save(); $video->teaserbild = 'http://new_image.jpg'; $video->save(); on a page with one image already uploaded and got this error: <b>Warning</b>: unlink(/www/htdocs/v133155/bigair2/site/assets/files/51666/img_20131001_110155.jpg) [<a href='function.unlink'>function.unlink</a>]: No such file or directory in <b>/www/htdocs/v133155/bigair2/wire/core/Pagefile.php</b> on line <b>304</b><br /> and the result remains the same: (with the second one being the new one and the first (upper) one being the one that supposedly couldn't be deleted ...) Any hints? Thanks, thomas
  17. Hello, I have an imagefield set to limit=1 and I try to replace this image via the API: $video->of(false); $video->teaserbild->removeAll(); $video->save(); $video->teaserbild = 'http://new_image.jpg'; $video->save(); The result in the admin is a broken image (missing file) as the first image (which was supposed to be removed) and the new one intact as second. I'm on PW 2.3.0. I've had this problem for a while and can't seem to solve it. Can someone help? Thanks, thomas
  18. I am used to simpy updating the /wire/ folder and maybe index.php so please excuse me, if I missed an update process here. I just tried 2.3.4 and got this: [Mon Sep 16 13:24:24 2013] [error] [client 127.0.0.1] PHP Fatal error: Uncaught exception 'PDOException' with message 'You cannot serialize or unserialize PDO instances' in [no active file]:0\nStack trace:\n#0 [internal function]: PDO->__sleep()\n#1 {main}\n thrown in [no active file] on line 0, referer: http://productspecial/ps-admin/ Thanks, thomas
  19. Hello Jasper, thanks for the answer. I'd like to build my own logging system so I can see exactly which messages a certain user gets. The errors and messages are already in place so I am looking for a way to hook my own logging system onto that. Any more ideas? Thanks, thomas
  20. Hello, I'd like to log all the messages and errors my site throws. Is there a way to hook into these methods? Thanks, thomas
  21. I haven't looked into translation at all so please excuse if this is obvious and/or stupid: Is there a way to translate the PW error messages for required fields? I use those for frontend editing on my website as well and it would be a nice touch to have them in german ... Danke! thomas
  22. thomas

    bigair.tv

    Hello jmart, thanks for the info. To be honest I wasn't too sure about the authorship, since very few of the people writing for the site or uploading videos are on G+. I'll probably try to include the info for those who are ... Thanks, thomas
  23. thomas

    bigair.tv

    Hi jmart, yeah I was focusing on microdata for the videos first because I was experimenting with G+ integration. I will include microdata on news and products as well (thanks for reminding me!) I'm glad you say it loads fast because that means my caching strategies seem to work!
  24. thomas

    bigair.tv

    The mobile menu (or sidebar on Desktop/wider displays) is really only useful when you're registered/logged in. It contains a category menu where you can enable and disable video categories, the search field and video channels. You are right, for the average visitor right now it's useless. That's one of the things we still need to think about ... Thanks, thomas Edit: I find it really hard to decide which features to offer to "everyone" and which are only for registered users ... One one hand we need to offer more for people that register, on the other hand I don't want the site to look empty or too simple for unregistered visitors .... decisions, decisions ...
  25. thomas

    bigair.tv

    Hello, we recently relaunched http://bigair.tv to the new Processwire version. The site used to be based on ViMP video CMS which itself is based on the Symphony framework. After almost two years of trying to make ViMP/Symphony work the way we needed it, I decided to rebuild the whole thing in PW. It was well worth it, even though it still contains a lot of bugs and a lot of features are still missing. With Symphony, I spend my time looking for files and classes, rebuilding classes, fighting my way through abstraction layers and trying to decipher Symphony Markup creation tags. With PW, my clients needs are easily implemented and I finally feel like I'm in charge of the site. The site offers user registration through Google and Facebook, video upload for registered users and video transcoding through Zencoder. It was remarkably easy to build in PW (even though I'll take a close look at Apeisa's "Fredi" to see if I can learn something about frontend editing) The main challenge was building an efficient caching mechanism for the video lists, which are customizable for registered users. I used MarkupCache for pretty much everything. So here is my second PW project and by far the biggest one I build so far. Thanks to PW, the community and Ryan for answering my (sometimes silly) questions! http://bigair.tv/ -thomas
×
×
  • Create New...