Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/30/2014 in all areas

  1. "A moment of sudden realization, inspiration, insight, recognition, or comprehension." (Merriam-Webster) (Nothing to do with these guys.) You are cordially invited to share your PW Aha! moments here. Hopefully others will benefit. For instance, the project I am currently working on includes a form to allow the entry of televised football fixtures (Time/Date, Home team, Away team). This is implemented as a PageTable and I needed to list any lines already existing and a blank line to allow the entry of a new fixture. foreach-ing through the existing fixtures is easy, but how to cleanly (in programming terms) add a blank line? $a->makeBlankItem()! $fixtures = $pages->find("template=fixture"); $emptyFixture = $fixtures->makeBlankItem(); $fixtures->append($emptyFixture); foreach($fixtures as $fixture){ ...do stuff.. }And that will include a blank fixture at the end. The ...do stuff... will very likely be form inputs. (I know a couple of lines could be chained (okay, 1-3), but it reads easier to me as it is.)
    8 points
  2. Hi there, Nick, and welcome to the forum! PW can handle this, but this isn't something any single module alone will do for you. It'll require custom code work, the amount of which depends a lot on how many users you'll have, whether you're prepared to create user accounts and connect them to editable pages manually or if you need to automate registration, how customised you want edit views for these clients to be etc. Below I'll try to describe three possible approaches you might use to make this work: 1. Keep client's user profiles (i.e. user accounts, which in ProcessWire are also pages) and publicly viewable product/info pages separated. Each user would have an account to your site but also separate, publicly viewable page he/she can edit. For this approach, I'd start with Page Edit Per User module, which allows you to define pages that specific user (one with no access to edit any pages by default) can edit: /clients/ # public part of your page /client-x/ /client-y/ /client-z/ # page for client z: publicly viewable info, products etc.; # after logging in, client z can edit this page /processwire/ # ProcessWire admin area /access/ /users/ /client-x/ /client-y/ /client-z/ # user account for client z: not publicly viewable; after # logging in, this client can edit page /clients/client-x/ 2. Add product information etc. custom fields directly to user's profile pages and then render those publicly. The problem with this approach is that all your users, including superusers, will have these custom fields, which might not make sense in your case (if you need other type of users later, it's going to be very confusing). Also, you'll still need public URLs for the profiles -- not much of a problem though, as you can always create a template that fetches user (like Pete descried in the thread linked to above), either based on a GET param or URL segment. If you go with this, be very strict with validation, i.e. before rendering user page make sure it's one that should be rendered, i.e. one of your clients and not, say, superuser account. 3. If you're confident in your skills with code, you could also create a Process module (a new view/tool for Admin area) that your clients use to handle their products. This would, essentially, be a custom-built CRUD tool for managing user-specific pages. This thread provides some useful pointers for this. Using this approach it would actually make sense to include basic info as custom fields on user profiles as explained above and creating separate pages only for products these clients sell (assuming that there's more than one product per each client). Hope I didn't confuse you too much with this -- please don't hesitate to post any questions this raises and/or you still have. Would be happy to clarify. I'd strongly suggest that you start building this thing and then ask once you face any specific issues.. the more you can limit the scope of your question, more likely you are to get a swift and precise answer
    8 points
  3. Hello, I created a simple REST helper in order to create REST APIs with Processwire, without depending on external routers Here you go!. https://gist.github.com/clsource/dc7be74afcbfc5fe752c
    6 points
  4. Thanks everyone, an image is still a hard won problem, especially when your not restricting the client in their uploads to much. Will look harder into this, but still loathed to use polyfills for images. I was thinking about writing a lengthy description / tutorial on this site, as there's loads in it after it's live. I'll endeavour to do so after your interest.
    5 points
  5. Something like this should work (assuming that the name of your comments field is 'comments'): $comment = new Comment; $comment->text = "my text"; $comment->cite = "my name"; // etc. $p = $pages->get('/about/'); $p->comments->add($comment); $p->save('comments');
    5 points
  6. Each landing page is effectively it's own mini-site. Not sure what else to say here -- they'll be considered separate, small sites by Google and other crawlers. They themselves probably won't rank extremely high (Google likes quality content that is updated often), unless they're targeting a niche keyword. I'm not really sure what you mean by this. Care to elaborate? Yes. This depends on how your menu has been setup. You'll have to skip those pages one way or another -- make them hidden or exclude the template they use in the code that builds your menu. You should enter all hostnames you're going to use, i.e. your main domain, all the domains used by the landing pages etc.
    4 points
  7. thanks Teppo, worked great after 1 amendment: on first attempt I got an error: "Error: Exception: Can't save field from page 1028: /blog/posts/test-post/: Call $page->setOutputFormatting(false) before getting/setting values that will be modified and saved." so, I did as the error suggested end ended up with: $comment = new Comment; $comment->text = "my text"; $comment->cite = "my name"; // etc. $p = $pages->get('/about/'); $p->setOutputFormatting(false); // added $p->comments->add($comment); $p->save('comments'); checking the PW cheatsheet for $page->setOutputFormatting() makes it clear why that's needed.
    4 points
  8. Hi sorry was busy. So the main idea is to give people the ability to say whats frustrating them, not only in the world but also localy. We have Categories like politics,sport etc. and town's (larger towns in Poland). User need to register to vote or to create new issue. On forum we can find some examples of user register forms. I used the one which creates user and page. This way i can easyly show users posts like this : http://hejtuje.com/members/vxda/ Also when user register there is confirmation email sent to user. If user will not confirm there is a lazycron module every couple of hours that deletes each user that didnt confirmed his email. There is also a way to register and login via facebook. For that i used apesia module : http://modules.processwire.com/modules/facebook-login/ . I changed it a bit so that when user registers with form, he can also login with facebook and it merges into one account. User can choose to stay lagged in, for that i used plugin made by craig-a-rodway http://modules.processwire.com/modules/login-persist/ User creates issue: basicly used guides from forum, its quite easy to allow members to create pages. I used adrian's module for grabbing thumbs from video's: http://modules.processwire.com/modules/process-get-video-thumbs/ For vote system i acculy asked my firend php programmer and he did that one for me. For comments we used disqus. Had some problems with SSO (single sign on) so here another friend helped me out. This way whenever user register/login it automaticly creates account on disqus and log user in (no need to register on site and disqus separately). To make it a bit more fiendly for user i also detect from which city user is visiting website, then im comparing result with cities i got on my website, if there is a match im showing the first issue from that city on home page. If not showing the first issue from capital. whats next ... humm there is quite alot of jquery and ajax. If u got any questions please ask il try to answer them best i can. Here are some topic's i made during development: https://processwire.com/talk/topic/6763-lazy-cron-problem/ https://processwire.com/talk/topic/6619-login-user-without-his-pass/ https://processwire.com/talk/topic/6562-sending-email-after-moving-page-from-one-parent-to-another/ Cheers
    3 points
  9. Well, I always use Cycle2 because it is very open configurable and nearly everything is possible. For your thumbnails for example look here: http://jquery.malsup.com/cycle2/demo/pager.php If you don't want to build your own full size background, just use this on top of cycle2: http://www.aaronvanderzwan.com/maximage/
    3 points
  10. The date field input format picker is a little confusing for me. The two examples are 08/04/2012 and 04/08/2012, but don't make it obvious which is the month and which is the day. Maybe use a date where it would be impossible to get it wrong? Like 14/08/2012. Just an idea
    3 points
  11. http://processwire.com/talk/topic/771-is-there-a-way-to-get-a-db-backup-from-within-pw/#entry6452 http://processwire.com/talk/topic/3052-open-dynamo-webspace-backup-tool/ https://processwire.com/talk/topic/771-is-there-a-way-to-get-a-db-backup-from-within-pw/ https://processwire.com/talk/topic/4653-how-to-make-backup-of-database/
    3 points
  12. Welcome to the forum! I've never done anything similar so I'm probably not the best to give advice. But in my understanding, if you will have to write custom code anyway, pw would be a perfect fit, at least as much as any other framework because it will give you all the flexibility while providing some great time savers. If you need something that pw doesn't have but you find on another framework or library you can always integrate it. We usually advice people to look for out-of-the-box solutions when they want to do this kind of large projects without wanting to write most of the code themselves but that doesn't seem to be your case. For what you wrote I suspect you will have fun with pw.
    3 points
  13. I have just put a long post up to answer some of his points - in a gentle way. At the end of the day, ProcessWire IS a system for website development - that is its strength and what makes it better for serious business websites than WordPress. In itself it is not, and probably should not be, a drumlapress clone. I would not want it to be as that is why I have moved away from those kinds of CMS. Of course, it is perfectly possible to build a Drumlapress type CMS using PW as the backend, and maybe that ought to be done, but that is a different thing and would be addressing a different market. The interesting point is, of course, that though PW is a development package, rather than an plug-and-play, instantly themable, push-button, solution, it is amazingly easy to learn! Even for complete non-developers. But you really have to want to. If you don't then probably PW is not for you.
    2 points
  14. +1! New descriptions and tutorials are always welcome!
    2 points
  15. +1 cstevensjr Thanks Steve and all others involved. I wish more of my work required spending time knee-deep in PW so I could spot stuff like this superb addition sooner so I could say "Thanks ^_^" in a more timely manner, so I might help occasionally and so I could more often use the awesome stuff produced by this fab community. tl;dr Thanks!
    2 points
  16. In our company site i'm using Hanna code all over the place for company phone and fax numbers and e-mail addresses. Its very easy to manage when a value needs to be changed. Change it once in the hanna code and ~voila~ its changed site wide Some examples usages in our site: (translated to english for these examples) [[phone nr="marketing"]] [[fax nr="sales"]] [[email address="subscriptions"]]
    2 points
  17. I have to show another ProcessWire while about 10 000 guest are entering the festival area. We've made this site exactly 125 days ago and while it's not our best page, it has some kind of interesting background story. URL: http://www.openbeatz.de/ This is a website for a german two-day electro festival. Some better-known DJs will be playing there and thousands of guest are expected (They hope to sell the ticket no 10000 this evening). The website features basic information pages, a DJ voting contest with FB integration and a overview of all ticket stores. It's build with ProcessWire 2.4 using FormBuilder and the AIOM module. How we got started Our existing client asked for a "small countdown page". They bought the "rights" of the festival and needed something quick to start the promotion. The problem? We didn't even had access to the domain but they printed the first batch of ads and flyers with the URL on it. The first mail came on Wednesday and the site should go online on friday. Don't we all love those kind of challenges... As expected, the site requirements started to grow. We didn't had time for proper project management or any kind of planing. The whole site was build quick and dirty in under a week. We hired another coder to help us. The site is far from perfect, we know. It's hard to get the best results without proper communication and the lack of time. Anyway, the site was online and features were added quickly. The festival last year had about 2000 attendees. We saw the line up after we build the site and that was the point we realized, that our client had something bigger in mind... The Domain The domain was already printed on thousands of flyers when we first heard of the project. At that time, the old agency deleted the domains without a notice to us. We could get the open-beatz.de one but a domain shark got the name without the - . This stuff can get really expensive so we had to negotiate withe the new, unwanted domain holder. After some mails we got down from 5000€ to a smaller three-digit price. Lesson learned (and paid). The DJ Voting DJs could apply with a sample soundcloud set. The DJ with the most Votes (in form of FB likes) will play at the festival. The whole contest was embedded within a facebook application tab. The page had 406 DJs listed with a sum of around 11k likes. A DJ was represented with a PW pages were we counted the likes on that URI using the FB API. The contest is now hidden but you can see an example page here: www.openbeatz.de/dj-contest/wildchild/ The TV ad and numbers You open Facebook and then you see the status "OpenBeatz TV ad in 5 minutes on RTL". Great, why did nobody tell us? The site was featured in multiple ads on the german RTL and RTL2 (larger) tv stations with the URL at the end. There were even ads at prime times like 19:00 and 20:00. Traffic peaked between 2000-4000 additional unique visitors after each clip. ProcessWire took it like a champ even without ProCache. For the stat nerds: 72% of those visitors in the time after the TV ads were on mobile. In total we had an average of 1700 unique visitors every day with a peak of 11k visitors. The site was also shared on the artists facebook pages which brought another 1000 visitors within a 30 minute time frame. What did we learn? Plan ahead and communication. Make double tripple sure that your client tells you all the details and the size of the project. We started to small. If there is no time don't rush. If I could travel back in time, I would just delay that stupid countdown page for a week and plan a better version of the PW site. Planning for the next OpenBeatz festival website will start in two weeks. Next time we will be prepared and launch a better site with lots of useful and cool features. Again, using ProcessWire Ideas are welcome. One more thing: The whole site isn't a site on its own. It's just part of the Rocking High website using the Multisite module. But I thought a new thread in the showroom was appropriate. Have a nice week end!
    2 points
  18. Hey Everyone! right I'm nearing the end of development on this photography agencies site and I was wondering if anyone could have a quick look for bugs etc. http://nicegrp.co.uk/dev/hs/ It's not quite finished so there may be obvious stuff, also there's ALOT, going on in the front end, for example: - pages are cached client side (to prevent unnecessary ajax requests for seen pages) - Ajax page requests & pushstate - pdf module for gallery pages - slideshow animations - add image to your custom gallery - alot of menu logic - responsive - lazy loading images on gallery pages Let me know what you think. Thanks
    1 point
  19. Ryan's Hanna Code module is a seriously useful bit of kit, not just for blog type systems where you want to insert a gallery or something clever, but for business websites where consistent branding and messaging is paramount. Lack of consistency can do a surprising amount of damage to a brand - if the way you refer to a company is inconsistent or unusual, for instance, you can confuse the visitor or split your messaging. Likewise, important messaging statements (keyword phrases in SEO), need to be kept consistent and current. It is all a bit obvious really, but it is amazing how easy it is to get wrong. And if phrases or contact info or even the company name changes, then trying to update the site with hundreds, perhaps thousands of pages could be a nightmare. Using the Hanna Code Module creatively, but very simply, can save you a lot of heartache and keep things on track. This is probably the simplest use of the module since all you doing is using it as a text replacement rather than for entering complex code. If you have created some sort of central settings page in your page tree that is for global values like Site Name, or main background image or whatever, consider adding a bunch of simple text fields for things like: Company Phone Number Company Name Company email address CEO's name Small company logo (that would be a single image field, of course) Company slogan Then, using the Hanna Code Module, set up hanna codes to retrieve this information. For instance, create a hanna code called "company" Set it for php, save and then under code, add the following: <?php echo $pages->get("/settings/")->company_name; Here I have assumed you have a hidden page as a child of your home page called "settings" and that the field for you company name is called company_name. Now, add the Hanna Code text formatter to every field that you may need to use it in. Within those fields, [[company]] will now be replaced with the company name. If the way the company name is written changes at any point, then it will be changed in all text. While you are about it, you can retrieve the same field without the hanna code module directly into templates where required. Now the company name throughout the entire site is consistent and is controlled by one simple field on a settings page. All you need do is take a very large rock to any authors who do not use it! Branding is important, more important than pretty pictures, clever JQuery, responsiveness and even SEO. Giving the client controls so that their carefully worked out brand values are not just used, but used consistently and without errors throughout their site, should be all part of the service, and Hanna Codes give you that. And for small clients who have not quite got their heads round the idea of building a brand, it may help them think about it more carefully.
    1 point
  20. This may not be the right forum for this... but I noticed that $fieldgroups are missing from the API cheatsheet. This is kind of important for developers since you can't create templates using the API without knowing about fieldgroups and how to use them.
    1 point
  21. Hi all, we lauched this big website for a festival last week, and pout a lot of work and love into this. Check out: boomfestival.org Hope you like it! and it has been received very well so far.. ( 60 000 visits in less then 1 week) It uses processwire as CMS , and I must say awesome decision to replace Wordpress we used the last editions, processwire is highly superior to wordpress as CMS . I even managed to import a lot of content from Wordpress with the Processwire bootstrap API and JSON and the help of this forum Content is loaded all with Ajax , and still backbutton does work and everything can be deeplinked . Ryan ProCache module has helped very much with Site speed and our high traffic server load If I find the time I might do a case study here...as this ajax approach moight be interesting for other developers
    1 point
  22. No one likes change or a honest appraisal. The big three (Wordpress, Joomla and Drupal) will not fair well against ProcessWire whenever a true comparison is done based on strictly technical requirements/capabilities for building actual websites, not blogs. We are all here because we have already dealt with those platforms, worked within their systems to improve their capabilities and unfortunately found them lacking for various reasons. Those platforms will improve over time, however so will ProcessWire. We need to just press ahead and keep doing what we are doing.
    1 point
  23. I know this has been asked a bunch of times in the forums and I've read many of the responses, but I'm asking again due to the complexity of my proposed project (and my own level of competence and general confusion!). I'd like to take this opportunity to explain a bit about what I'm trying to accomplish and see if you'd recommend processwire, a framework like django/laravel/yii2, or even a combination of both? I just spent the weekend exploring processwire after having put it off as a contender for my project probably a year ago. I was very impressed with what I was able to do this weekend. Long story short on the content/data relations part of my project I did more in a few hours from knowing nothing about pw than I was able to do in weeks of django (which is what I had planned to use initially). So, I have a somewhat complicated site that doesn't fit well into a particularly category (really it's 3 inter-related sites in one). Long story short, the site is yinyanghouse.com and it's a large Chinese Medicine community site with a store, some complicated data relationships and then community functions (forum, customized user roles/point system, etc.). The data has multiple m2m relationships and is somewhat complex. With a framework approach I would have to spend more time building join tables, etc. but might end up with better performance. So far it seems processwire will be great for this. I was a little concerned with scaling as the # of joins seems like it would be high with the table per field setup, but I've read the forum posts on that and feel good about it overall. The data section is probably ~800 pages or so highly intertwined pages and then some articles and other posts using some of the main categories that would be in the ~4000 page range and growing. The ecommerce part, I considered using foxycart and have that setup in my current demo. I'm ok with that, although I've also thought about pushing that off to a 3rd party. The problem is how related the content part of the site is with some aspects of the store. So it'd have to be a ecommerce app with an API if we go offsite. But for our purposes foxycart will probably be fine and that keeps the store product data integrated into the site as a whole. -- The one question/issue I have is that I'd really like to split the store off into a subdomain - store and from what I've read into multisites - there isn't a great option besides the services framework that exposes the site API to an "external" site. Many of my site connections could be written into the database (i.e. at save take the page connections referenced and write them as html into this field) - in other words they are not changed extremely often once setup. So using the external api approach to communicate between the two would be fine. Would this work for live relationships so to speak - in other words, in the template say show me site1->page->title where that page = this pages category - or would that be too slow or too cumbersome trying to hit multiple databases? Does that make sense? The biggest concern I have is for the community part. And my concern is the level of custom coding that this part would require and if this is better served by laravel or something along those lines instead of digging deeper into processwire. On my current site I've built many of these features inside of drupal which became hard to manage and made upgrades of core next to impossible - I'd like to avoid this situation in the future as much as possible. For this we need social logins (which it seems someone is close to doing this with hybridauth), a subscription membership (which we could do some sort of recurly/chargify integration - or straight stripe - but this is done in laravel and would have to built up in pw), we need custom user roles and permissions to submit certain types of products, need certain friend type connections mostly based around where the person trained, etc. Then we need a practitioner directory - google maps, global searching, and a print layout so use of country/state/province/city data. I'd also like to split the community functions off into a subdomain as well - so my question above about sharing data between with an "external" api and how to do that would come into play - also about sessions between the sites and pw sessions data (this is over my head) - basically sharing logins between sites. Long story short, the site will be pretty custom overall and nothing from my point of view is a perfect fit. What I'm concerned with is what I did to drupal - stretch a system beyond what it was intended and have a maintenance nightmare. Processwire is definitely more of a framework than drupal is in some regards, but a framework framework would have no assumptions which has benefits and costs. I don't see many social networking type sites that have been done in pw, nor heavier ecommerce sites, so I'm curious if I should try to go that route and what you think about splitting the site and sharing data with the services framework behind the scenes. Or what you would think about using pw for the content data and trying to build something entirely around it and integrating the user model between pw and what I would build in a framework. Hope this isn't too confusing (I know it is for me)... I've been very impressed reading the forums, so I trust peoples opinions on what might work. I'd appreciate any feedback you can offer about the project and if I go the pw route, I'm sure I'll have more questions. If you need any more details, please do not hesitate to ask. Cheers, -Chad.
    1 point
  24. 30 minutes with PW and he has an opinion!...Anyway, horses for courses
    1 point
  25. Take a look in the Troubleshooting Guide: http://processwire.com/docs/tutorials/troubleshooting-guide/page3
    1 point
  26. Download it from Github (for reference, you would need to change the branch to 'dev' before downloading)...but here you go https://github.com/ryancramerdesign/ProcessWire/archive/dev.zip
    1 point
  27. Looks like you're working from an Apache PHP MySQL stack on your computer. Make sure that you have mod_rewrite enabled. You may also need to set up virtual hosts, but check that mod_rewrite is enabled first
    1 point
  28. To answer my own question: I had to install the module first (stupid me had forgotten that). After that I could select it as a Process. Simple as that
    1 point
  29. Sounds like a missing . or a missing ( or ; or something. Looks like something went wrong with FTP-ing the data or there was already an index.php with this parse error. You should try to upload the files again.
    1 point
  30. This isn't exactly what I had in mind (thought you had those users already, just wanted to give them permission to edit a page), but there's an example of creating an user at the bottom of the $user page. If you just want to use Page Edit Per User and grant specific user access to a page via API, that looks more like this: // I'm assuming that you're already creating pages via API; not going into detail about that.. $p = new Page; $p->template = $templates->get("some-template"); $p->parent = $pages->get("/some-parent/"); $p->name = "some-page-name"; $p->save(); // give current current user access to edit previously created page $user->editable_pages->add($p); $user->save('editable_pages');
    1 point
  31. background slideshows? @Reems What 'other' problems did you encounter with the other scripts? Maybe better to state those here and get (hopefully) solutions rather than use a script that constrains you...
    1 point
  32. Thanks for pointing that out Joss. Skip it and move on to the next one without a folder based system from the nineties.
    1 point
  33. Loads of them listed on Google, search for JQuery Background Slide Show The main problem with using a folder based system is that you are completely stuck with it on the page you want - one version only. With any other system, you can create a different slideshow on every page if you want, or even several on each page, all easily customised from the back end.
    1 point
  34. You should use http://buildinternet.com/project/supersized/ or search for superbgimage and use that one. Highly customizable!
    1 point
  35. If you've already got a form that allows the user to create a page.. why not simply make the form add the user access to edit created page too? Unless that's possible, I'd suggest creating a new module based on Page Edit Per User; instead of current onMyBranch() method, simply check if given page was created by current user and based on that return true or false.
    1 point
  36. You can always make those images responsive. Thanks to Horst, PWs native images sizer provides images with much more quality than before. It's really easy to create responsive images with JS or even with the new SRCSET attribute for images or the <picture> element and respective polyfills http://scottjehl.github.io/picturefill/#examples It's great that you give the option to collapse the menu to show the images in bigger, but I think the wording could be better: I don't really want to "collapse the menu", what I really want is to see the content in bigger. What I mean is that the wording could be something like "enlarge content" and turning it into "show menu" as you already have there. I also think that this ability should only be present in the gallery pages as there's no point on seeing the blog or the copyright notice in larger. Just a suggestion
    1 point
  37. Indeed - it is a great site. very nicely built. Must agree with Philipp here. In fact, there are several images that are too large. Sure, they're not all 2.3MB, but they're a tad too big. May I suggest that you have a look at this article for more information on how to work around this: http://www.smashingmagazine.com/2014/02/03/one-solution-to-responsive-images/ The article makes reference to these as well: - http://www.smashingmagazine.com/2013/07/08/choosing-a-responsive-image-solution/ - http://adaptive-images.com/ (this looks quite promising) And perhaps a loading indicator? Changing the title to "Loading..." was not easily noticeable for me; perhaps some people have slow connections/latency may question if a page is even loading. Otherwise, I like it!
    1 point
  38. Looks and feels great. Immediately browsed through the galleries. Just the tennis background image on the Affiliates page ( http://nicegrp.co.uk/dev/hs/affiliates/ ) ist about 2.3MB. Took a while before it loaded and I'm not sture how mobile users like those large image files.
    1 point
  39. For anyone that has the map hidden initially before being opened resulting in bad rendering of the map. I tried the following that was mentioned here on this post but with no success. After a while(2 hours ) scratching my head I changed it to the following: setTimeout(function() { google.maps.event.trigger($("#mgmap1")[0], 'resize'); mgmap1.map.setCenter(mgmap1.options.center); }, 250); Now works perfectly.
    1 point
  40. Very good points, Joss. One of the arms of the company I work for sells advertising, in just 3 standard sizes, each size having a price, and I did the same as you mention above with those sizes & prices, so each mention across the site can be updated in one place. Bonus Suggestion - (along similar lines) One thing I have been doing recently is, in /site/config.php, declare $config->siteName = 'Your Site Name Here'; and then I can use that variable anywhere in the site (navbar brand, meta title etc.etc.). Save typing and ensures consistency. (And makes standard boilerplate site profiles easier.)
    1 point
  41. I have made some nice progress: DeliveryPost done, which asks post address + email.These DeliveryModules pretty much control the whole checkout process (and also adds some admin actions). This is the part of the shop that I guess will be most often customized. It also keeps things simple, when your needs are simple. module that hooks into DeliveryPost and adds shipping options order events (or order history - what has happened and when) Oh, and the module has a name: PadLoper (named after cute turtle species) Here are few teasers:
    1 point
  42. @horst, so how is things working . I was forced to fix with a different fix again . It was in `DatabaseQuery` execute method. public function execute() { try { $database = $this->wire('database'); $query = $database->prepare($this->getQuery()); $query->execute(); } catch (Exception $e) { $msg = $e->getMessage(); if (strstr($msg, 'MySQL server has gone away')) { $database->closePdo(); } throw new Exception($e->getMessage()); } return $query; } and in the `WireDatabasePdo` adding a new method public function closePdo() { $this->pdo = null; } Hope this fix will help everyone . One still problem is one query can be missed which got the failure. To execute that I think it is good to call `execute()` again with some flag set. Your thoughts ?
    1 point
  43. I'm doing this now. I have 10-12 partners who are businesses and freelancers. We are all on each-other's websites and white label our services so the client is billed under one business. It's a very scalable way to do business. Not only can you get prices down for your client, but you can grow your business on a moments notice to support larger clients/jobs. The key is finding reliable, honest people who can trust implicitly. They also need to share your values, because they are representing you and/or your business. In terms of pricing, we generally offer each other wholesale pricing (50% discount) for hourly work. Sometimes the project is managed by the professional who's providing the work and we don't deal directly with each-other's clients. Other times we deal directly with the client, which sometimes mean extra overhead and an increase in hourly rate. Generally I try to pay as much as I can, so I like to also do percentages on higher profit jobs. For example, if it only costs $500 dollars to pay someone hourly to complete a project, but I'm billing the client $10,000, then I would offer a percentage of the contract price based on the amount of value or time the partner is providing. In this case (using the example above) half of the contract price would go to biz expenses and labor, 30% to marketing, and 20% or $2,000 would go to the partner for their labor. The percentage I offer depends on the project and the health of my business. I also like the percentage pricing, because it's generally what I can afford, while also being the highest amount I can pay my partners. When business is good, I can offer more, when it's not good, I have to spend more on marketing so my offer is less. I go down my list of contacts, starting with the best match, until I find someone who's interested in the work at the price I can afford. Send me your website or work samples. If I can utilize your talents I'll start offering you work. -steve.
    1 point
  44. I finally found time to try out this module. Congrats to all for the dedication, collaboration and hard work in creating this needed tool. A very useful module.
    1 point
  45. Feasibly it's possible, but it's not desirable. Making wire('var') aware of context involves pre-compiling the template files to replace wire('var') with wire($this, 'var'). So it's something we do to provide backwards compatibility in template files. We won't be providing that backwards compatibility outside of template files, so people will have to use $this->var, $this->wire('var') or wire($this, 'var'); elsewhere. Also, a Static::syntax implies dealing with a framework that only has one context, which gives the appearance of a weakness that isn't there, something I think we'd want to avoid. While I'd really like to limit statics in ProcessWire as much as possible (just because they are more than often a bad programming practice), that syntax is perfectly fine for static functions where context doesn't matter or where you are passing the context into it. For example, $sanitizer functions would not need to have different behavior in different contexts. I've even seen some frameworks that do use statics for sanitization functions as well. In the end though, IMO they would still be better served by providing the same functions non-statically. The plan is that when you do this... $main = new ProcessWire('/site/'); $intranet = new ProcessWire('/site-intranet/'); ...everything in each of those two instances will be unique to those instances and whatever site files are stored in /site/ or /site-intranet/. That means that when a module is initialized, it is only initialized for the instance (whether main or intranet). When a module refers to $this->var, it's referring to API variables that are part of its instance only. This enables you to have multiple sites talking to each other. Currently this isn't possible precisely because PW uses statics for API variables behind the scenes. But the fact that we've kept that behind the scenes is a good thing because that means it doesn't matter how our API variables are stored. We can switch them to a stronger storage mechanism that would be tied to an instance. This is one reason why I deprecated the Wire::getFuel() syntax (that appeared in early versions of PW2) early-on... though you might still see it appear in a few core spots, which will need to be changed. But we've really tried to keep the public API clear of static calls so that the API would not have to change as PW continues to grow as a framework.
    1 point
  46. Okay, so here's what I came up with: Goal: Make a branch of pages in the Home tree completely hidden from a "client" role, say of Menus or Sidebars, but that is visible from a tab in the admin's primary menu so that the client is just dealing with pages in the "Home" tree. The end result being just "Pages," "Menus," and "Sidebars" in the primary admin menu. Steps: 1) I make a template called "node" for any parent page that starts a branch of pages that shouldn't be viewable in the Home tree to the client role. This isn't necessary but I feel like it's helpful because now these pages don't resemble the regular page template if the user somehow stumbles upon them. 2) I make a page called "Menus" and assign it the "node" template in the Home tree. All my custom menus are children of this page. 3) I make a page called "Menus" as a child of the hidden Admin page in the Home tree. This causes PW to make a tab with the message about not having a process assigned to it. 4) I make a module that assigns a process to the new template: (http://processwire.com/talk/topic/1272-new-page-nav-in-admin/): class UtilityMenuList extends Process { public static function getModuleInfo() { return array( 'title' => 'Custom Menu List', 'summary' => 'List all custom menus.', 'version' => 100, 'permission' => 'page-edit' ); } public function execute(){ $pl = $this->modules->get("ProcessPageList"); $pl->set('id',1057); // or any other parent page return $pl->execute(); } } Here we set the ID to the "Menus" page from step 2. This is the branch of pages we want to appear on the Menus tab. 5) We go back to the Menus admin page from step 4 and choose UtilityMenuList from the Process field. This makes PW show a Home tree that only includes the Menus branch. 6) Now we want to exclude the Menus branch from being visible on the Home tree, since that should only show "regular" Pages. I followed Soma's tutorial here for extracting branches from the JSON, since it's not apparent how to hook into ProcessPageList according to this thread: http://processwire.com/talk/topic/1272-new-page-nav-in-admin/. We create another module: <?php /** * Utility Hide Nodes * * Hides pages with a node template from display in the admin. * * ProcessWire 2.x * Copyright © 2010 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://www.processwire.com * http://www.ryancramer.com * */ class UtilityHideNodes extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Hide Node Pages', 'version' => 100, 'summary' => 'Example module to hide page in the admin per user per page. Add a page field "pagelist_hidden" with a PageListSelectMultiple input type to the user template. Select or add pages you want to hide in the admin.', 'href' => '', 'singular' => true, 'autoload' => true ); } public function init() { // only add hook only if the render parameter is set // (as used by ProcessPageList) if(!isset($_GET['render'])) return; $user = $this->user; $roles = $user->roles; // loop thru each role foreach($roles as $role) { if (!$role->pagelist_hidden) return; } $this->addHookAfter('ProcessPageList::execute', $this, 'pageListHiddenPages'); } public function pageListHiddenPages(HookEvent $event){ $user = $this->user; $roles = $user->roles; foreach($roles as $role) { foreach($role->pagelist_hidden as $hidden_page) { $hidden[] = $hidden_page->id; } } // make sure it's an ajax request if($this->config->ajax){ // manipulate the json returned and remove any pages found from array $json = json_decode($event->return, true); foreach($json['children'] as $key => $child){ if(in_array($child['id'],$hidden)) unset($json['children'][$key]); } $json['children'] = array_values($json['children']); $event->return = json_encode($json); } } } 7) I altered Soma's code to make it work with roles. We go to the Role template instead of User and add a new field called "pagelist_hidden" of the type Pages, with the following settings: Details = Multiple Pages (PageArray) and InputFieldType = PageListSelectMultiple. This will let us choose specific pages to make hidden from the Home tree on a role-by-role basis. 8) In my case I have a "client" role, so I assign this field to the Role template and then pick my Menus branch on the "client" role. 9) If I log in as the client role, the Menus branch doesn't appear at all in the Home tree, but I can still see it in the branch that gets outputted under my new Menu tab. So as a result we can add as many tabs as we need (potentially to create the illusion of more content types beyond pages) and hide as many branches thru the admin interface by simply adding them to the client's user role. The Menus parent page still appears on this tab, which is unfortunate but not so bad. If this were a Blog section, it would still make sense visually. I just set the parent to be uneditable, that way the client can't mess with it, but the children are still editable. Next step would be... can we somehow paginate a branch? Anyhoo it's pretty neat so far. Edit: Altered Soma's code to work with roles & not individual users.
    1 point
  47. Our clients have reported identical problems a few times. After clearing browser history things have returned to normal. This is probably unrelated, just wanted to point out that the issue may not be site-related at all..
    1 point
  48. Unless you had previously modified this, I doubt that's it. The default setting of 86400 is 1 day, and that's not going to cause you to get logged out every 30 seconds or 3 minutes, etc. I am wondering more about the gc_divisor and gc_probability settings that WillyC posted about, as that has more potential to answer the apparent randomness and short active sessions that you've described.
    1 point
  49. You can always reset your password just by pasting this temporarily into any one of your templates, and then viewing a page that uses the template: $u = $users->get('admin'); // or whatever your username is $u->of(false); $u->pass = 'your-new-password'; $u->save();
    1 point
  50. Maruchan, these are all good suggestions. Also look at the ProcessExportProfile module which includes a PHP native database export function. Perhaps I should repurpose it to module just for doing DB backups.
    1 point
×
×
  • Create New...