Jump to content

Jonathan Lahijani

Members
  • Posts

    733
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by Jonathan Lahijani

  1. I'm not sure if this has been brought up before, and I definitely know this idea is very wishful thinking since it goes directly against how ProcessWire is supposed to work, but I thought I'd bring it up anyway. Currently, if you want to add a field to a page, you must add that field to the template that the page uses. This means, the field will exist not only for that specific page, but any pages that use the same template. Sometimes however, I want to add a field to a specific page without having to give that page a unique template. Perhaps I'm a little lazy, or perhaps it just seems like creating a specific template feels like overkill, although that is the ProcessWire Way. If you are familiar with Advanced Custom Fields for WordPress, it does have this kind of functionality (in addition to a few other cool ways to assign fields), but WordPress of course handles custom fields in a much more "loose" way. Any thoughts on this?
  2. Another plugin that's similar to RAMP: https://github.com/stenberg/content-staging
  3. The WP Migrate DB Pro plugin doesn't do versioning (like Ruby on Rails DB Migrations) or content deployment (merging), but rather a complete database replacement of one database to another, which would be problematic on sites that are already live and whereby the live site and staging site have different content. The RAMP plugin is what does selective content deployment. The current ProcessWire equivalents are a bit manual: Can export and then import fields (native PW feature) Can export and then import templates (native PW feature) Can export and then import HannaCode (native module feature) Can export and then import FormBuilder forms (native module feature) The ProcessMigrator module does both field and template export/import along with the ability to export and import actual content. So in my eyes, it's the currently the analogous plugin to RAMP. It would be very slick ProcessMigrator could "connect" a staging site and a live site so that content deployment could be one click. Would be a great premium feature!
  4. Haven't tried this yet, but worth looking into: http://dbv.vizuina.com/
  5. One thing that would take this even further is if instead of having an "add new" button for each template, perhaps have a dropdown instead. This would work well in situations where one would have like 20+ templates types that can be added to a pagetable.
  6. Hi jsantari, Here's how I'd go about it: (1) Make the following templates: products.php product.php product-categories.php product-category.php options (no need for php file) option (no need for php file) (2) Make the following page structure: /products/ (uses products.php)/product-1/ (uses product.php) /product-2/ (uses product.php) (etc) /product-categories/ (uses product-categories.php)/product-category-1/ (uses product-category.php) /product-category-2/ (uses product-category.php) (etc) /options/ (uses options.php)/colors/ (uses option.php)/red/ (uses option.php) /green/ (uses option.php) /blue/ (uses option.php) /sizes/ (uses option.php)/small/ (uses option.php) /medium/ (uses option.php) /large/ (uses option.php) (3) create the following fields: color (Page field; single value; use /options/colors/ as parent; regular select box); assign it to product.php size (Page field; single value; use /options/sizes/ as parent; regular select box); assign it to product.php products (Page field, multi-value; use /products/ as parent; ASM select or even better, PageListSelectMultiple since you have over 2000 products); assign it to product-category.php Now we need to handle what you said: "The twist is that each product category will have attributes like color, size etc. but the values for color, size etc. will be different based on what category is selected." The way I'd approach is to create 2 more fields and assign them to the product-category.php template: filterable_colors (Page field; multi-value; use /options/colors/ as parent; ASM select preferably); assign it to product-category.php filterable_sizes (Page field; multi-value; use /options/sizes/ as parent; ASM select preferably); assign it to product-category.php So those two filter fields will pretty much allow your category to have specific filters. Ideally, you would then code your product-category.php template to loop through and output all the products assigned to the category, as well as loop through the filterable_colors and filterable_sizes which would act as filters to the list of the products on that page. If doing the filtering client-side, here's a cool library: https://mixitup.kunkalabs.com/ Hope this helps! Jonathan
  7. Looking into this further... CKEditor widgets does seem like a superior approach... much better than Content Templates (which I mentioned in my last reponse) since with Widgets, the HTML structure is locked and easy to reposition. Very "page builder" like interactivity. There's some activity with Drupal and CKeditor Widgets that looks nice: http://albatrossdigital.com/node/41 CKEditor also has demo: http://ckeditor.com/demo#widgets A combination of CKEditor Widgets + ProcessWire tie-ins would be pretty slick.
  8. Very insightful discussion and one that I've thought of deeply as well. One other approach that's easy and built directly into CKEditor is to simply use the Content Templates plugin. The plugin already comes with ProcessWire's CKEditor, so simply enable it by editing your CKEditor field and allowing the option in the "CKEditor Toolbar" field. I put some screenshots indicating exactly what to do below. I'm exploring this approach right now so I don't have much insight yet. https://goo.gl/kbtDTG https://goo.gl/a4JBAH
  9. @LostKobrakai: I tried the code you posted but it didn't seem to work. @tpr: I tried your approach and it did work. The result: $listings = $pages->find("parent=/listings/,template=listing,limit=2,id=".$page->listings->id('|'));
  10. I have a page X with page-field called "listings". I want to paginate the listings on page X, but this seems not to work. Normally it would work fine if the thing that was to be paginated was wasn't coming from a Page select field. Here's what I have: <?php $listings = $page->listings->find("limit=2"); // this is not friendly to paginator it seems //$listings = $pages->find("parent=/listings/,template=listing,limit=2"); // this would work, but not what i want because it's not pulling the specific data i need... i want it come from a page field as shown in the above line. $pagination = $listings->renderPager(); ?> <?php include "./_head.php"; ?> <main class="main" role="main"> <?php if(count($page->listings)): ?> <div class="container"> <?php foreach($listings as $listing): ?> <?php wireIncludeFile("_listing-slab-item", array( 'listing' => $listing, )); ?> <?php endforeach; ?> <?php echo $pagination; ?><!-- this outputs nothing --> </div> <?php endif; ?> </main><!-- /.main --> <?php include "./_foot.php"; ?> To be sure, I did enable page numbers on my template file.
  11. Question... let's say I want users only with a particular role to be able to log in, how would I go about that using hooks? Current code: $fu = $modules->get('FrontendUser'); $fu->login(); $fu->login(array('username', 'password', 'persist', 'forgot')); $fu->process($pages->get("/")->url); echo $fu->render();
  12. OK, I'm finally going to be breathing some life into this project. I got the title sequence done (well a near final draft) along with intro music (bought the track music from audiojungle). Here's a little teaser: http://jonathanlahijani.com/wirecasts-teaser.mp4 The title sequence is a little choppy. Need to fix that. It's actually just a screen capture of an animation I made using plain old html/css with animate.css. I have about 15 videos done so far, but another 18 to go. This WordPress vs. ProcessWire series will cover many different features and quickly compare the two systems. It will not be biased and will compare the best of WordPress to the best of ProcessWire.
  13. I'm having trouble figuring out how to do this correctly. Let's say I have a page with an ASM select field. Let's say this ASM select field has values A, B and C selected. Let's say the page is edited so that the ASM select field has C removed and then it is saved. How do I determine specifically if C was removed and also display a custom notification if C was removed (in addition PW's regular save page notification)? I've got my code to a point where it can determine if this field was changed, but not specifically what value were changed. Not sure how to do it. Thank you.
  14. Although I generally use CSS frameworks, I decided not to use one for this project because most of the features they provide would not be used (especially the grid system). This site is very low on widget/component-like design, so to me it made sense to selectively bring in only the features that were needed (masonry-layout, lightbox, carousel, etc.). Bootstrap for example comes with a carousel but it's not as good as Slick.js. It also has a lightbox/modal, but it's not optimal for lightbox galleries which is why I used Fresco for images/videos and Featherlight for text. I wouldn't be able to fine-tune the responsive breakpoints Bootstrap provides with its grid system (or at least not without a lot of headache). The site didn't require 6 button styles, accordions, etc. Easy enough to accomplish these features without a framework. Bootstrap automatically makes a mobile optimized navigation from the navbar component, but using Bootstrap's navbar (combined with its grid framework) would have caused a lot of trouble with the masonry photo layout since that masonry photo layout has it's own breakpoints that would clash with Bootstrap. A big CSS framework could be utilized, but my approach is to use the best tools for the task at hand.
  15. Hi Ivan, The only paid/commercial plugin is Fresco. Yes, the site is very bandwidth intensive, which is a tradeoff that had to be made but in opinion acceptable given the primary audience viewing the site. One adjustment that might be made is lazy loading of images: http://luis-almeida.github.io/unveil/ Also, maybe a better hosting solution like Digital Ocean. It's on GoDaddy right now.
  16. I soft-launched this site a few weeks ago and it's still being refined, however most of it is complete: http://brakhax2.com/ Brakha X2 is a production company headquarted in Los Angeles. They handle many large ad campaigns for well known brands. The bulk of the site consists of the image galleries (/advertising/, /editorials/, /silent-pictures/, etc.). The images in these galleries are not coming in via a typical images field since the images are really more like artwork pieces with it's own set of data. Therefore, I decided to create a template called "image" and a field in it called "image" (max upload of 1) in with some other fields (title, tags [not being used yet], body, etc.). These images then get assigned to each image_gallery in a Page field I created called image_items. By allowing each image / artwork piece to have it's own page, it allows for: a specific URL for each artwork piece page (example: brakhax2.com/images/name-of-the-piece/) fine control when people share images via social media (OG tags) the ability to re-use the entry in Page fields There's some fancy stuff going on in the frontend. I didn't use a CSS framework since it wouldn't have been a good match. I ended up using the following packages: Packery: this takes care of the masonry-style layout on the gallery pages ImagesLoaded: this allows the gallery images to show only after all the images have been loaded. it will show the loading graphic until everything is loaded Featherlight: this is a simple lightbox which is being used for the bios on the contact page Slick.js (aka Slick Carousel): this is being used for the video galleries (/spots/, /inside/) Fresco: a great commercial plugin that powers the lightboxes for the images and videos Responsive-nav: this takes care of the mobile menu logic Animsition: this takes care of page-to-page fade animations There's a few other little techniques/approaches being utilized on the site, but that covers all the major stuff. Eventually I will work in a Gulp workflow so that the CSS and JS is packaged and minified. Jonathan
  17. AdminTemplateColumns ProcessPageDelete FormBuilder ProcessWireUpgrade WireMailSwiftMailer MarkupRSSEnhanced
  18. Made my own ProcessWire T-shirt: http://i.imgur.com/FBWb59Q.jpg
  19. I just implemented this approach based off of your code. I like the bi-directional concept behind it, although data is being stored twice. I can live with that.
  20. Thank you for the variation in answers. I wonder if this could become a core feature. Pseudo-code off the top of my head: $people = $pages->find("parent=/people/,template=person,first_name=Joe,referenced_by_template=company,referenced_by_field=people");
  21. There's been various forum posts regarding a similar topic, but I can't seem to crack this query. Here's my data structure: /companies/ /company-1/ (company.php) /company-2/ (company.php) /company-3/ (company.php) /people/ /person-1/ (person.php) /person-2/ (person.php) /person-3/ (person.php) The company.php template has a Page field (asm-select) called "people" which grabs all the people from /people/. Therefore, a company can be assigned many people. (note: technically this could be done in reverse... meaning I could create a Page field called "companies" and assign that field to the people.php template, but the approach I'm taking makes more sense I believe... can control sort orders, etc.) Now, let's say I want to do a query and find People whose first name is 'Joe' and who belong to a company with the word "Test" in it. $companies = $pages->find("parent=/companies/,template=company,title~=Test"); $people = $pages->find("parent=/people/,template=person,first_name=Joe,XXX=$companies"); The part where I wrote XXX is where I'm lost. XXX would represent a belongs_to relationship like in Ruby on Rails. I mentioned above that I could setup the fields in a reverse way, which if that were the case, this query would be easy (but create other organizational issues), however I want to stick to the approach field approach. I know there's a lot of ways to go about this. Perhaps I'm also overlooking something very obvious too. Edit: This post is the most relevant to what I'm discussing: https://processwire.com/talk/topic/1071-page-fieldtype-two-way-relation/
  22. For anyone looking for a great frontend approach / workflow that uses all the cutting edge practices and tools, I highly recommend taking a look at the Sage Starter Theme for WordPress (formerly known as Roots... they changed it to Sage and kept the "Roots" name as the parent organization name). Although Sage is built around WordPress, it's not difficult to strip away the WordPress related bits (mainly template related things and workarounds that fix some of WP's quirks) so it can work with ProcessWire. In fact, this has been my primary frontend technique for most ProcessWire sites. They have a great community over there as well. Relevant links: https://roots.io/ https://roots.io/new-website-sage-and-the-future/
  23. Any particular reason you didn't go with Soma's Template Notes module? http://modules.processwire.com/modules/template-notes/
×
×
  • Create New...