Jump to content

hellomoto

Members
  • Posts

    333
  • Joined

Posts posted by hellomoto

  1. I installed this on the latest dev PW version and didn't touch any CSS for it; enabled it for a CKEditor field (and plain textarea without CKEditor); tried YouTube, Vimeo, and SoundCloud URLs and they all just output the URLs wrapped in plain <p/> tag(s).

    What am I missing?

  2. 	function customPageSaver(HookEvent $hook) {
    	 	$page = $hook->arguments(0);
    	 	if ($page->template->name == 'event_instance' && $page->id !== 0) {
    			$page->setOutputFormatting(false);
    			$page->name = wire()->sanitizer->pageName(wireDate('Y-m-d', $page->date));
    
    			if ($page->time_end < $page->time_start) {
    				$hook->message('End AFTER starting.');
    				$page->time_end = '';
    			}
    	 	}
    	}
        $this->addHookAfter('Pages::saveReady(template=event_instance)', null, 'customPageSaver');

    -- site/ready.php

    Can I set the $page->time_end to its previous value, rather than ''? I think I've done that before but forget how.

  3. On the frontend template I have this in an edit form:

        $field = $modules->get("InputfieldCheckbox");
        $field->label = "Discard";
        $field->attr('id+name', 'prop_discard');
        if($page->discard == 1) $field->attr("checked");
        $proform->append($field);

    Because $field->value = $page->discard does not work, nor does anything else I've tried. How do I get the checkbox to reflect if it is checked? Right now on save if it was checked it needs to be re-checked every time.

  4.  

    DDEV is another Docker-based open-source platform.

    I've worked on Mac with AMPPS, but when my computer crashed and I got another one and installed it would download strange image files (mostly [faux?] logos) to my computer until I turned off the wifi...

    Valet+ Valet fork has PHP version switching & extensions, toggle Xdebug, optimized MySQL (?), Redis, & Elasticsearch.

    You can set up a simple development VM but Homestead is already all belled and whistled. It runs PW perfectly out of the box via nginx (or Apache but I had to install it). Scotch Box is a less extensive Vagrant box.

    By the way: Running Vagrant + VirtualBox from an External Drive

    Also v.je: Arch-based minimal 75mb Vagrant box for web dev. well configured, no provisioning, stripped of Pacman.

  5. I know you can include the API for a PW install elsewhere by including its index.php file, but what about when you have a PW /site and then a /site-something directory with another one where you want to query pages from the /site ? I guess REST would be one way but is there any way to bootstrap the other site's data directly via the PW API, like its $wire or $pages assigned to some variable?

  6. On 3/5/2020 at 6:02 PM, gebeer said:

    You can have a site/config-dev.php with all config for your local dev environment. If this file exists, all config values will be pulled from it instead of site/config.php. This is the common PW-way of having separate configs for live and development environments. This info can be found on this page in the docs at the very bottom.

    I never knew, but I prefer my way: I keep config.php and then will have a config.dev.php and/or config.www.php and require whichever is appropriate via a switch conditional in config.php depending on the hostname. So in config.dev.php debug is true, and both have their respective DB credentials, and any other variations can be specified/distributed very easily and cleanly this way without repetition.

  7. Routing I have in mind like it's done in Laravel; that seems like it would be simple to even convert to, again maybe just via a module so people could just work with the original way it's been done; then every template (e.g., in said hypothetical module) could be a "model". Maybe templates on templates is too far-reaching... could basically be done with showIf etc. and the demand probably is not nearly high enough for such a feature. So that's off-topic for now.

  8. 32 minutes ago, teppo said:

    I think when you say "model" you probably mean something a little different than what it means to me personally. In my mind models are tied to data structure, have very little to do with routing, and so on. In fact from what I could gather from your examples it looks like such models would indeed be a lot like custom post types in WordPress in that they'd be located in a single "bucket" and define a per-model route that's separate from the regular page tree structure.

    Hey! No I think we're thinking of models the same; I didn't mean to imply that they would be tied to their routes, as the templates (basically) are in PW. I do mean models entirely separate from routing, thereby allowing for routes to be specified as needed and totally custom.

    The ways you mention with parent pages and URL segments I've tried, but still don't prefer totally overall, all the time... Yes, define routes abstracted. For example for a car sales website... which could totally be done in PW as-is, but for one thing I would not really want the listings to even be in the tree view in the admin...

    Maybe it could just be a module that would allow for creating templates and admin views of pages (?) outside of the page tree that then can be controlled and moved around (?) more easily (?) in views for those within the tree. That's probably just fine.

    Sorry this is a really rough idea. I don't believe I'm making it any clearer. Apologies.

    • Like 2
  9. Maybe models could be implemented somehow as like floaters with a routing setup separate from the regular hierarchy, or an option on install, or something... or a total switch over that can easily be used as in the regular page tree hierarchy way... but also otherwise...

    But situations like this

    Maybe there is a solution to this as-is but it would just be simpler going the model & route route ?

    Just an idea

  10. I love PW but there are certainly cases/times when I wish that templates were models (or mutants or something whatever you want to call them) instead, rather than necessarily hierarchical in the admin and routing. I have not been practicing much lately unfortunately, just reading more, so I wish I could implement this as an option for the PW community but I am not quite there right now...

    I have read a little bit into @teppo's Wireframe, which is interesting, but does not implement the model component ("ProcessWire is the model"), more so the view-controller. The approach PW takes in terms of content management structuring and development (from a database viewpoint) seems awesomely scalable and modularly distributed (not sure if I'm using all the right language here but you probably know what I mean), and I just think that the single major aspect missing is the ability to organize routes and content sans tree structure.

    The new template models could also have templates themselves... In WordPress for example, pages and posts/post types (I believe it's been a while) can have templates per, to change their content/formats however slightly or much, while remaining an object of the particular "model" (post type).

    Agreements and/or arguments?

  11. Instead of messing with all that I just installed PW fresh and imported the DB (I FOUND A DUMP) and copied in the relevant files. FOUND A DUMP.?

    But so now I'm doing that again with another site, and on the Pages page under the Admin I get an alert that just says, "Unknown error, please try again later" and no pages load. The Find/lister and Recent pages don't seem to have a problem, but after some time spent on the page the same alert pops up. 

    Also some modules when I try to check for updates notify "ProcessModule: Error reported by web service: That module is not currently tracked by the modules directory" and that same alert will then pop up, modules that [are not in PW DB online] in the Debug Mode Tools under Autoload say "Unable to locate file for this class" (Debugger itself? is included among those, as well as Admin index Pages subpages).

  12. This is a long shot I'm sure, but I converted a site backup database from MyISAM files to SQL via RebaseData's PHP API and am getting this response attempting to access the site now:

    Fatal error: Exception: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #4 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'boo_pw.pages.parent_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by (in /Users/boo/WWW/booa/wire/core/WireDatabasePDO.php line 390) #0 /Users/boo/WWW/booa/wire/core/WireDatabasePDO.php(390): PDOStatement->execute() #1 /Users/boo/WWW/booa/wire/core/PagesLoader.php(600): ProcessWire\WireDatabasePDO->execute(Object(PDOStatement)) #2 /Users/boo/WWW/booa/wire/core/Pages.php(154): ProcessWire\PagesLoader->getById(Array) #3 /Users/boo/WWW/booa/wire/core/ProcessWire.php(335): ProcessWire\Pages->init() #4 /Users/boo/WWW/booa/wire/core/ProcessWire.php(295): ProcessWire\ProcessWire->initVar('pages', Object(ProcessWire\Pages)) #5 /Users/boo/WWW/booa/wire/core/ProcessWire.php(118): ProcessWire\ProcessWire->load(Object(ProcessWire\Config)) #6 /Users/boo/WWW/booa/index.php(52): ProcessWire\ProcessWire->__const in /Users/boo/WWW/booa/index.php on line 64
    Error: Exception: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #4 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'boo_pw.pages.parent_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by (in /Users/boo/WWW/booa/wire/core/WireDatabasePDO.php line 390)
    
    #0 /Users/boo/WWW/booa/wire/core/WireDatabasePDO.php(390): PDOStatement->execute()
    #1 /Users/boo/WWW/booa/wire/core/PagesLoader.php(600): ProcessWire\WireDatabasePDO->execute(Object(PDOStatement))
    #2 /Users/boo/WWW/booa/wire/core/Pages.php(154): ProcessWire\PagesLoader->getById(Array)
    #3 /Users/boo/WWW/booa/wire/core/ProcessWire.php(335): ProcessWire\Pages->init()
    #4 /Users/boo/WWW/booa/wire/core/ProcessWire.php(295): ProcessWire\ProcessWire->initVar('pages', Object(ProcessWire\Pages))
    #5 /Users/boo/WWW/booa/wire/core/ProcessWire.php(118): ProcessWire\ProcessWire->load(Object(ProcessWire\Config))
    #6 /Users/boo/WWW/booa/index.php(52): ProcessWire\ProcessWire->__const
    
    This error message was shown because: site is in debug mode. ($config->debug = true; => /site/config.php). Error has been logged.

    Can anyone tell me what this means?
    greater detail: https://stackoverflow.com/questions/60332198/site-migration-database-recovery-attempt-from-files-on-crashed-computer

  13. Uploading via the default file field when the size is on the larger side (like a song 374 MB; sorry to be so vague) seemingly very often freezes at 100%, never quite turning over, so I end up having to manually upload the file to the page assets dir. and update page field values in the database.

    Ring a bell for anybody? Any success in resolving this if so?

    It's much time lost. I don't work on live sites much, but from what I can recall this is true also in production.

    Thanks friends

  14. All good sorry I'm burnt out. Please grant me the ability to delete my own posts, for the sake of us all, and I promise to be more careful hereon anyhow.

      public function hookAfterPageRender($event) {
        $page = $event->object;
        if (strpos($page->template->tags, 'crm') === false) return;
        $event->return = str_replace(
          '</head>',
          enqueuess(['crm' => $this->wire('config')->urls->templates.'css/crm.css']).'</head>',
          $event->return
        );
      }

     

  15. I was working on this:

    class PWCRM extends WireData implements Module {
      public static function getModuleInfo() {
              return array(
                      'title' => 'Client Relationship Management',
                      'version' => .001,
                      'singular' => true,
                      'autoload' => true
              );
      }
    
      public function init() {}
    
      public function ready() {
        $this->pages->addHookBefore('render', $this, 'accessHook');
        $this->pages->addHookAfter('render', $this, 'hookAfterPageRender');
      }
    
      public function accessHook(HookEvent $event) {
        $page = $this->wire('page');
        if (!strpos($page->template->tags, 'crm')) return;
        if (!$this->wire('user')->hasRole('crm')) $this->wire('session')->redirect($this->wire('config')->urls->login);//throw new Wire404Exception();
      }
    
      public function hookAfterPageRender(HookEvent $event) {
        $page = $event->object;
        echo $page->template->tags;
        if (!strpos($page->template->tags, 'crm')) return;
        echo $this->wire('config')->urls->templates;
        include_once($this->wire('config')->urls->templates.'functions.inc');
        $pagehtml = $event->return;
        $pagehtml = str_replace(
          '</head>',
          '<link id="css_crm" rel="stylesheet" href="'.$this->wire('config')->urls->templates.'css/crm.css">
          </head>',
    	  $pagehtml
    	);
        $event->return = $pagehtml;
        //$event->replace = true;
      }
    }

    I have tried placing the hooks into the init() function, and more... Neither method is effective. The echoes now output, but no redirection (although I have the access settings for the top-level template for this set to render a 404 for underprivileged users, which it does, overriding this, but nonetheless this should work aside from that.

    Then I wrote this up quick:

    <?php namespace ProcessWire;
    
    class MaintenanceMode extends WireData implements Module {
      public static function getModuleInfo() {
        return array(
            'title' => 'Maintenance Mode',
            'version' => 1,
            'summary' => 'Disables the website frontend for non-superusers.',
            'singular' => true,
            'autoload' => true,
            'permanent' => false
        );
      }
    
      public function init() {
        $this->addHookBefore('Page::render', $this, 'displayDecide');
      }
    
      public function displayDecide($event) {
        $page = $event->object;
        if ($page->template == 'admin' || $this->wire('user')->hasRole('superuser')) return;
        // replace the method hooked
        $event->replace = true;
        $event->return = "Patience please while we undergo some brief maintenance work.";
      }
    
    }

    which likewise avails nothing. What the hell is my problem here????:'(:angry: 

  16. Hey how do I get started? What I did was copy all the template files into my existing project and follow the instructions given for the templates setup. Then I deleted the homepage calls for a stylesheet and javascripts that don't exist (in client/dist/) and added vue.js... I'm totally new to vue.js so please excuse my ignorance and if you can give me any tips on how to begin I would deeply appreciate it... I know I'm being awfully vague... How can I pass all the pages to a vue instance to build a navigation, for starters? or should I just do that with PHP? 

×
×
  • Create New...