Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/08/2014 in all areas

  1. I don't think that works. You can use any selector though so this should work: if ($page->parents->has("name=by-usage")) { This is also fine: if ($page->find("name=by-usage")->count()) {
    6 points
  2. Ralf needed a parental Pedigree and I helped him to setup a very basic site. I quite liked the building of it and it resulted in doing 'to much' just for fun. I Asked Ralf if I could make it to a site profile so that someone else could profit from it to. Horse template Family Tab (Horse template) Pedigree (d3js) Unfinished Horse ( Horses created by Pagefield, but not yet edited ) Menu building /processwire Menu front-end / Download The Profile: pedigree_profile.zip
    6 points
  3. Hi all, Thank you all for the feedback. To refresh, I am doing a backend for a shop owner. My challenge was to display a page with ordered articles, each one of these being a repeater item (I am sticking with the "good old" reppies for now because I also need to store the quantity of ordered items somewhere). Ideally, the shop owner should see a table of ordered items, not the combersome list of repeaters. At first I went down the wrong way trying to modify the way repeaters are rendered. However, some tips (thanks kongondo!) gave me a different idea of how to display repeaters (and actually any other field) in the backend the way I want. So here's a quick update: I switched from messing with repeater formatting/output to writing a custom module. The module uses the standard ProcessPageEdit except that I construct the form manually ($field->getInputfield($page) + InputfieldMarkup). There's a hook after buildForm() which makes ProcessPageEdit display my form rather than the default one. Now I have a custom InputfieldForm combined with hooks, which allows making use of ProcessPageEdit with no modifications. I've never been happier. Oh, and a couple of screenshots to go with the post. One shows how my backend page looked with repeaters, and the other one shows a leaner, present-state page made with the approach described above.
    5 points
  4. Hey, I notice you are using the "edit_content" permission for profile update. I have to ask: why? If the user is logged in, they can update their own profile just fine. Maybe you plan permissions for editing content? Cannot say for sure. This check would be enough: if ($user->isLoggedIn() && $user->name == $input->urlSegment1) // now you may update you profile, Mr. User Don't forget to sanitize urlSegments, too. You can never be too paranoid with user input. Don't be politically correct with external data. On a side note, You might want to keep an eye on a similar topic.
    4 points
  5. TextformatterThinspace is a trivial text formatter that removes repeated spaces (either ascii or non-breaking) and repeated newlines, replacing them with just a single instance.
    3 points
  6. kongondo, thank you, man! It worked like a charm! Wow, another great advance in my project. Can't thank you enough! And it was not too much of a puzzle, as it seems to me now One small note for those who would like to use this trick in a ProcessPageEdit-based module: if you construct your own form for ProcessPageEdit, then put the rendered ProcessPageList in an InputfieldMarkup (and append it to an InputfieldWrapper field if you want to): $form = $this->modules->get('InputfieldForm'); // prep the form $wrapper = new InputfieldWrapper; // a wrapper $wrapper->attr('value', 'List of available articles'); $p = $this->modules->get('ProcessPageList'); // kongondo's code goes here $p->set('id', 9999); // setting the parent page $pageTree = new InputfieldMarkup; // the placeholder $pageTree->value = $p->execute(); // fill the InputfieldMarkup form field... $wrapper->add($pageTree); // put inside the wrapper... $form->append($wrapper); // append the wrapper Because Process<something> modules do not append directly to forms, you know
    3 points
  7. I have just updated this module with better support for video links that have a start time and other additional parameters in the url. It also now supports embed links and other variations. Please let me know if you find any issues with this new version.
    2 points
  8. Sorry, my bad. I misunderstood...Try this instead,, $p = $this->modules->get('ProcessPageList'); $p->set('id',2480); // the parent page return $p->execute();
    2 points
  9. Let me go into detail here a bit. When a user logs in, a session starts. The user's browser gets assigned an id. You can see it in the `wire_challenge` cookie. This long string of numbers and characters is the link between the user's browser and the server's session. PW checks these IDs every time to be sure you are still logged in and you are still the user you are. Suppose this IDs generation mechanism is exploitable to an attacker. Now they can craft an ID for any user currently logged in. Still with me? The trick here is that PW is good at making strong session IDs. You cannot simply "craft" the right session ID. So, to alter someone else's profile, the following must hold: - the targeted user must be logged in; - the attacker must have their session ID. I can see XSS as the only way to steal someone's cookie. So it's your job to validate user input and watch for XSS hacks--not only in your PW forms but on the whole site in general.
    2 points
  10. After some fast and hard digging found this: http://searchenginewatch.com/article/2067357/Bye-bye-Crawler-Blocking-the-Parasites
    2 points
  11. This might help https://support.krystal.co.uk/entries/24933152-How-to-block-bad-spiders-from-wasting-bandwidth- Also if your client is going via Cloudflare, you can block bots there before they get anywhere near the server.
    2 points
  12. Thanks for the replies. I decided to purchase the Form Builder. I'm not sure if I'll use it anytime soon, but I feel it's important to put a bit of money back into PW if we can manage it. I think I'll have a look into creating a few functions soon to tidy up my code a bit. I've just spent the last few days reformatting my initial sloppy code. But I'm still loving it. This is the longest time I've spent doing any kind of programming since Amiga E on the er, Amiga.
    2 points
  13. Why not? Almost everything in ProcessWire is a page, so this would be a good way to go. Especially if the profile information will contain more details/fields than a plain user template. I might approach it like this: Create at least two templates - member and company. Create and add your user detail fields to these templates as appropriate. Create a Page reference field with a name like owner. This should be configured to reference template=user at the very least. This is the way user detail pages would be linked to actual user accounts. When a user registers, you would create a new page with the template as either member or company. Like this: $profile = new Page(); $profile->of(false); $profile->template = 'company'; $profile->title = 'Acme Widgets'; // but most likely from sanitised POST data $profile->owner = wire('user'); // this links the new page to the logged in user $profile->save(); You can find the user profile info like this: $profile = wire('pages')->get("template=member|company, owner=$user"); I think this method has a few benefits: You don't need to modify the core user template. One user account could potentially manage multiple profiles if you wanted this to be the case in the future. A profile owner could be easily changed to someone else if necessary. Profile types can be easily changed later. Profile type can be identified by its template which should make it easier to differentiate when viewing or searching. The code examples above haven't been tested, and are just an example of how it could be used You could even mix this in with diogo's suggestion - still have a template and page with URL segments, but using different templates for the profile information.
    2 points
  14. Create custom admin pages easily without having to build a Process Module especially for that. ☞ This module makes it easy to create simple admin pages but you can also create them in much more powerfull way without the need of a module. Have a look at this post written by Bernhard Baumrock to know how it's done https://processwire.com/blog/posts/building-custom-admin-pages-with-process-modules/ ------- I just updated the module, I kind of merged the two versions and now it works with both stable and dev versions of PW. Only difference is that with the stable version you still need to create the child pages and with dev version that is not needed. The instructions are on Github. Enjoy ---- Download or clone from Github https://github.com/ocorreiododiogo/pw-admin-custom-pages Module page is here http://modules.processwire.com/modules/process-admin-custom-pages/
    1 point
  15. I am sure some of you must have noticed my stumbling around in the dark while getting used to the ProcessWire system. Someday I hope to emerge as a user who brings more to the table than just silly newbie questions. I am sitting down with a mug of really good coffee so I thought I would offer my feelings and reactions to ProcessWire thus far… Quick background: I am a photographer with a long history in photojournalism and commercial work. I have also enjoyed doing web work for years. I built quite a few static sites before searching for a CMS system that felt like home. I must have tested about a dozen or so before spending some real time with Wordpress and then MODx. I liked Wordpress but the template system was awkward for me to me customize. I then found MODx Evo. I stuck with Evo for years and found it very designer friendly. I am not a code developer at all but Evo allowed me the flexibility to design static test pages using clean HTML and then create my Evo template from that foundation. MODx uses a system of combining placeholder code using Chunks, programmed Snippets and Template Variables (TVs) for dynamic forks in the road. Forgive me: I have never been well versed in web tech jargon. One of the features (or liabilities) with MODx is that it uses its own template language. When you deploy a Snippet you need a Snippet “Call” to set parameters on how the Snippet will function. Usually you would need a special template for the Snippet as well. This process is not totally intuitive and has its own learning curve. Then along came the entirely new branch of MODx called Revolution, or Revo for short. Revo was more powerful but also more complex. The nice thing with Revo is that you could spend more time away from the root folder or using an FTP client to upload and install Snippets. The Package Management system is a powerful means of installing and updating the various Snippets and plugins. Updating these building blocks in Evo is more of a pain; manual copy and paste effort required. What I did not like with Revo is that much of the placeholder and template syntax changed from Evo. The changes were subtle but deadly if you confused the two. The main issue I have with Revo is how slow the Manager (admin) system is. The amount of stuff (very techie term here) in Revo is overwhelming. Some of my clients who used the Revo Manager sporadically would always forget how to do things. To be honest I would have the same issue on occasion. With MODx we had Evo, then Revo, then the whole cloud system and now MODx III. It sort of gets confusing. To counter this the forum now has a zillion sections that cater to all the MODx project branches. But I find doing a search on my issues or questions revealed some confusing links to information that focuses on a different branch or is outdated to the system I am working with. I guess this last year was a difficult year for MODx: growing pains and money, etc. The whole technology of Revo, the Cloud and the loss of some of its main core programmers (Shaun McCormick) has created some signal-to-noise-ratio issues. Last year was a terrible year for me personally as well. The joy of buying a new project house was crushed by the death of my father and my only sibling (in South Africa) in the space of just four months. Coming out of this fog I sought of stumbled on some interesting chatter about MODx users switching to ProcessWire. The rest of this quick moving journey has been interesting to say the least. My reaction to PW has been filled with both initial confusion and admiration. I thought my not knowing any PhP was going to be a deal breaker. I sort of had initial writer’s block with the blank page. The PW installation would go well, but then what? But after playing around with several local test installs I can see how liberating and powerful the PW API, the template system and Fields really are. I am slowly picking up some basic use of PhP statements. Doing so is more valuable and efficient than the MODx learning curve with it’s proprietary template syntax. I suspect my working knowledge of the PhP that will make using PW easier will only grow with time. That is my hope for sure. The thing I like about the PW Admin is the speed and the whole weight of the backend. Compare the jQuery Admin to the heavy, heavy MODx Revo Manager and there is no contest. It works better on the iPad as well. My clients have commented on how much “stuff” there is in the Revo Manager. I can’t wait to show them how fast and simple the PW Admin is by comparison. One of my issues is letting MODx go. The community has been great. I cant tell you all how much I admire and appreciate folks like Susan Ottwell, Bob Ray, Jay Gilmore and countless others. Susan has over 20,000 posts on the MODx forum. Just about all of them are consistently helpful and insightful. Being a heavy forum contributor can lead to one’s becoming impatient and suffering from burnout, but Susan’s helpful attitude has been amazing. But my heart tells me that I am better suited to learning ProcessWire rather than the awkward mix of MODx Evo and Revo that I have been using to this point. I think I am also trying to duplicate some MODx procedures when I work with my PW test projects. I think that time will be on my side as I become more comfortable doing things the “ProcessWire way”. Anyway, I am not sure where I am going with this, I just wanted to offer my $.02 and to say how grateful I am with all of you who have shown patience with my initial learning. Cheers, Max
    1 point
  16. We just launched a new PW 2.4 site: mbci.mb.ca, this is another responsive (bootstrap) site built using my module Spex. The homepage is one of our first attempts at what we internally call "long scrollies", we used the jquery plugin waypoints to accomplish the effect that can be seen there. Using waypoints has really opened up a new realm of possibilities, especially when combined with stellar.js to create parallax effects. Other than the long scrolly homepage, in terms of neat features there's a filterable ajax calendar page using the fullcalendar library: http://mbci.mb.ca/events/ There's also a matching Magento for taking applications to the school where we used an extension called Dynamic Product Options from the unfortunately named company Itoris, that was pretty neat.
    1 point
  17. Very nice work. I've been actively following this post. The amount of help provided on this forum is outstanding.
    1 point
  18. Sometimes I look at a problem and get consumed with a particular way of trying to solve the issue. I had to step back and rethink about how I was going to solve the issue of the "Priority" field not displaying as I wanted. When I rested, I actually thought "Hey, you already know what the answer is, why not work from that position? Problem I have a Priority field within a note form where the choices are "Not Applicable", "Urgent", "Important", "Routine" or "Low". I chose to use the Page relation field. The only problem I ended having is that I was dealing with a repeater to create the notes within the page. Not normally a bad problem, but I couldn't get the singular page reference field to display it's content. Solution Since I already know what I wanted to display, I worked out a way to make it happen. I modified the repeater_sd_note.php file to accomplish this. The contents of the updated file is shown below. <?php echo "<h4>$page->title</h4>"; echo "<p><strong>Date:</strong> $page->sd_date</p>"; echo "<p><strong>Note:</strong> $page->sd_body</p>"; echo "<strong>Type:</strong>"; foreach($page->sd_type as $type){ echo " | $type->title"; } echo "</p>"; echo "<strong>Priority:</strong>"; $priority = $page->sd_priority; $p = "1098"; if ( strcmp ( $priority, $p) == 0 ){ echo " | Not Applicable |"; } $q = "1099"; if ( strcmp ( $priority, $q) == 0 ){ echo " | Urgent |"; } $r = "1100"; if ( strcmp ( $priority, $r) == 0 ){ echo " | Important |"; } $s = "1101"; if ( strcmp ( $priority, $s) == 0 ){ echo " | Routine |"; } $t = "1102"; if ( strcmp ( $priority, $t) == 0 ){ echo " | Low |"; } echo "</p>"; echo "<strong>Status:</strong>"; foreach($page->sd_status as $status){ echo " | $status->title"; } echo "</p>"; echo "<p><strong>Attached Documents:</strong> [ $page->sd_documents ] </p>"; ?> I'm no coding wizard, however I knew if I could compare the known page IDs of the choices to value of the sd_priority variable I could do the rest easily. It took awhile but I eventually thought about doing a string compare, which gave me logic needed to display the data on the website. It's not elegant, but it works! Thanks once again to Soma for setting me straight on the foreach on the array. I'm still learning after all these years. Thanks also to Valery for getting my mind working by providing me with a detailed start and tutorial on creating custom modules. Good Day.
    1 point
  19. Yes...use what is best for the job. $sanitizer->name is best for ProcessWire 'name' - Name is used to build the URL hence its formatting (of course you can use it if you require such formatting...) but in your case, text should be fine...
    1 point
  20. Thanks renobird and diogo. That worked a treat! I spent far too long on that
    1 point
  21. Thanks Alan! I corrected the mistake. Apparently the awesome guy doesn't know his own URL
    1 point
  22. FYI diogo, not important, I just spotted a typo in the info on the Modules page, where you link to Nico you've got https and Chrome gets all sulky and jaundiced as the site is http. See, I have my uses—I may be too thick to produce a Module but show me a spelling mistake and I'm ALL over it.
    1 point
  23. opalepatrick, $page->parents returns a pageArray, so you need to check for the id instead of the name. Me thinks. [deleted code] Scratch that, there is some fancier stuff that goes here there than I remembered. has() needs a page object. $parentPage = $pages->get("/path/to/parent/"); if ($page->parents->has($parentPage)){
    1 point
  24. Thank you both, I've updated the module page - the download link should now work.
    1 point
  25. I had that 404 issue with the last module I submitted. Not sure why the "master" is missing from the filename. Don't know whether github changed something that is messing with Ryan's code for getting the name or what. It's obviously an easy edit, but maybe something we should bring to Ryan's attention.
    1 point
  26. @alanfluff, It is primarily for tidying up sloppy spacebar work. CKEditor turns n spaces into a space followed by n-1 non-breaking spaces - which I hope this module takes care of cleaning up .
    1 point
  27. Steve, if this is something that tidies up extra fluff added to textareas by the otherwise lovely CKEditor then fab! (And thanks if that's what it is or not ) PS: Also the coolest Module name yet.
    1 point
  28. I think something like this would work in your .htaccess: Order Allow,Deny Deny from 180.76.5.0/24 180.76.6.0/24 Allow from all
    1 point
  29. Those fields are page fields with multiple pages you select. Thus the field returns a PageArray. So you simply foreach through them and echo out something from those selected pages. $page->sd_status <- PageArray! foreach($page->sd_status as $status){ echo $status->title; }
    1 point
  30. I would try the Login History module, which you can configure to track the IP address. Google Analytics or Piwik would be your other choices, for more fine-grained tracking.
    1 point
  31. Thank you for your response, however that was one of the first things I tried. That normally is what is required with page IDs. I'm sorry if I didn't state I had already tried the obvious syntax (i.e title, name, description).
    1 point
  32. It's not often I'm impressed, so I only feel that it's right to express my appreciation to those behind the development of PW. I've only been using PW since March this year, but it's been a joy to work with. I knew nothing about PHP beforehand, and now I'm able to achieve my goals without too much stress thanks to the excellent PW API. For my current project, I'm jumping in at the deep end by creating an online community where my members will have a basic forum, comments system, gallery, private messages etc. At first I thought this would be an impossible task, but my custom comments system seems to be coming along nicely, all without any stressful programming. I'm fairly sure I'm doing a few things wrong, and I'm sure there are more efficient ways to deal with my problems, but that's what I love about PW, we can do it our way. For my comments system (which I've started from scratch as a learning exercise) I simply wrote some template code to check for a sub-page called "comments" under the current page, article etc. If it's not there, it will be created when a comment is posted. This comment would then appear as a new page under the comments page, as would all the other comments. I'm not sure if this is a good way to go about it, but it works, and I can keep developing it to allow comment editing, quoting etc. Anyway, thanks again. I look forward to see what the future holds for PW, but as it currently stands, it's exceptional.
    1 point
  33. A simple way is to use a "members" page with url segments. This page would be a normal page on the frontend, but would accept segments with the user names www.example.com/members/username. In your template you would do something like this: $username = $sanitizer->name($input->urlSegment1); // make sure the user input can be a page name $userPage = $pages->get("template=user, name={$username}"); // get the user with this name if(!$userPage->id) throw new Wire404Exception(); // if this user doesn't exist show the 404 page echo "<p>the name of this user is {$userPage->title}</p>";
    1 point
  34. If you like, please check out one of our latest projects - A tiny website to a local veterinarian. As usual beautifully powered by the stunning Processwire: http://www.tierarzt-partale.de Thank you so much for all your efforts and support.
    1 point
  35. PhotoWebMax, I think your post is very perceptive. ProcessWire appeals very much to people who are both designers and developers. It also works well for teams who divide up those responsibilities. However, it doesn't make any attempt to do development for you (like Joomla or WordPress might, for example). Having said that, what it does do is reduce the learning curve on the development side as much as is possible without sacrificing capabilities or imposing limitations on what can be done with it. I started ProcessWire as a designer too, so you're in good company. Most of my sites were not built on CMSs because I could never get the big ones (Joomla, Drupal, or WordPress) to do what I wanted, or to do it in a way that would be intuitive for my clients to manage. Anyway, the only php experience I had was using includes in my regular html sites (and whatever I could remember from the one or two non-php-based programming classes I had taken). What really drew me to PW was that I could continue making sites exactly the way that I always had-- writing all my own html, css, and choosing when and where to break up my code into external includes. And I didn't even have to learn a new syntax for that, since it was all php-based. From there, it was just a matter of learning how to grab the data from the CMS that I needed to be dynamic and putting it into my template files with the API. Going through this process opened me up to the world of development. I won't say that it was easy (or that I don't still have a lot to learn), but for me PW made programming fun and intuitive, and actually seem attainable for a design-minded person like me. And by spending time on these forums and asking a lot of questions, I was able to get up and running with the basics right away and then learn the more complex stuff from there. Now that you've described what you're trying to do with having galleries as a part of multiple templates, I do believe you have a good approach for your use case. Please don't get hung up on my way of doing things. Do what makes sense to you and will be easy for you to manage. If that means loading the scripts on all pages and sacrificing a tiny bit of page load speed, then do that. Heck, if repeating the code in every template file and not using includes at all makes it easier and gives you the more granular level of control that you need, then do that. I only looked at MODx briefly before I found PW, so I can't speak to the similarities and differences. But I will say that once I finally found PW I haven't looked back
    1 point
  36. Is this a product list on page by page basis? If not, if it is site-wide, why no create a simple ProcessModule? On the other thread you talked about locking the Events fields...do you want your product listing to be read only?
    1 point
  37. Hi, Does this answer on stackoverflow solve your issue? I guess it should: http://stackoverflow.com/questions/18677244/error-invalid-client-no-application-name Cheers
    1 point
×
×
  • Create New...