Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

1 Neutral

About derixithy

  • Rank
    Jr. Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I just installed the module, but everytime i add an application i get an SQL error. The application could not be saved: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for column `planner`.`appapi_applications`.`default_application` at row 1
  2. I had this exact same problem trying to save multiple repeater pages and came here from Google. I know it is listed in the docs (i didn't read correctly) but i will add the answer here for any future googlers. Taken directly from the docs. $building = $page->buildings->getNew(); $building->title = 'One Atlantic Center'; $building->feet_high = 880; $building->num_floors = 50; $building->year_built = 1997; $building->save(); $page->buildings->add($building); $page->save(); When creating a new repeater page you need to save it and add it to the repeater field on the page and then save to page. With hindsight it's pretty obvious but i wasted way to much time wrapping my head around it.
  3. Inspired by this i whipped up something. class element { protected $element = null; protected $attributes = []; function __construct( string $element ) { $this->element = $element; } public function attribute(string $key, ?string $value = null, ?bool $replace = false) { if ( empty($value) ) return empty( $attributes[$key] ) ? null : $attributes[$key]; if ($replace or empty($attributes[$key])) { $this->attributes[$key] = $value; } else { $this->attributes[$key] .= $value; } return $this; } public function attributes(array $items, ?bool $replace = false) { foreach ($items as $key => $value) { self::attribute($key, $value, $replace); } return $this; } public function class(?string $value = null, ?bool $replace = false) { return self::attribute('class', $value, $replace); } public function id (?string $value = null, ?bool $replace = false) { return self::attribute('id', $value, $replace); } public function content( $content ) { $content = $this->start().$content.$this->end(); return $content; } public function start() { $attribute_string = self::generate($this->attributes, true); $element = $this->element; $content = "<{$element}{$attribute_string}>"; return $content; } public function end() { $element = $this->element; $content = "</{$element}>"; return $content; } public function closing() { $attribute_string = self::generate($this->attributes, true); $element = $this->element; $content = "<{$element}{$attribute_string} />"; return $content; } protected function generate( array $attributes, bool $leading_space = false ): string { $attr_string = ''; foreach ($attributes as $attr => $val) { if (is_bool($val)) { if ($val) { $attr_string .= " $attr"; } } else { $attr_string .= ' ' . $attr . '="' . $val . '"'; } } if (!$leading_space) { $attr_string = ltrim($attr_string, ' '); } return $attr_string; } } function element( string $element ) { return new element( $element ); } I haven't tested it much but should be usable. // example usage -- not tested! $navelement = element('li')->class('navitem'); $navitems = pages('/')->and(pages('/')->children()) echo element('ul')->content( $navitems->each( $navelement->content('{title}') ); // or echo element('ul')->start(); foreach($navitems as $item) { echo $navelement->content($item->title); } echo element('ul')->end();
  4. I commented out the wire cache during testing (by commenting out the code), so no problem there. Thanks for letting me know the filecompiler stuff is unnecessary, i already namespace my files so it's only needed for modules. I already gave up on the cache problem. edit: grasping at straws
  5. You where right LostKobrakai, I was to stubborn to really listen and take advantage of your advice. Reading up about it the first time made it seem like it would work fine in my case, bringing it in to practice was a whole other thing. Saving pages to cache resulted in returning only id's after saving and sometimes a piece of code worked but a minute later it didn't, so i got really frustrated and just gave up after a while. I took a fresh look a few days later and I could fix the id problem (LazyLoading) by using $pages->findOne instead of $pages->get. Also i noticed pages where being cached somehow even if i turn it off by using // FileCompiler=0 in the top of the file, or using the following in config.php $config->debug = true; if ( $config->debug == true ) { $config->fileCompilerOptions = array( 'siteOnly' => false, 'showNotices' => true, 'logNotices' => false, 'exclusions' => array('php', 'phtml'), 'extensions' => array('php', 'module', 'inc', 'phtml'), ); $config->dbCache = false; $config->moduleCompile = true; $config->templateCompile = false; } Strangely the error page show's the updated code but still thinks there is an error. http://i.imgur.com/Dx1B0x0.png So i'm sorry for my little outburst in the comment above. Although it seemed simpler to set the secondaryID in my mind, this solution is a whole lot more powerful.
  6. Markup cache is basically useless for me, i'm going to edit the Pagerender.module instead. Other suggestions are welcome
  7. The domains go to the same site/server. I wanted to avoid unnecessary complexity in my template code (i'm just a hobby programmer and more of a designer). Also it allows me to change it from the admin panel, which removes the necessity of re-uploading files. But i see that your route is a better way to go, then to wait for someone to help me with this niece case. Sorry for being a bit impatient with things. I can't sit long behind my desk and am long past my deadline, but that's my problem.
  8. Is there no one who can help with this? Am i asking something very difficult? It's probably not that helpfull for others, but it didn't look that hard to do. I just don't know how to do it. -edit: some text
  9. It seems that i need to set $cacheFile->setSecondaryID after Pagerender.module has set it so i don't affect page id's and translation. If someone know how to do this properly any help is much apreciated!
  10. I'm reusing pages depending on the url of the site and want to cache these pages. For example example.com/blog/1 and example.nl/blog/1 would use the same template but i'm extending the Page to limit the results depending on url. Is there a way that i can append a name to the cache name used to cache this page? It seems it should be easy to hook in the cache rending and change it but i could not find anything helpfull.
  11. I never got it fixed on that install, and i got it again on the latest dev version. Now i reread it i understand what went wrong. I added them as custom roles and did not select them from the predefined system roles list. I deleted them and selected the build in once. The problem is fixed now. Could someone tell me wat the difference is between selecting the builtin ones or create your own? -edit: spelling
  12. I tested with different users and different roles. The title looks correct to me because all user-admin-* roles give an error, if you know better let me know. The roles have each an user-admin-somerolename permission added. If i change the role to user-admin-all i get no error. if i change it to a specific role i get an sql error. The rolenames are correct because they are found 'roles=(roles=1018|1119)' but somehow it gives an error.
  13. When i add anything below user-admin-all, like user-admin-artist, i get an 'Syntax error or access violation' error on the userlist page in the admin. full error SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.id FROM `pages` JOIN field_roles AS field_roles1 ON field_roles1.pages_id' at line 9 No results are returned (not surprising). below that: template=3, parent=29, include=all, limit=25, status<9999999, id!=40, roles=(roles.count=1, roles=37), roles=(roles=1018|1119), sort=name I get that on any role with any custom permission. I don't know how to track down the error. I'm using ProcessWire 3.0.39, PHP 5.6.26 and MySQL 5.6.33 Solution Do not add the roles manually! Select the ones from the Install predefined system permissions list.
  • Create New...