Jump to content

bernhard

Members
  • Posts

    6,259
  • Joined

  • Last visited

  • Days Won

    312

Everything posted by bernhard

  1. i have problems cloning pages with pagetable field via api... i get the following error: Error: Exception: Can't save field from page 1039: /original-page-1/: Call $page->setOutputFormatting(false) before getting/setting values that will be modified and saved. [Page::statusCorrupted] fields: pagetable (in /var/www/html/wire/core/Pages.php line 1272) #0 [internal function]: Pages->___saveField(Object(Page), 'pagetable', Array) #1 /var/www/html/wire/core/Wire.php(366): call_user_func_array(Array, Array) #2 /var/www/html/wire/core/Wire.php(321): Wire->runHooks('saveField', Array) #3 /var/www/html/wire/core/Page.php(1272): Wire->__call('saveField', Array) #4 /var/www/html/wire/core/Page.php(1272): Pages->saveField(Object(Page), 'pagetable', Array) #5 /var/www/html/wire/modules/Fieldtype/FieldtypePageTable.module(216): Page->save('pagetable') #6 /var/www/html/wire/core/Wire.php(388): FieldtypePageTable->hookPagesCloned(Object(HookEvent)) #7 /var/www/html/wire/core/Wire.php(321): Wire->runHooks('cloned', Array) #8 /var/www/html/wire/core/Pages.php(1627): Wire->__call('cloned', Array) #9 /var/www/html/wire/c This error message was shown because you are logged in as a Superuser. Error has been logged. code used on a test-setup in "home" template (so $page = /home): $np = $pages->clone($pages->get('/original-page'), $page, false); $np->of(false); $np->title = 'New Page'; $np->name = 'newpage'; $np->save(); without the pagetable field everything works fine. using the ProcessPageClone module and clicking on "copy" also works fine! any help would be very appreciated I'm using dev 2.5.22 - though i don't think it is related to the pw version
  2. hi heldercervantes, welchome to the forum. regarding the listing part of your question: there is a commercial module that does your request very well: https://processwire.com/talk/store/category/9-listerpro/ regarding your 2nd part of the question: don't know exactly what you mean by "profile page". but overall it sounds a bit like you are thinking in a way like you would do it with another CMS... organizing your admin-interface in tabs and lists and so on. processwire is quite different on this part! you have everything organized in your pagetree. everything has its place there and if not really needed nowhere else! for example if you had a blog setup. in drumlapress you would have a tab "blog" anywhere in your admin and manage your blog-entries there. then you would have to setup a menu-item listing all your blog-entries. in processwire you would create a page "blog" in your tree, holding all of the blog-entries as children. home '- blog '- post1 '- post2 so if you or your client wanted to create a blog-entry you would just have to click on "blog" and then "new". in my experience this is much easier to understand for the clients than setting up articles and then linking them in the menu. of course in PW you would have to exclude all blog-posts from getting listed in the menu - but thats very easy by using a selector like "template!=blogitem" hope that helps a little i hope it is not offtopic but structuring your content is the key to success in PW
  3. maybe the problem is that the geocoder didn't find your address - try adding a space here: $page->map->address = $node->StrasseNr.", ".$node->Plz." ".$node->Ort; // use this $page->map->address = $node->StrasseNr.",".$node->Plz." ".$node->Ort; // instead of this of course use $page = $page->get( your page to edit ) instead of $page = new Page()
  4. never heard about the 5r/s limit - may be new, thanks for the hint... anyhow, never had any issues with it! but if anybody thinks he is violating google he could also use a free geocoding service (see example) i just tried <?php for ($i=1; $i <= 200; $i++) { $p = new Page(); $p->template = 'basic-page'; $p->parent = $pages->get('/'); // set parent to root $p->name = "Wagramer Strasse " . $i; $p->title = 'Wagramer Straße ' . $i; $p->map->address = 'Wagramer Straße ' . $i . ', Wien'; // populate the mapmarker field in basic-page template // optional: use any other geocoding service like mapquest should be very easy: // http://stackoverflow.com/questions/18661189/getting-data-from-json-using-mapquest-and-php $result = '...'; // then populate lat/lng manually $p->map->lat = $result->lat; $p->map->lng = $result->lng; $p->save(); } ?> and it worked without any problems. took some seconds of course... but if you only need to geocode the addresses once that should not be a problem. @iNoize how did you populate your address fields?
  5. thats not true, google maps geocoding api has a limit of 2.500 requests per day - so you are good here: https://developers.google.com/maps/documentation/geocoding/?hl=de#Limits will come back with a possible solution later...
  6. i don't understand most of what you are talking about - BUT: i understand most of what i am doing with processwire thats what i love about processwire! you don't "see" things that you don't understand and therefore don't need to see. that starts with the admin-interface treeview and continues when you start looking to the file system and furthermore into the code. i just wanted to point out that for a non-professional coder like me these are really important benefits! i like the way PW addresses also beginners and at the same time makes it possible to dig deeper into it if you want to and if you are ready! not before. that said from someone who has created his first hooks some days ago ps: of course i also love discussions like this one on the forum reading about things that i can maybe think of some day.....
  7. thanks - a pity that i didn't google for "weird UI display glitches (with screenshot)"
  8. you are absolutely right - how did you find this out? any way of debugging such things?
  9. i have the same problem here: http://scw.zwergo.net/verein/sportplatz/ i think it comes from one of the jquery plugins but no time at the moment for further research...
  10. meanwhile there's already an option in the htaccess: https://github.com/ryancramerdesign/ProcessWire/blob/master/htaccess.txt#L133
  11. @horst you can add such functionality to your map via google maps api. https://developers.google.com/maps/documentation/javascript/examples/infowindow-simple @Mats nice! @awebcreature i have no experience with this using google maps but using openlayers. of course that's quite a beast regarding complexity and file size - here you have an example: http://openlayers.org/en/v3.2.1/examples/draw-and-modify-features.html. you can also achieve that with the simpler framework leaflet - there are plenty of plugins like this one you would need I'm thinking to create such a module for my master thesis - but you are 2 years early, sorry maybe you find some helpful code in my processwire mapping project "geowire": http://geowire.org/
  12. sorry, no experience in using PW api outside of PW, but i bet being more precise on that I get an error. would increase your chances of good answers
  13. bernhard

    Regexp Help!

    just found another great tool with very different approach! look at this example of a regex to find emails: ^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$ http://ysono.github.io/pegrex/#47%2C%5E(%5Ba-z0-9_%5C.-%5D%2B)%40(%5B%5Cda-z%5C.-%5D%2B)%5C.(%5Ba-z%5C.%5D%7B2%2C6%7D)%24 to be honest i don't understand the tool at the bottom, but i love the graphical mockup of the regex
  14. i'm not sure if i understand your questions correctly... do you mean something like this? $items = $page->children('limit=10'); foreach($items as $item) { echo '<h1>' . $item->title . '</h1>'; echo $item->body; echo $item->whatsoever; } echo $items->renderPager(); is this question related to your first question? are you looking for truncating text?? https://processwire.com/talk/topic/2849-text-output-limiter/?p=71561
  15. bernhard

    Regexp Help!

    besides regex101 i found also this tool helpful: http://regex.larsolavtorvik.com/ live result for preg_match_all, preg_match, preg_replace, preg_split and copypaste-ready codeline
  16. of course, but i thought maybe there's a simple way to take use of the code highlighting that comes with this module. something like $ace = $modules->get('ace...'); <script src="<?= $ace->gethighlightjs() ?>"></script> <div class="php"> <?= $page->phpcode ?> </div>
  17. looks great! can you also render the content of your field in frontend templates with code highlighting?
  18. thanks arjen - i like the idea of showing a team history to every player and (as almost always) this would be very simple with PW and the approach above i'm only thinking of how to identify the players exactly because when cloning the pages i don't like identifying them by ->find('name=xy') as there could be players with the same name. maybe i'll create an additional field name+birthday or just use any unique hash...
  19. I've already done locking pages via api, thank you - at least this will be no problem thanks also for the link regarding forms! should be able to try this next week...
  20. thank you! seems like cloning all data to an archive and updating all references would be a good option. and i think that will be a good usecase for my first processmodule - i'll try to achieve this with the help of process hello
  21. thank you for your reply. could you please go a little bit more in detail on this? "archive process - not only cloned but also updated"
  22. i'll be building a site for a sportsclub very soon. there will be some players and some teams team a - player a - player b - player c team b - player a - player b - player xyz i wanted the players to be selectable via page-field so that changes to player a reflect to both teams a + b. so far so good - but the client asked for a way to archive data.... eg team a (2012, 2013, 2014...) so when i use pageclone to copy data to the archive there will always be the current picture + name + weight + height of all the players and that is not what the archive is meant to show. there should be a kind of history with "permalinks" any ideas how to approach this? maybe use pagecache and permanently save this file? but how to get the image+file data if there is an <img src="...assets...xy.jpg">? thanks in advance
  23. I'm using this function to load the addons together with the great AIOM module /** * loads css and javascript files by name of component from different css frameworks * * @param string component | name of component * @param string framework | name of framework, defaults to uikit * */ function styleAddon($component = '', $framework = 'uikit') { $min = '.min'; // you can set this empty for debugging switch ($framework) { case 'semanticui': // add css if it exists $cssFile = 'semanticui/components/'.$component.$min.'.css'; if(is_file($cssFile)) wire('config')->cssFiles->add($cssFile); // add js if it exists $jsFile = 'semanticui/components/'.$component.$min.'.js'; if(is_file($jsFile)) wire('config')->jsFiles_head->add($jsFile); break; default: // add css if it exists $cssFile = 'uikit/css/components/'.$component.$min.'.css'; if(is_file($cssFile)) wire('config')->cssFiles->add($cssFile); debug('added ' . $cssFile); // add js if it exists $jsFile = 'uikit/js/components/'.$component.$min.'.js'; if(is_file($jsFile)) wire('config')->jsFiles_head->add($jsFile); debug('added ' . $jsFile); break; } } /** * converts the style/script object to an array * * @param string component | name of component * @param string framework | name of framework, defaults to uikit * */ function toArray($obj) { $arr = array(); foreach ($obj as $key => $value) { $arr[] = $value; } return $arr; } /** * log value to javascript console * * @param string text | error message * */ function debug ($data) { // show debug only in debug mode if(!wire('config')->debug) return; echo "<script>\r\n//<![CDATA[\r\nif(!console){var console={log:function(){}}}"; $output = explode("\n", print_r($data, true)); foreach ($output as $line) { if (trim($line)) { $line = addslashes($line); echo "console.log(\"{$line}\");"; } } echo "\r\n//]]>\r\n</script>"; } of course you can remove all the debugging... i found it in the forum and for me it was helpful then in your main markup file: // stylesheets and javascripts $config->cssFiles = new FilenameArray(); // javascript files $config->jsFiles_head = new FilenameArray(); $config->cssFiles->add('uikit/less/themes/default/uikit.less'); // you can use the css version of course styleAddon('lightbox'); styleAddon('slidenav'); styleAddon('dotnav'); styleAddon('slideshow'); styleAddon('notify'); styleAddon('sticky'); // convert css/js object to array for all-in-one-minify-module $cssFiles = toArray($config->cssFiles); $jsFiles_head = toArray($config->jsFiles_head); ?> <!-- load css and javascripts --> <link rel="stylesheet" href="<?php echo AIOM::CSS( $cssFiles ); ?>"> <script src="<?php echo AIOM::JS( $jsFiles_head ); ?>"></script>
  24. ok, this issue comes from the array notation! $array = array($foo, $bar); // is ok $array = [$foo, $bar]; // only php version 5.4+ had this issue today with a different module so i thought it was not specific to this module and did some research...
×
×
  • Create New...