Jump to content

SiNNuT

PW-Moderators
  • Posts

    1,011
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by SiNNuT

  1. If there are only 60 pages i find it strange that it would take more than 6 seconds to get a couple of random pages. It's also funny that your limit 100 is larger than the actual number of pages, but it is twelve times faster (500ms versus 6 seconds) when you put the limit the selector. I'm not sure what is going on here. Apart from that, as LostKobrakai said, when getting random pages from a large number of pages the sort=random is preferable. However, when you would get into a really big number of pages even that would probably become slow. (i've done some simple tests in the past: https://processwire.com/talk/topic/8626-multiple-random-ads/?p=83345 )
  2. I don't understand, what would that fieldtype have to offer instead of a regular textarea field? Like Macrura said, you can use PHP's eval() construct in the template file to run any PHP code you typed in that field in the admin area. If you're aware of the potential for disaster this is the way to add code via a field in the admin. Example here: https://processwire.com/talk/topic/10873-which-field-to-use-for-custom-codemarkup/
  3. Just had a quick look on my phone. Looking really slick and easy to use. Well done. PS on your own site the 'vacatures' banner covers the menu when i open it via the hamburger.
  4. Also, i think your foreach structure might be wrong.
  5. Thanks Willy, That took care of the fatal error. However i seem to be having a bad day doing simple stuff. Instead of just 9 pages it creates 18 pages, 9 without ending digit and then the same 9 with an ending digit. Somehow the file is being processed twice, or pages being created with a couple seconds in between? I checked and double checked that i only visited the page on the front end once...
  6. Because i could not get ImportPagesCSV to work on 3.0.8 i decided to try a snippet that worked in the past. The following code resides in a template file. I tried with and without the namespace. <?php namespace ProcessWire; $template = wire('templates')->get("category"); $parent = wire('pages')->get("/categories/"); $numImported = 0; if (($handle = fopen("./categories.tsv", "r")) !== FALSE) { while (($data = fgetcsv($handle, 0, "\t")) !== FALSE) { // create the page and set template and parent $np = new Page(); $np->template = $template; $np->parent = $parent; // set the new page fields from the CSV list($nptitle) = $data; $np->title = $nptitle; // set the URL name automatically $np->name = $nptitle; // save the new page $np->save(); $numImported++; echo "Created page: {$np->url}\n"; } echo $numImported; } But no matter what i do i get a fatal error because of Integrity constraint violation: 1062 Duplicate entry: Fatal error: Exception: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'specials-1052' for key 'name_parent_id' (in C:\UniServerZ\vhosts\thvdw\wire\core\WireDatabasePDO.php line 233) #0 C:\UniServerZ\vhosts\thvdw\wire\core\WireDatabasePDO.php(233): PDOStatement->execute() #1 C:\UniServerZ\vhosts\thvdw\wire\core\PagesEditor.php(573): ProcessWire\WireDatabasePDO->execute(Object(PDOStatement)) #2 C:\UniServerZ\vhosts\thvdw\wire\core\PagesEditor.php(467): ProcessWire\PagesEditor->savePageQuery(Object(ProcessWire\Page), Array) #3 C:\UniServerZ\vhosts\thvdw\wire\core\Pages.php(237): ProcessWire\PagesEditor->save(Object(ProcessWire\Page), Array) #4 [internal function]: ProcessWire\Pages->___save(Object(ProcessWire\Page), Array) #5 C:\UniServerZ\vhosts\thvdw\wire\core\Wire.php(303): call_user_func_array(Array, Array) #6 C:\UniServerZ\vhosts\thvdw\wire\core\WireHooks.php(555): ProcessWire\Wire->_callMethod('___save', Array) #7 C:\UniServerZ\vhosts\thvdw\wire\core\Wire.php(327): ProcessWire\WireHooks->runHoo in C:\UniServerZ\vhosts\thvdw\index.php on line 64 Thing is that despite the fatal error the pages do get created. I'm using very simple testdata. Just echoing out the tsv values works fine. categories.tsv: specials beefburgers lamb burgers veggie burgers burger complete on the side dessert cold drinks hot drinks Anyone see any obvious mistakes in my code?
  7. Has anyone used this module on 3.X branch? Using 3.0.8 i'm getting stuck on the 'Step 2' screen. It does not seem to grab the fields from the template i want to use for the pages to import. In the screenshot 'menu-item', but i've tried in a number of ways and different parents but no luck. I'm not getting any errors or anything but i get empty field dropdowns. I'm aware that the module does not yet indicate compatibility with 3.X but most 2.X modules i tried worked fine with 3.X. Edit: for (cross)reference, a Github issue has also been made about this by another user. https://github.com/ryancramerdesign/ImportPagesCSV/issues/12
  8. Nice. Funny that there is a regex example that seems to do what ts wants. <?php // render the first found paragraph only if(preg_match('!(<p>.+?</p>)!', $value, $matches)) { echo $matches[1]; } Regex is basically voodoo to me so i don't quite understand the exclamation marks but i'm sure Ryan has a better grasp
  9. @pwired Your issues seem different than Juergen's. In your case it might be a problem with the FileCompiler, which is new in PW3, looking for or trying to create certain files in site/assets/cache/FileCompiler/ It could be that the upgrade process from 2.X to 3.X does not take this into consideration.
  10. I see Ryan already pushed a fix on Github ::thumbsup::
  11. Quite surprising to see these comments on a quite old thread, with some talented devs. XDEBUG is also known for throwing max nesting level errors, which will popup sooner than later.
  12. Ah, i see Pete. Can't argue with you there Although, @work we still have Windows 7 without too much problems.
  13. It does kinda specify OS: So for the aforementioned OS's, IE 11 is the only supported version. If you want to support <Windows 7 it goes from IE 9 to IE 8 and then IE 6(if you need to support Win2000 ).
  14. Well, Internet Explorer 11 runs fine on Windows 7, 8, 8.1 and 10. It's not that they are pushing the Edge browser, which is only available on Win10. I'm not saying that Microsoft isn't pushing Windows 10 but this news is not part of that.
  15. As said in other replies, you can feed a pageArray. More info here: http://cheatsheet.processwire.com/page/built-in-fields-reference/page-next/
  16. https://www.microsoft.com/en-us/WindowsForBusiness/End-of-IE-support This is good news! It will probably be a while before you can drop support for older IE versions in new projects but imo this will definitely help things to move in the right direction. At work we are still on Win7 and IE10. I already got notifications on some sites/webapps that Microsoft has stopped support and that we should upgrade to 11.
  17. Could you elaborate a bit? Because I read it as if you want to check if a page has a (certain?) parent? if ($page->parentID == 0) echo "no parent";
  18. https://github.com/ryancramerdesign/ProcessWire/tree/devns And also the weekly blogposts detail most new stuff: http://processwire.com/blog/
  19. Glad that that worked out dave. To be honest i find it pretty strange that your hoster was not able to solve this, even worse they tried putting a php.ini in your root themselves. Shouldn't they know how their stuff is configured? It's not related to PW as far as i can tell.
  20. @Tom it looks like the server is cgi/fastcgi so i don't think you can do php value in htaccess, this will also cause 500 errors.
  21. Have you instead of php.ini tried putting the settings in a file called .user.ini placed in your public_html? I mention this because i see a reference to this in the phpinfo().
  22. @Martijn Keep in mind that flexbox has more uses than just grids. Some argue that you shouldn't even use flexbox for overall page layout. Float or inline-block grids work fine for the most part and in the future the native css grid module will be the go-to solution. But flexbox has its own uses.
  23. I just found this flexbox polyfill. It hasn't been around for very long. This will enable you to use flexbox in projects where IE8 and/or IE9 support is required. Looks promising. https://github.com/10up/flexibility
  24. It's been a while but i've used Gulp for the basic stuff: watch source files (css, less, scss, js) for changes run preprocessors or postcss concatenate and minify run autoprefixer revision asset filenames for cachebusting I never got further then copy/pasting from the web and then adjusting to my needs but you can get a lot done this way. Gulp can do almost everything you can dream of but i would identify what tasks need automating the most, spend an hour/couple of hours and get to work.
×
×
  • Create New...