Jump to content

clsource

Members
  • Posts

    374
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by clsource

  1. Hello, I was thinking that some modules use custom fields. The problem is that they could conflict with already existing fields on the site. example: you module wants to use a field named "category", but the site already stores a "category" field that has a different implementation, other field type, etc. The solution I think is simple, just add a prefix to the fields that the module uses. three letters and a underscore before the field name. example cls_category But its prettier to call "$module->category" than "$module->cls_category" This will be solved using a simple module just for hooks that is installed alongside our module. $wire->addHookProperty("Page(template=cls_mymodule)::category", function(HookEvent $event){ $page = $event->object; return $event->return = $page->cls_category; }); We are adding a property hook that simplifies the field name. This way it can be called like $module->category also the template names are prefixed. Please tell me if there are other ways thanks.
  2. I use the wire render pattern, and conditional outputing things in certain areas are easy to achieve. Sure there are other ways, but with that pattern I´m happy so far https://processwire.com/talk/topic/11646-the-wire-render-pattern/
  3. I think it will work since Processwire, ProCache and Padloper are already compatible. LiteSpeed and MariaDB are replacements for the Apache and MySQL they should work too. Just try them and please let us now how its going
  4. My menus work like this First create a "menu" template, a simple empty template that will hold "menu-item" pages as children. Then create the "menu-item" template that can hold 'menu-item' pages as children, fill it with these fields : - (title field) The title for the menu - (item field) A page reference (Single Page or NullPage) field that will link any page in the site except pages with menu or menu-item template. - (isExternalLink field) A checkbox that tells if the link is outside the site. - (externalLink field) a Textbox that holds the external url if the checkbox isExternalLink is active. You can add many additional fields depending on your needs, like css, js, or other information. When that is done just create a page named "Menu" with the "menu" template, later add children pages with the "menu-item" template. Now you have a menu that can be rendered like any other page in processwire. $menu = $pages->get('/menu'); foreach($menu->children as $menu_item) { if($menu_item->isExternalLink){ echo "{$menu_item->externalLink}"; } else { echo "{$menu_item->item->url}"; } } With this approach you can rely on the Processwire backend to give order to the items and create as many children and deep levels as you like
  5. It's easy $page->localUrl($user->language); $page->localHttpUrl($user->language); it will output the correct url that belongs to the user language
  6. would love to see latte in action.
  7. welcome! I know you will enjoy Processwire and its awesome community
  8. Thanks pal Yeah it´s similar to MVC but its not. Here´s a write up in spanish that explains (For Laravel) why not use MVC for web applications https://styde.net/porque-laravel-no-es-mvc-y-tu-deberias-olvidarte-de-mvc/ Basically tells you that MVC can´t cover all the use cases that happens when you create web applications. So you need a flexible approach and use whatever you need to accomplish the job. The Wire Render Pattern is flexible enough for you to arquitect a web structure easier to mantain and colaborate with other tools and ideas
  9. Awesome News. Please Write about how easy is creating multilanguage sites using processwire. I suggest taking themes from http://html5up.net/ and creating full sites with PW. Or making an ecommerce with www.padloper.pw Making custom field types and modules Using wireshell Oh lots of wonderful ideas Whish you the best of good energy!
  10. Thanks, maybe I should make a video so it´s more clear
  11. I´m currently translating to 2.7 https://github.com/NinjasCL/Processwire-Spanish based on this one https://github.com/LuisSantiago/Processwire-Spanish
  12. I´m a happy customer of padloper thanks for all your work apeisa
  13. Hello friends, I have been using the wireRenderFile() function a lot. Since the inclusion of the wireRenderFile() method I made all my websites using this pattern. This is a medium post that I made explaining it. https://medium.com/@clsource/the-wire-render-pattern-806bf6d6097a?source=featured---------1 All the files will be uploaded here https://github.com/NinjasCL/wire-render-pattern
  14. This is a helper class to using debug log. require_once 'Debug.php'; Debug::init(); Debug::log($myVar); Debug::log($myArray); <?php /** * Helps with the debugging log */ class Debug { protected static $name = 'debug'; public static function init() { if(!file_exists(self::filename())) { self::log('Debug File Init'); } } public static function log($param) { if (is_array($param)) { $param = json_encode($param); } wire('log')->save(self::$name, $param); } public static function filename() { return wire('log')->getFilename(self::$name); } public static function name() { return self::$name; } }
  15. I found this http://stackshare.io/processwire we should give processwire more likes and up votes
  16. thanks for the tip. I will look foward to otto
  17. If there is a need to have more than one _main.php I just create another one. Ex _main.php, _main_admin.php, _main_user.php _init.php $fileToRender = '_main_user'; config.php $config->prependedFile = '_init.php'; $config->appendedFile = '_main.php'; home.php (example template) if($user->isSuperuser()) { $fileToRender = '_main_admin'; } _main.php require_once '_header.php'; echo wireRenderFile($fileToRender); require_once '_footer.php';
  18. please take photos with the PW t shirt!! I wish you an awesome experience there!
  19. welcome aboard! I create the sites mainly with the delayed output aproach. and now using the useful function wireRenderFile() http://weekly.pw/issue/20/
  20. here ryan talks about session in site/config.php https://processwire.com/talk/topic/142-make-session-start-in-session-overridable-from-a-module/#entry1002 maybe this code could be put in config.php. session_name($config->sessionName); session_write_close();
  21. I created this helper nearly a year ago! (time passes very fast!). In the way I learned new tricks and Processwire also have many new things that could improve the rest helper. So that could be a really good idea.
  22. so a processwire day sounds good. could be a hangout? could be a tell a friend about processwire? could be make a cake with a big PW and candles for every year?
  23. maybe you could delete sessions using a cron. every x minutes delete sessions longer than y seconds.
  24. found a typo The Developer Directory contains a list of ProecssWire Developers with a variety of skills from around the world.
×
×
  • Create New...