Jump to content

bernhard

Members
  • Posts

    6,221
  • Joined

  • Last visited

  • Days Won

    308

Everything posted by bernhard

  1. 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
  2. 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
  3. 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>
  4. looks great! can you also render the content of your field in frontend templates with code highlighting?
  5. 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...
  6. 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...
  7. 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
  8. 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"
  9. 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
  10. 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>
  11. 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...
  12. couldn't try it, because i got this error when i tried to install it Parse Error: syntax error, unexpected '[' (line 20 of /httpdocs/site/modules/FieldtypeFontIconPicker/FieldtypeFontIconPicker.module) pw 2.5.17
  13. hm.. you're right, those links would maybe feel strange beside the image - but i don't have those links in my setup. it just opens a modal to edit the item and that would totally be ok with a linked image in my opinion
  14. with the new dev 2.5.19 there is a problem with this module. i think it must have something to do with the new image handling with retina support: https://processwire.com/blog/posts/new-image-editing-features-2.5.19/ the image is double size on the "wow, that looks great" screen and also on the frontend when displaying via ->getThumb() nevertheless thank you for this great module!
  15. can anybody confirm that images don't display when you have them in the first column? v2.5.19
  16. thanks, didn't search it there because in the breadcrumbs it says "Home > Dev Dir" so i was guessing its a top-level item
  17. is it by intention that the directory is not linked anywhere on processwire.com ? or is it already and i can't find it? what about: "try the demo" - "download latest stable version" - "become/find a developer" still alone in my country btw
  18. hi ndolph, does this help you: http://www.flamingruby.com/blog/processwire-weekly-13/#1-2 https://processwire.com/talk/topic/4822-ckeditor-justify-plugin-walkthrough/
  19. nice overview on using/switching to ssl:
  20. that's true but will not be the case in my project. any better ideas for solving my usecase from the first post?
  21. i created a little module that does the trick, maybe it's helpful for anybody else: https://github.com/BernhardBaumrock/ProcessWireModules/blob/master/ClearCacheForDescendants.module does the "clear cache for children" option of procache clear only children pages or all the descendants?
  22. thanks for wireRenderFile until now i was doing this like it is done in the blog profile: https://github.com/ryancramerdesign/BlogProfile/blob/cca31ebb7ec10f7614044156161abe3042abbbed/templates/categories.php#L20 drawback was, that the api variables where not directly accessible in the template file ( wire('page') instead of $page ). is there any reason why the blog profile uses a different approach?
×
×
  • Create New...