Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/22/2014 in all areas

  1. Hey guys, first, ProcessWire is a great piece of software. Thanks for that and the great community behind that. So, i'm realy new to ProcessWire, but i will present you my first module for SEO- and performance optimizing: AIOM+ (All In One Minify). AIOM+ (All In One Minify) for CSS, LESS, JS and HTML AIOM+ (All In One Minify) is a module to easily improve the performance of your website. By a simple function call Stylesheets, LESS and Javascript files can be parsed, minimized and combined into one single file. This reduces the server requests, loading time and minimizes the traffic. In addition, the generated HTML source code can be minimized and all generated files can be loaded over a cookieless domain (domain sharding). Install AIOM+ Download current release (link below) Extract and copy the files for this module to /site/modules/AllInOneMinify/ Login to PW backend and go to Modules > Check for new modules Install Module > AIOM+ (All In One Minify) for CSS, LESS, JS and HTML Alternative in ProcessWire 2.4 Login to PW backend and go to Modules Click tab "new" and enter Module Class Name: "AllInOneMinify" Click "Download and Install" Features Combining stylesheets / LESS files or JavaScripts Minimize the combined files No change to the .htaccess necessary (except for the domain sharding) Server-side LESS parsing without plugins HTML source code minimization Cookieless domain / domain sharding Automatic cache management (With changes to the source file, the cache is rebuilt) Configurable via the backend Automatic rewriting the paths in the stylesheet and LESS files. No changes are needed Optional developer mode (combining, but no minimize and browser cache prevention) Clear the cache on the backend Conditional loading for CSS, LESS and JS (since Version 3.1.1) How to use Minimize multiple stylesheet or LESS files into one file. You can even mix stylesheet and LESS files in parsing and combining process! <link rel="stylesheet" href="<?php echo AIOM::CSS(array('css/file-1.css', 'css/file-2.less', 'css/file-3.css', 'css/file-4.less')); ?>"> Minimize multiple javascript files into one file. <script src="<?php echo AIOM::JS(array('js/file-1.js', 'js/file-2.js', 'js/file-3.js', 'js/file-4.js')); ?>"></script> Conditional loading (same with Javascripts) <?php $stylesheets = array('css/reset.css', 'css/main.less', array('loadOn' => 'id|template=1002|1004|sitemap', // PW API selector 'files' => array('css/special.css', 'css/special-theme.less'))); ?> <link rel="stylesheet" type="text/css" href="<?php echo AIOM::CSS($stylesheets); ?>" /> More Information, Documentation and Download AIOM+ in ProcessWire repository AIOM+ on GitHub So, I hope you can do something with this module. Dave
    16 points
  2. http://www.designsatu.com Satu Jaakkola-Chiari is a Finnish fashion designer. She has two decades of experience with high-end fashion design in Italy. This is a small promotional website for her latest collection.
    12 points
  3. This website is a recent conversion from a Joomla version built over 2 years ago: https://www.olddominionmc.com My client, Old Dominion Medical Center (ODMC), simply loved the ProcessWire-based colors when I showed them the original "FoundWire" demonstration prototype. This website is a modified version of the original FoundWire Demo Profile that is now using the straight CSS version of Foundation 5. It's my personal preference until I can find the time to install Ruby and LESS/Sass tools on my new development desktop. For this project, our primary objective has always been to have a simple customer-facing website that presents their patients with vital information about the practice. Our secondary objective is to continue to use the website as an information portal for their back office day-to-day operations. Some of the first ProcessWire applications I built (over a year ago) were in direct support of ODMC. I continue to expand their Intranet to incorporate many administrative and support functions not covered by their EMR/EHR system. The following are the critical ProcessWire modules that make this website, especially the Intranet shine: Form Builder Pro Cache Modules Manager Images Manager (which, to me, is the greatest of Soma's many useful modules) Hanna Code Page Edit Field Permission Changelog Custom Upload Names Login History Redirects Template Editor Import Pages From CSV JQuery DataTables Plugin AIOM+ (All In One Minify) I have special thanks for Joss Sanglier (for his fantastic FoundWire Demo Profile) and Ryan Cramer (for his Foundation 4 Profile which got me very interested in Zurb Foundation). There are many others out there to thank (mainly the developers of the above listed modules) that have made my transition to ProcessWire most enjoyable. I'm still learning.
    9 points
  4. My first process-wire site for a client! Been working on it this week, will add a blog. It was my first 2.4 project. I'm loving 2.4. I put a font awesome icon on everything in the backend! makes me feel good to have icons for some reason. I am hoping I can just save this site as a "template" and use it for future projects as a base. + this was my first zerb site. http://www.principlededu.com/ I started this project as a wordpress project using Avada theme. a theme that got like 20,000 downloads or something crazy. It looked ultra flexible. But when it came time for client to edit, and they saw all the short-codes, they said forget it! (this is an example of an "easy page": the home page had more shortcodes then content) So I decided to give PW a try. It made for a much cleaner solution. (screen shot of home page) the page got more complex, and the client is editing happily. Anyway that is my success story, still working on the the project now, and open to any feedback and tips.
    5 points
  5. New Processwire Website. Built with HTML KickStart. http://www.carscallen.com Feedback welcome.
    4 points
  6. Technology evolves and you just have to evolve when things change. The basics I learned in the 80's are still applicable today. Each new technology builds on, circumvents or basically changes what was hot yesterday. If you are serious about learning you will keep up and prosper. Don't look at new ways of doing things as a challenge, look at it as an opportunity. Don't be scared or hostile to reinventing yourself. Good Luck in your endeavours.
    3 points
  7. Greetings, There are many methods you can use for forms -- as others have suggested. Remember: ProcessWire allows terrific flexibility to accomplish almost anything. But that flexibility also means you have to be clear about what you want to accomplish. I regularly build front-end interfaces for my ProcessWire projects, largely based on forms (of course). Once you head down this path, the possibilities are endless! I tend to build my forms with classic HTML, as Soma suggested. That method gives you the greatest flexibility. Please provide more information about what you want to accomplish, then we can give better answers. For example, are you trying to create and control ProcessWire content through the foms? I've worked through all this and posted about it before, as have others. Here are some links to get you started: Form to Create ProcessWire Content Using HTML (with file uploads): http://processwire.com/talk/topic/3105-create-pages-with-file-upload-field-via-api/ Form to Create ProcessWire Content Using ProcessWire Field Modules: http://processwire.com/talk/topic/2089-create-simple-forms-using-api/ Form to Edit ProcessWire Content http://processwire.com/talk/topic/4350-how-edit-a-page-using-api/?p=42620 Follow up if you have other questions. Thanks, Matthew
    3 points
  8. Hey, Mr Stevens, glad to see Foundwire helped someone. Rather than go to the trouble of installing Ruby and the rest, either go grab Scout or PrePros Scout is free and PrePros has a free and paid version. PrePros has the advantage that it will handle less and sass as well as minify JS, HTML and the rest. Nice clean site, btw
    2 points
  9. I am not a dev, but as I said before, all they are doing is using a line of JQuery to put the url of the linked-to page into the address bar. If you look at the source, the modal is in a div with the class "module Closeup canClose" This div is written (using ajax, I would guess) into a div called appendedContainer, which remains on the page unpopulated if you don't click on anything - it is simply a target for the retrieved page The css for the the closeup div is: .App .appendedContainer>.Module { -webkit-overflow-scrolling: touch; overflow-y: scroll; bottom: 0; left: 0; position: fixed; right: 0; top: 0; z-index: 680;} As you can see, it positions itself over the home page content with a z-index to put it on top. The actual homepage which is being overlaid is in a div called "ajax HomePage Module," just for interest and to help you find your way through the source. sooooo... What needs to be done here (by some nice person who can write a couple of lines of code) is for your link to call, by ajax, an actual PW page using its own template (possibly render() - though you would need to get rid of header and footer bits), write it into a div as above and at the same time, pop the URL of that page into the address bar. I am pretty sure that is how Pinterest are doing it, though foolishly, without PW It is probably about 4 lines of code and a couple of lines of JQuery to sort out the address bar bit. I am really not certain how to do it as I am an ajax virgin, but someone should be able to do it on the back of what I have just written. By the way, I do not see any SEO advantage to this method - the page is only called in by ajax when the user actually clicks on the image/link and the address bar is only populated at that same point. From a Search Engines point of view, it will just look at the link on the image, whether or not it has a nice flash popup Does that help steer you in the right direction? I am sorry I don't quite know enough to post the actual few lines of the solution. I could probably work it out eventually, but that would just be by asking everyone here how to do it! haha. PS: It is very definitely NOT an underpop - though I love that term! It is an overlay.
    2 points
  10. Networking via LinkedIn, through a contact I hadn't heard from in years. They contacted me and I originally helped them with some Windows PC support. I then redesigned all of their forms. Then I helped them get out of a couple of bad costly support contracts. I next created a custom IVR solution for them which replaced a support contract that was costing them $800 a month. New projects continue to this day.
    2 points
  11. Hi Helmut, you may create a new template with its own template file. Create a blank textfile and call it myform.php, copy it into the site/templates/ folder of pw. Go into the pw admin and under setup templates and create a new template. There should be a list with template filenames from your site/templates/ folder (without the .php extension). Check the one you have newly created and save it. Now create a new page under homepage and assign your form-template to it. Lets say the url of it is "/contactform/". Go to your Editor and write into your template file some code like that: <?php if($input->post->aFormFieldName) { // a user has send the form, proceed the data and display a thank you message ... echo "<h4>Thank you for contacting us. We will get back to you soon."; return; // stop with template code here } // if we have no post data, lets display a html form $myForm1 = " <form action='{$page->url}' method='post'> // your inputfields and buttons here </form> "; echo $myForm1; Now go to the browser and call: example.com/contactform/ and try it out. If you use a profile with header.inc and footer.inc, add it to the template file like it is within the other template files: <?php include("./head.inc"); if($input->post->aFormFieldName) { // a user has send the form, proceed the data and display a thank you message ... echo "<h4>Thank you for contacting us. We will get back to you soon."; include("./foot.inc"); // load the footer here, because we stop template execution in the next line! return; // stop with template code here } // if we have no post data, lets display a html form $myForm1 = " <form action='{$page->url}' method='post'> // your inputfields and buttons here </form> "; echo $myForm1; include("./foot.inc"); Have fun!
    2 points
  12. Hello horst and thank you for your feedback! Animation is done with CSS transitions by animating opacity and scale. I wrote a simple jQuery plugin to handle animate-in and animate-out classes. Plugin is similar to Sequence.js.
    2 points
  13. Greetings Fokke, Thanks for posting this! Great work. Viewing (at the moment) on iPad Safari, and the whole experience of the site is terriric. The large images work well to give an immersive feel to the whole site. Nice design for the slideshows of the "Collection" items. Just a couple of very small comments: the text on individual "Collection" items has odd line breaks (see screen shot below). The slideshow is just a bit slow. Excellent work. The client should be appreciative of how well you present their works! Thanks, Matthew
    2 points
  14. also worth a look: http://processwire.com/talk/topic/3812-htaccess/?p=37295
    2 points
  15. 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
  16. What's the best way to adjust the title tag display? For just about every client I have using PW, the page title they're editing is much more relevant to see in the tab title than their site's domain since it's the only site they'd ever be editing.
    1 point
  17. thanks, I noticed that right away and was trying to figure out how to do that.... thanks, just changed it! Another feature that I thought would be cool would be to minimize repeaters be default. This might already be a feature but I could not find it. Example:
    1 point
  18. An HTTP hosts whitelist is important from a security aspect because http_host comes from the request rather than from the server... Meaning it can be forged. Maybe not a big deal since we always sanitize it, until you are dealing with cache, which the opens up the possibility of cache poisoning for any page that makes use of the http host. Imagine a hacker priming your cache with their own URL. Unfortunately, PHP's safe server_name variable is not reliable enough to reflect the potential diversity of http host names. So the only safe thing to do is to have a whitelist. If you aren't using the whitelist, I recommend adding it to your config.php. It's actually a little unusual for the http host to be used in PW because usually you'd just use the url() methods, which just output paths and not hosts. There's really no reason to use httpUrl() in most cases. So if you are using it, double check that you need to - it's extra unnecessary bytes unless you need to switch hostnames or schema. But with the next version of ProCache supporting multi-hosts, having an http host whitelist is now absolutely necessary.
    1 point
  19. Definitely, but also check out the h5bp .htaccess There are some of the same rules but also some other nice stuff.
    1 point
  20. Nice site. One comment; the logo doesn't really scale nicely upon resizing the screen and on bigger resolutions some artifacts appear. For example when viewing on 1920x1080 Win7 Firefox 27.0.1, it's not really crisp, and some artifacts beneath some of the letters: Google Chrome and IE do a better job, but still not great.
    1 point
  21. Reading your post, I'm a little impressed what you are all doing out there with processwire. How did you catch that project ?
    1 point
  22. Thank you for the explanation and link to sequence-js. But I think sequence.js would be to much overhead for a little Ken-Burns effect. To write a own small script is a much better way
    1 point
  23. Yes Apeisa's shop module works very well but you need some coding experience to make it output your needs.
    1 point
  24. Hi Fokke, really great site. Very good presentation and modern design. Most I like the moving of the slideshow images on the homepage. Is this realized with a jQuery-Plugin only, or is this mainly a CSS3-animation/transition thing? (I'm not very familiar with this stuff)
    1 point
  25. Oh, sorry. Maybe I will try Apeisa's shop module. I'm not sure when this will happen, as it's possible these bags will never be sold via the website.
    1 point
  26. You added 'FieldtypePage' to the $fieldtypes array correct? What field type does the 'user' template have? Have you tried to connect a single page id?
    1 point
  27. I would vote against making this standard. It isn't neccesary for w3c validation and actually, using title attributes on links is fairly problematic and i don't think good practice at all. http://blog.paciellogroup.com/2013/01/using-the-html-title-attribute-updated/ http://www.rnib.org.uk/professionals/webaccessibility/wacblog/Lists/Posts/Post.aspx?id=38
    1 point
  28. Actually i found the answer $num = count($Page->comments); "<p>Page has $num Comments</p>"
    1 point
  29. Out of the box. No changes.
    1 point
  30. Nice catch horst Can I go one simpler: $pids = array(1010, 1011, 1022); if(in_array($page->id, $pids)) { echo $pages->get("1114")->body"; } or even just: if(in_array($page->id, array(1010, 1011, 1022))) echo $pages->get("1114")->body";
    1 point
  31. @adrian: if the actual page isn't in $pids, there is no need to load page 1114 into memory $pids = array(1010, 1011, 1022); if(in_array($page->id, $pids)) { $downloads = $pages->get("1114"); echo "$downloads->body"; }
    1 point
  32. The key is find vs get: $downloads = $pages->find("id=1|1114|1452"); foreach($download as $p){ echo $p->body; } EDIT: Actually I am not quite sure what you are trying to achieve. I left out the check for whether the current page is id=1011, but you can easily add that back into my code. Am I on the right track with grabbing the content of pages using multiple IDs in the find, or am I off track completely with what you want?
    1 point
  33. Find concerthouses first: $concerthouses = $pages->find("template=concerthouse, title~=$q"); Then find events that are held in any of those: $concerts = $pages->find("template=concert, event.concerthouse=$concerthouses"); Ah, sorry, missed the repeater part... updated above.
    1 point
  34. I see you found your solution, but I will post mine anyway, maybe it will be of some help too <?php $today = strtotime('today midnight'); //or if you want to show only events in future //$today = date(); $schedule = $page->schedule->find("schedule_date>$today"); //then put $schedule in your loop Also you can request one item like this: <?php $schedule_item = $pages->get(1007)->schedule->get("schedule_date>=$today"); //maybe you'll want to sort them if they are not in the right order, then add sort=schedule_date to your selector
    1 point
  35. Have you read the pages on repeaters, especially the section on: "Finding pages by repeater value (using selectors)" You should be able to figure it out from there using a selector that finds items with schedule_date > time() Let us know if that gets you on your way, or if you need more specific help.
    1 point
  36. I am sure I am missing something about what you want to do, but this works for me: $target_page = $pages->get(xxxx); $target_page->files->add("full url to file"); $target_page->of(false); $target_page->save(); I haven't looked to see what PW is using in the background (maybe file_get_content with a fallback to cURL), but there might be an issue with file_get_contents if you have allow_url_fopen off in your server config.
    1 point
  37. I terms of development and usage standpoint ProcessWire is much better suited for the task then Joomla, Wordpress and even Drupal. But you have to be ready to invest your time in learning some concepts of PW. There are a few of them: page, pageArray, selector, template, template file, field, and module. If you feell comfortable with OOP PHP, CSS and HTML, you will definetely succeed. Of course it will requre some custom coding as with any more or less complex project. I'll try to make some assessment here in terms of efforts required if you have the skills mentioned above: listing and search of properties for rent and sale - easy blog layout display and detail display - very easy gallery for each property - very easy google maps display of location - easy with existing module (some work is required if you need more complex integration) google maps search - (not quite sure what you mean here) I guess it depends on what parameters you want to search, should require some coding user registration - user access control is coming out of-the-box, you just need to customise it for your needs and make registration and login forms for your front end. add to favorites function- easy send to friend - easy social share - some coding requred - I think there are open source social sharing projects you could integrate for this (like this one) and so on - it depends, but I think the rest is super-easy front and back end editing - back-end editing is already here. But front-end editing is what you will have to code yourself. So I suppose could require fair amount of work. restricted access to some sensitive informations (like landlords contact details, clients info and so on) - it depends on the logic of your site, I guess you will have to code some parts. adding property informations with some already defined values in dynamic fields (street names for instance) - from easy to medium, but more info would help. Jquery image upload (automatic resize, thumbnail creation, watermark add) - all is here (thanks @Apeisa and @smd) including watermarks (thanks to @Horst) I am sure you get the picture. Unless you have a strict deadline go with Processwire - it will worth the effort in any possible sense. If it's your first project with PW, it may be not the easiest journey, but an exciting one. In the end you will aquire some great skills and have many insights. And I'm sure, after you've arrived you will never look back . Whereas you arguably could start faster with Drupal (that I think the only competitive CMS option here) dropping some plugins together, you then would almost inevitable struggle with your front-end markup and in general making all work the way you (and not Drupal) want. And again you have to be familiar with Drupal's internals to make those hacks. In PW you develope naturally extending existing functionality and it doesn't make any assumptions about your workflow and markup. So it gives you more rewarding experience during the development process. Almost all the skills you get using PW is transferable to other webdev areas. From the UX point of view PW's interface is a dream coming true (and Drupal is a nightmare IMHO). If you haven't seen PW 2.4 yet, just go and have a look - it's beautiful!
    1 point
  38. As the others have said, the point with ProcessWire is that you end up with exactly the interface and exactly the tools that your client needs, because you build them for them. The result fits their brand and their need, you are not trying to force them into a compromise. There are a few of us who have come the Joomla route (and would never go back) and we have all been amazed at how quickly we were able to pick PW up and make something solid with it - even people like me with little programming knowledge. And of course, any tools you develop as you go, you can keep and reuse on another project!
    1 point
  39. Everything you've mentioned is possible with ProcessWire. If there aren't any complete solutions avaible for Wordpress or Joomla then ProcessWire might be your best choice to build it by yourself. But remember that the great flexiblity comes from building your own "logic" and template rather than using 10 different modules from 10 developers. It takes more time but the result is customized for your problem then. Search and list the properties pages. No problem. Example pseudo-code $pages->find('template=house,sale=1"); Another view option for a list of properties. The detail page could be the template of the property. The gallery can be a field with multiple Images or a extra page linked to the property. There is a GoogleMapsMarker Fieldtype. Works fine with some JS libraries for front-end integration. Not sure about this one. Now we come to the weaker spot of ProcessWire. It's no problem to build a simple signup form and make basic user management. But depending on your requirements you will have to put a lot of effort into this topic. Fine if you only need it for a single user/session Just HTML/JS magic. No problem and nothing special to ProcessWire ... The backend might be your problem. Backend Editing is no problem. But building a Front-End live editor thing is a huge project. Whole teams are spending weeks developing such functionality for other plattforms. Here you can look into the Module directory. This is possible with PW Not sure. You would define a source for this pre-populated data. Maybe a combination of a simple module and Page-reference field? Image resizing is no problem, neither is the thumbnail creation one. You can add a watermark with Horsts PIM module. Overall this is a complex project. Especially the front-end editing and the user thing can take some time. A basic system where you can have properties listed with details is easy and should be your first step. If you can invest the time you will get an awesome and flexible site. Split the project into smaller milestones would be my last suggestion.
    1 point
  40. Let's put it this way....if you enjoy microwave dinners, then Joomla or WP is for you. Sometimes the dinner will be easy to cook and may turn out right. On other occassions, the dessert will flop and you will be left frustrated but you will have to do with what you have. If on the other hand, you enjoy having all the ingredients you need and can follow any of several recipes to create some beautiful food with your ingredients, then PW is for you .... What am I saying? If you want to point and click and solve problems by adding more plugins to the system, Joomla and WP are "good". If you want finely grained control over everything, then PW is for you. However, with PW, some work will be required of you. You will have to be willing to learn....The community will be here to guide you along the way if you ask for help where you are stuck... Just my 2p (spoken from the point of view of an unashamedly biased PW addict - but who has been to J and W before...)...Seriously, though, creating a backend admin in PW is not difficult... Welcome to PW and the forums vladar
    1 point
  41. I would avoid putting it in /cache/HannaCode/. What does your include line look like? If your class file were placed in /site/templates/includes/ (for example) then your include line should look like this: require_once(wire('config')->paths->templates . "includes/YourClass.php");
    1 point
  42. <qoute>experience with running $pages->find("selector") api call on over 10,000 pages?</quote> I Don't think you will have any noticeable slowness with that amount of pages to be searched. You can't compare getResources with the ProcessWire way of finding pages. So far I understand Modx loads all the fields with getResources & the custom fields if needed in your results. ProcessWire wil only load the fields when you access them, so there's no field load with a page find. Result, searching 100.000 pages is not a problem. Searching 10.000 pages, just a blink of an eye.
    1 point
  43. Do you want to find something in a set of 10.000 pages or do you mean a find result of 10.000 items? Searching in 10.000 pages isn't a problem, PW is really fast. But if there are a lot of possible results it's generally advised to limit the pages->find call to 25, 50 or another sane value. http://processwire.com/api/selectors/#limit . If you want you can combine this with pagination. The reason for this (others can prolly explain better) is that the pages->find call will return a PageArray that gets put in memory and if there are a lot of pages in the array things will inevitably slow down. Of course, depending on the situation, 'slow' in PW terms may still be acceptable. I have grabbed hundreds or even thousands of pages in one go and it still performed pretty well.
    1 point
  44. That is a simple light box functionality or modal window that takes content rather than just an image. There are loads of jquery plugins out there that do it - search for "jquery modal" Here is a very basic one I have just found - haven't tested it! http://leanmodal.finelysliced.com.au/ One note: you need to double check what JQuery you are using - For instance Foundation 5 uses JQuery 2, but not all plugins are working with that.
    1 point
  45. I think you should probably take a look at the concept behind ProcessWire first, then some of the other docs and the cheatsheet as Macrura suggest - start with the Concept page from here: http://processwire.com/api/ The Cheatsheet then gives you a look at most the possible functionality at your disposal in page templates to access your data and files. As for explaining the line of code you quoted: $skyscrapers = $page->skyscrapers->find("limit=3, sort=random"); From memory, "skyscrapers" is actually a "featured skyscrapers" field, so is just a Page field that links to other pages (probably the most useful fieldtype there is. Here is the exact translation: "For the current page (homepage in this instance), find 3 random pages from the skyscrapers field". The $skyscrapers = bit is just storing the results in a PageArray (it's in the docs linked further up my post here) that can then easily be iterated through to print whatever output you desire. If you're wondering why the demo doesn't seem to pick three random pages, I think page caching must have been accidentally left on here so it's always showing the same 3 in the demo, but that's easy to switch off The syntax is based on jQuery and aims to be human-readable. If you imagine that there are a few database tables and queries behind that code, you can easily see how quick that is to write and all without a line of SQL. You can make all sorts of queries like: $architectsCalledPaul = $pages->find("template=architect, title*=Paul"); // finds all architects (pages with the template "architect" with the name Paul somewhere in the title field // and so on... The idea behind ProcessWire is that once you've learned the basics you can build pretty complicated data structures in the admin quicker than you'd be able to writing database tables from scratch and you have a hugely powerful set of functions at your fingertips to do with that data as you please. Most folks here would agree that it has shaved hours/days/weeks/months off their site build times depending on website scale, but any time saved is good!
    1 point
  46. If you don't need the page to be saved when the button is clicked, then I think the route you are taking is fine. If you did need the page to be saved, then you'd want your button to be a submit button, and a second (save) hook to be called after the ProcessPageEdit::processInput and to silently do its thing (no redirect). Another route you could take is to setup a separate page with a template that does what you want, and then have your button link to that instead. But the way you've done it is already more compartmentalized (less parts to consider) so I wouldn't change it unless it creates issues with other modules hooking into ProcessPageEdit at some point down the road (which is possible). One issue you probably want to fix here though is the potential for XSS: $href = $this->config->urls->admin.'page/edit/?id='.$this->input->get->id.'&e=1'; Taking a variable directly from $_GET or $input->get and putting it in output (unsanitized) is always dangerous. You'd want to do this: $id = (int) $this->input->get->id; $href = $this->config->urls->admin."page/edit/?id=$id&e=1"; or better, yet this: $id = (int) $event->object->getPage()->id; $href = $this->config->urls->admin."page/edit/?id=$id&e=1";
    1 point
  47. Thanks Ryan, I ended up hooking into ProcessPageEdit::buildForm: $this->addHook('ProcessPageEdit::buildForm', $this, 'addButton'); public function addButton(HookEvent $event) { $href = $this->config->urls->admin.'page/edit/?id='.$this->input->get->id.'&e=1'; $field = $this->modules->get('InputfieldButton'); $field->attr('id+name', 'email_customer'); $field->attr('class', $field->class); $field->attr('value', 'Email Booking To Customer'); $field->attr('href',$href); $event->return = $event->return->append($field); } I then just check for $_GET['e'], and undertake the workflow needed, and redirect back to the original edit page. A bit of a circus, but gets the job done. Is there a better way to utilize hooks for custom workflows like this?
    1 point
  48. @bcartier: The ImportPagesCSV-module can't do this as is. But I tried making a tiny addition to make it support FieldtypePage (those used to make page references) and it worked amazingly well. The only change needed was to add 'FieldtypePage' to $fieldtypes array (just before init() function if you take a look at the module file), like this: protected $fieldtypes = array( 'FieldtypePageTitle', 'FieldtypeText', 'FieldtypeTextarea', 'FieldtypeInteger', 'FieldtypeFloat', 'FieldtypeEmail', 'FieldtypeURL', 'FieldtypeCheckbox', 'FieldtypeFile', 'FieldtypePage', // add this line ); After that addition it's possible to choose a Page field when connecting the fields from the CSV to the ones in the chosen template. I had pre-populated categories at the target site and used their id's in the CSV file to reference those categories. Multiple categories worked like a charm as well, just use a pipe in between id's (123|456|789). Moreover, if you've got only one category per entry to reference, then you don't even need the id's of the categories - you can use paths as well. Here's a little example: cat.csv: title one two three four entries.csv: title,categories a,/cats/four/ b,/cats/three/ c,/cats/one/ d,/cats/two/ Import cat.csv using a template for categories with (at least) title field, under a page at /cats/. Then import entries.csv using a template for entries, having a title field and a page field. This should leave you with entries that are connected to categories. I hope this gets you somewhere. @ryan: Looks like page references could be supported very easily. I just used this successfully to import ~3500 pages with category references from an old site to a new PW one. But maybe there's still something else to be done before they're fully supported?
    1 point
×
×
  • Create New...