Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/24/2015 in all areas

  1. 1,5 month later, after I did most of the project and be sure that I understand PW system, I finally finished that part. It's not perfect of course but it's working fine. Here is how I did it: Templates And Fields: I created 2 templates: grid and grid_item and 1 pagetableextended field grid_items. In grids page I can enter grid_items like below: Title, summary, featured_image for content on the grid items, external url for obvious reasons, grid_ratio is to determine size of item. Design is limited with ratios from 1x1 to 3x3, so I made it selectable page items from options use_border : for images with white bg, so they don't look like they are floating Modules I have created 3 modules. InputfieldGridBuilder,FieldtypeGridBuilder and GridBuilder. Whenever I save the page, new items from grid_items pagetable are available to use like below. I can order items, add new rows, delete row etc. Whenever I change something, there is a method that works to serialize data to the hidden input field,InputfieldGridBuilder. Also, just in case I call the function it every 5 seconds. I make a small fixed grid that is very similar to the one used in the frontend. So anything that you can do here with jQueryui sortables, it's available for using in the frontend. Last module GridBuilder is used for mostly utility purposes for both frontend and backend. It has methods like getItemSize, getItemImage, build etc. Frontend Normally these will be used in homepage but I made the view of page available to users with editing roles, so before using them they can see that it look like. For example this one in the gif above looks like this. So even with the empty rows, it works. And for using in the homepage, I added a multiple selection page field. So they can use more than one grid, or with the location options we already added they can select to have a different view for different countries. (I added Location settings is globally for every page) Questions, critics, feedbacks or "hi,there buddy"'s are highly welcomed.
    8 points
  2. It was first base Ryan, second base Ryan, third base Ryan ...
    3 points
  3. hi, there buddy ;-) it would be nice if you post your nice modules for all.
    2 points
  4. It shouldn't matter if one is using Before, Nothing or After for that Hook as the timing isn't relevant.
    2 points
  5. $this->addHookAfter('Pages::saved', $this, 'saved'); After was missing in your example. That syntax is normally used for adding a new method to the class when that method don't exist. public function init() { $this->addHook('Page::trololo', $this, 'trololo'); } public function tralala($event) { $page = $event->object; // trololo $event->return = "https://www.youtube.com/watch?v=2Z4m4lnjxkY"; } // echo $page->trololo();
    2 points
  6. Have just committed 0.1.0 to GitHub. The bundle comes with a preset contact form definition, used for easy testing. All that needs to be done after installation is the HTML form, which is below for copy-paste purposes: <form data-simpleforms="contact" action="<?=$simpleForms->actionFor('contact')?>" method="POST"> <?=$simpleForms->csrfToken()?> <div data-simpleforms-formerror></div> <div> <input type="text" name="name" id="name" placeholder="Your name (required)"> <div data-simpleforms-fielderror="name"></div> </div> <div> <input type="email" name="email" id="email" placeholder="Your email address (required)"> <div data-simpleforms-fielderror="email"></div> </div> <div> <input type="text" name="company" id="company" placeholder="Company name (optional)"> <div data-simpleforms-fielderror="company"></div> </div> <div> <input type="text" name="contact" id="contact" placeholder="Contact number (optional)"> <div data-simpleforms-fielderror="contact"></div> </div> <div> <textarea name="message" id="message" cols="30" rows="10"></textarea> <div data-simpleforms-fielderror="message"></div> </div> <div> <input type="submit" data-value="Submit Form"> </div> </form> Of course, this form is not styled, and is very basic. This is just for testing purposes. actionFor simply prints the URI to the form processor for this form. csrfToken prints the hidden CSRF token. The next step is to ensure jQuery is loaded on the page - I tested with 1.8.3 (bundled with ProcessWire) only, so not sure if any bugs will pop up in later versions. Then, link up the front-end jQuery asset with either of the following: <!-- Cache-busted (default); outputs /site/modules/SimpleForms/assets/jquery.simpleforms.min.js?<unix_time> --> <script src="<?=$simpleForms->script();?>"></script> <!-- Non-cache-busted; outputs /site/modules/SimpleForms/assets/jquery.simpleforms.min.js --> <script src="<?=$simpleForms->script(false, true);?>"></script> <!-- Non-cache-busted, non-minified; outputs /site/modules/SimpleForms/assets/jquery.simpleforms.js --> <script src="<?=$simpleForms->script(false, false);?>"></script> And lastly, prepare the form using any of the following methods (just above the closing body tag): <!-- Just the contact form. --> <script>$("[data-simpleforms=contact]").simpleForms();</script> <!-- Or all the forms - all of these are the same, so best to use the last one. --> <script>$("[data-simpleforms!=''][data-simpleforms]").simpleForms();</script> <script>$(allSimpleForms()).simpleForms();</script> <script>simpleForms();</script> Form definitions have been moved to their own directories, as discussed previously. Have a look at the forms/contact directory, which contains the config and templates. Have also included a @todo list in the module's main file so you can see what's in the pipeline. For easy reference, here's the current list: /* @todo Auto-prepend existing stylesheet to HTML template - need not rely on template var {stylesheet}. * @todo Template attachments (inline data or attachment reference - perhaps we should rely on SwiftMailer for this?). * @todo Use reply link builder (for cases where emails may not be sent from sender - usually the case with SMTP). * @todo Translate all the things! * @todo Make module configurable - allow for default form-recipient and noreply/auto-response sender. * @todo Simple form builder, based on JSON specifications. * @todo Make AJAX optional, using standard form submission protocols. */ There are many configuration options still to come; I'd like to make this as configurable as possible, but without code-bloating the module. Looking forward to input from testers - this is, of course, nowhere near perfect, but is a good base/blueprint from which to start. Once we've reached feature-parity and the module is stable, I'll release it on a new thread, and put up some documentation.
    2 points
  7. PageTableExtended Download here: http://modules.processwire.com/modules/fieldtype-page-table-extended/ Extends the Processwire PageTable field for rendering table row layouts. This is great for editors, because they actually see at a glance what the table rows consist of. What it does Turns the Processwire Fieldtype "Page Table" from this: into something like this (sorting capabilities of course still functional): See it in action: Requirements FieldtypePageTable installed (part of the core since Processwire 2.4.10.) Templates used for PageTable need a file associated (otherwise nothing gets rendered) This render method is meant for sites where the PageTable templates only render part of the layout, not complete websites. But you also can define what will be rendered (see below). Options Render Layout instead of table rows Check this for seeing the rows rendered. You can easily turn off the complete functionality by unchecking this. Path to Stylesheet Since the parts are unstyled by default, it is a good idea to define styles for them. All rendered templates are encapsulated in a div with the class "renderedLayout" so you can style them with: div.renderedLayout h2{ color: green; } The path is to be set relative to your templates' folder. Reset Admin CSS Since the parts are rendered inside the Admin, common styles of the Admin Interface apply also to your layout parts. This is not a bad thing, because especially text styles are well integrated in your admin's theme. But if you like to override the admin styles in your table rows completely (more or less), just check this box. Don't forget to define a custom CSS then! Advanced Since this module is meant for parts of your layout you already have defined for your frontend templates, it is a good idea to use a preprocessor like Stylus, Sass or Less for building the custom CSS file. Just outsource your layout part definitions in an extra file, compile that in a separete CSS file and use this as custom CSS for this module. Since your CSS is should be built in a modular way, this works pretty well ;-) Will write a tutorial with a use case once finished testing. Notes: Github: https://github.com/MadeMyDay/PageTableExtended If you want to get rid of the unnecessary step for entering a title before editing the page, just set the "autoformat" value as suggested in the PageTable settings. If you don't want to use a title field at all, see this post from Soma Will put it in the module repository once finished testing. Please test it and give feedback. I haven't used GitHub for a long time, please check if everything is in place and if this will work with the modules manager and the new core module installer once added to the repository. Have fun Module is in the repository now: http://modules.processwire.com/modules/fieldtype-page-table-extended/ Please use GitHub for instructions, I made some additions there.
    1 point
  8. I never tried Forward, but ngrok works great with login in the backend https://ngrok.com/
    1 point
  9. @felix and everyone I have made some initial adjustments to make this module more versatile. It now has two config fields for setting up the JS video player of your choice and the player template code. By default it comes configured to use MediaElementJS, but you can easily change to VideoJS, JW Player, Plyr.io or whatever you prefer. Once configured all you need to do is: echo $page->video->play; With the default setup, you only need to upload an MP4 and it will work on all browsers/devices. I might potentially make it possible to also upload a WebM version so that you can play with HTML5 in all browsers/devices without the need for a fallback flash player on FF/Chrome, but I'll see if people really have a need for this. I would still like to make several refinements, but if anyone tests this version, please let me know how it goes.
    1 point
  10. In PW settings - languages - your lang - select file for translation and give the module file.
    1 point
  11. Thanks for your help LostKobraKai and Martijn, now the value will be added to the parent page. For all others who are interested in this, here is the complete code snippet: public function init() { $this->addHookAfter('Pages::saved', $this, 'saved'); } public function saved($event) { $page = $event->arguments[0]; if($page->template == "productpricelistitem"){ //run the hook under this condition - page which will be edited $parent = $page->parent;//get the parent page $parent->offercheck = "5"; //example value to store in the parent page in the field with the name offercheck $parent->save("offercheck"); //save the parent page } } If you use a pagetable field as in my case, dont forget to reload the parent page if you want to see the value in the field. Best regards
    1 point
  12. That is where my question came from. Looking forward to trying this out soon. Nice work.
    1 point
  13. Sure thing - we never stop learning. Just a sidenote for everyone regarding the 500 errors. When a server error is returned, the plugin only alerts the user to the effect that they are told tha something went wrong. The reason can be determined by examining the request in the inspector. The plugin also has events for when the submit button is pressed (i.e. processing begins), when a response is received (i.e. processing finishes), and when a server error occurs. the simpleForms() method takes a configuration array, the defaults for which are: { interimButtonText: 'Just a moment...', serverErrorAlert: 'Something went wrong on the server, and so this form could not be submitted. The form has been left as-is so that you may leave it open and try again in a few minutes.', scrollTime: 500, onSubmitStart: function() {}, onSubmitEnd: function() {}, onServerError: null, } The methods do not take any arguments at present, but will do in the future. This will be handy when you want to use your own callbacks to display errors, dim out a form, show a processing message, etc. As mentioned before, more configuration options will become available over time.
    1 point
  14. Okay/ Was just curious. I'm here to learn as much as I can. Which at my age isn't easy.
    1 point
  15. I think you can do this $products = $pages->find("template=product, stock=1, sort=parent, sort=title");
    1 point
  16. Hey great call! Works like a charm... Thanks!
    1 point
  17. This might not be much help. A 'lag' in display effects is commonly a cache issue. The new visual effect would become permanent after the cache was updated, if this is indeed the case. An intermittent, i.e., alternating effect is puzzling. Does this occur in different browsers? I'm sure a more knowledgeable member will be along shortly.
    1 point
  18. Hi, Forum: https://processwire.com/talk/topic/5416-fixing-pw-install-in-a-latin1-database-should-have-been-utf-8/ https://processwire.com/talk/topic/2053-force-utf-8-encoding-for-pw/ https://processwire.com/talk/topic/1735-get-data-from-a-latin-1-encoded-db-and-insert-it-into-pw/ General: http://php.net/manual/en/function.utf8-encode.php#82210 Lots of inspirational solutions here: http://stackoverflow.com/questions/910793/detect-encoding-and-make-everything-utf-8 Or maybe this: https://github.com/neitanod/forceutf8
    1 point
  19. Hello, Me here. I work for a creative marketing agency and I have worked with so many CMS's I dare not count. But some of the leading ones include; Concrete5, Drupal, Joomla and WordPress. We almost always used WordPress over these other solutions. It meant for quicker development times, need a slider? Sure Revolution Slider has you covered. I went on to start building sites by just filling a header and footer in and building the rest in Visual Composer. Sure enough... I got lazy. Now we have over 30 websites running WordPress and they are all running out of date, the WordPress versions, the vast amount of plugins. Keeping WordPress up to date and secure is a job within itself. Then stuff like this starts happening: https://blog.sucuri.net/2014/09/slider-revolution-plugin-critical-vulnerability-being-exploited.html. I now when ever we have the budget for a custom build, use ProcessWire. If I found ProcessWire earlier, I may have never used WordPress for custom builds unless client requested. ProcessWire's API is one of the most powerful I have used and kicks WordPress's WP_Query ass and without a 3rd party plugin (ACF) WordPress is a pain in the backside. ProcessWire is now my one true love and I'm sure destiny brought us together, but I believe we are made for each other.
    1 point
  20. Am nearly done with the jQuery plugin side of things. Wil try and push this to GitHub tomorrow for those interested to test. Haven't started yet with form-rendering - let's just do this thing one step at a time.
    1 point
  21. @caribou I have also been thinking the same thing recently - that it would be nice to have a visual way to browse the Page field. After discovering the excellent "Page Field Edit Links " module (which I think was added to the core in 2.6.17??), I have been using the Page field to manage a shared collection of media assets (videos, images and documents). With the additional "Page Field Edit Links" module, it allows the users to search, add and edit media from the the shared collections without leaving the page. The only issue is that it's text search only - a thumbnail would be very useful here for searching, and then to show what was selected. Also an icon or a custom image would be nice to distinguish between different page templates (videos, images, documents etc,). The Select2 jquery plugin has some examples of this: https://select2.github.io/examples.html#templating If the Page field can be extended to include more custom content (like images and icons), I am thinking it might be a good solution for a simple "content block" type setup. I am currently using the PageTable field for a "content block" type setup - it works well, but it has some user experience issues that I think the Page field would avoid. @kongondo could you explain a bit more what you module does?
    1 point
  22. I just want to quickly add: If posting the url to this forum is the seo strategy and we won't hear back from you I'm going to remove the link in the entry posting.
    1 point
  23. Thx André. yep, both My initial need for this was to have a possibility for clients to mix different layout templates. PageTable does exactly that while keeping the flexibility of normal templates. So the functionality was there but for not so tech-savvy clients it was too less visual. They want to see what they create. So this module was born. It is now your decision if you want an exact 1:1 copy of the frontend which results in more work but a nicer Interface or if you just want them to keep track of their edits/additions. I use the module in three sites at the moment (not public yet but one is shown in the video above). I generally wouldn't promise a 1:1 view of the frontend because clients then tend to "style" the content by themselves. I have one client who always tries to fit the length of text lines in two columns. If the interface would kind of promise to be an 1:1 copy of the frontend (which it NEVER can be) it would be a false safety so I'd rather suggest to keep the layout model in this module but make no promises about exact styling.
    1 point
  24. CMSCritic just launched another part of the site which is a directory of CMS products (powered by ProcessWire of course). Hope you guys enjoy: http://www.cmscritic.com/dir/ While you are there, maybe click the "like" button for ProcessWire if you are so inclined.
    1 point
  25. Let that sink in. Ryan, I can't absorb the knowledge you share fast enough — thank you!
    1 point
×
×
  • Create New...