Jump to content

Peter Troeger

Members
  • Posts

    67
  • Joined

  • Last visited

Everything posted by Peter Troeger

  1. Hi πŸ™‚ I was wondering whether it is possible to change displayed name of the 'name'-field that is used as login-name for users? I'm using an ID as the login-name and would like to have it displayed as 'ID-db' instead of 'name' in the dropdowns etc. When opening the 'users'-View, can I change the default columns that are displayed? atm it uses fields that are not very helpful, and changing them every time I open it (Access->Users) is very tedious. Thank you, any help is appreciated! πŸ™‚ - Peter
  2. Well, I have this in the sidebar: <?php $aktuelles = $pages->find('template=blog-post, limit=4'); foreach($aktuelles as $aktuell) { $aktuell_body = $aktuell->get('summary|body'); $aktuell_title = $aktuell->title; $aktuell_url = $aktuell->url; $cat = $pages->get('/'.$pages->get('id='.$aktuell->categories[0])->name.'/'); echo '<div> <div class="post"> <p class="date">'.$aktuell_title.'</p> <div class="text">'; $aktuell_body = strip_tags($aktuell_body, '<a><strong><em><i>'); echo truncate_words($aktuell_body, 22); echo '</div> </div>'; if($aktuell->categories!='') echo '<a href="'.$cat->url.'">'.__('Weitere Informationen unter ').$cat->title.'</a>'; echo '</div>'; } ?> and this is the main content with the pagination: <?php $children = $page->children('limit=3'); foreach($children as $child) { $title = $child->title; $url = $child->url; echo '<h2><a href="'.$url.'">'.$title.'</a></h2>'; $grandchildren = $child->children(); foreach($grandchildren as $grandchild) { $grandchild_title = $grandchild->title; $grandchild_body = $grandchild->body; $grandchild_date = $grandchild->date_freeform; echo '<section class="mitteilung veranstaltung"> <h3>'.$grandchild_title.'</h3> <p class="date"><em>'.$grandchild_date.'</em></p> <p>'.$grandchild_body.'</p> </section>'; } } ?> <?php echo $children->renderPager(); ?>
  3. Hello Community πŸ™‚ Has anyone ever tried having multiple elements on one page that get their info with $pages->find('selector, limit=n') and tried using pagination on one of these elements without effecting the other? I have a slider on a page where I display content with pagination. But when I go to page two, the slider content also goes to page two, which I don't want it to do πŸ™‚ Any tips are greatly appreciated! Thanks! -Peter
  4. Couldn't find out what the problem was, so I don't use uikit anymore πŸ™‚
  5. ok, I also removed the start=0, and now it works. Now I only have to find out, why it doesn't work when I use ukBlogPosts(pages()->get('/aktuelles/')->children, 1 ) and $children->renderPager(); on the same page πŸ™‚
  6. When I keep the uikit file, but remove the usage of uikit (I've had two instances af ukBlogPosts(pages()->get('/aktuelles/')->children, 1) included in the page), the redirect doesn't happen anymore either. The content still doesn't change πŸ™‚
  7. I found out that, if I remove uikit from my site, the page is not redirected, but stays on ' .parent-page/page2/ '. It doesn't show the content from page 2 though. It still shows page 1 content. This is the complete template page. <?php namespace ProcessWire; ?> <div id="body_text"> <?php $children = $page->children('start=0, limit=2'); foreach($children as $child) { $title = $child->title; $body = $child->body; $file = $child->file; $file_url = $file['url']; $image = $child->single_images; if ($file=='') $file='#'; ?> <section class="mitteilung"> <?php echo '<h2><a href="'.$file_url.'">'.$child->title.'</a></h2> <p>'.$body.'</p></section>'; } ?> <?php echo $children->renderPager(); ?> </div> In the init file I add the uikit file.
  8. Thanks for your reply! I have 32 child pages, and it generates the navigation correctly with multiple pages. I added a start, but that didn't change it. URL settings are set to blank for the default and pt for the second language. I tried changing the default to de, just in case but the problem still exists. debug is already enabled. No errors are logged. I only have menubuilder and the login/register plugin for sitewide modules installed. Could it have anything to do with PagePathHistory?
  9. Hello πŸ™‚ I have set up pagination on a mulitlanguage site. I've done this before, but this time I have a problem I can't solve. Pagination is activated on 'parent-template' and 'child-template' just to be sure πŸ™‚ This is my code: $children = $page->children('limit=1'); foreach($children as $child) { $title = $child->title; echo $title; } echo $children->renderPager(); The navigation is output correctly and the link look correct as well 'parent-page/page2/'. But when I click the link, the site seems to redirect back to 'parent-page/ Any help would be greatly appreciated πŸ™‚ - Peter
  10. Thank you for your help. That was not the problem, but it pointed me in the right direction. The problem was my stupidity πŸ˜„ I hat $config->sessionAllow = true; set in config. And while it didn't make a problem in 2.6., but it did make on locally in the upgraded version. πŸ™‚
  11. Thanks for your ideas. I tried it after deleting sessions and file compiler, but I still have the same problem. User salt is identical on both sites.
  12. I started anew, and the batch processor module was a problem. But now my login isn't working. I log in, in my log files I see a successful login, but The login page just reloads without a message. When entering wrong input details, I get the correct error message. Any ideas? πŸ™‚ Thank you! Peter
  13. Hello πŸ™‚ After upgrading to 3.0.123 from 2.7.2 (I replaced the wire folder, index.php and .htaccess I get this error: Fatal error: Uncaught Error: Call to a member function get() on null in site/assets/cache/FileCompiler/site/modules/ProcessBatcher/ProcessBatcher.module:58 Stack trace: #0 [internal function]: ProcessBatcher::getModuleInfo() #1 dev/wire/core/Modules.php(2568): call_user_func(Array) #2 wire/core/Modules.php(2844): ProcessWire\Modules->getModuleInfoInternal('ProcessBatcher', '\\') #3 dev/wire/core/Modules.php(1036): ProcessWire\Modules->getModuleInfo('ProcessBatcher') #4 dev/wire/core/Modules.php(848): ProcessWire\Modules->loadModule('...', '...', Array, Array) #5 wire/core/Modules.php(369): ProcessWire\Modules->load('...') #6 wire/core/ProcessWire.php(395): ProcessWire\Modules->init() #7 wire in site/assets/cache/FileCompiler/site/modules/ProcessBatcher/ProcessBatcher.module on line 58 When I disable template and file compilation, I get Fatal Error: Class 'Textformatter' not found (line 17 of site/modules/TextformatterMakeLinks.module) I added this to all my template files <?php namespace ProcessWire; And am not sure where to go from here πŸ™‚ Any help is greatly appreciated! Thanks! Peter
  14. I'll have to try next week. Thanks for the help so far. I'll be back! πŸ˜„
  15. @flydev no tracyDebugger installed. My processwire Version is 3.0.121 When I add your code modified like this: $jobID = 0; $jobID = wire()->input->get->job; echo $jobID; $jobID = 0; $jobID = $wire->input->get->job; echo $jobID; $jobID = 0; $jobID = $input->get->job; echo $jobID; every echo outputs the ID correctly (must have had a spelling error before). But still not working in my $wire->addHookAfter('InputfieldHidden::render', function($event) use($jobID) { oh, and it also works fine with addHookProperty.
  16. No change. Tried that as well. That's right, I'm in ready.php When I add $wire-> I get the following error: Notice: Trying to get property of non-object. Any other ideas? πŸ™‚
  17. Hi πŸ™‚ I encountered a new problem I don't understand and have been trying to solve for the last few hours. I'm trying to pass a _GET variable to a hook, but maybe the hook is executed before the get variables can be used? This is my code: $jobID = $input->get->job; //$jobID = '1033'; <- when I do it like this, everything works perfectly. $activeJob = $pages->get($jobID); $temp_value = $activeJob->id.' - '.$activeJob->title; echo $temp_value; //outputs expected string '1033 - Job Title' $wire->addHookAfter('InputfieldHidden::render', function($event) use(&$activeJob) { if($event->object->name == 'job_titel_und_nummer') { $temp_value = $activeJob->id.' - '.$activeJob->title; echo $temp_value; //outputs '0 - ', so nothing $event->object->set('value', $temp_value); } }); As always, any help greatly appreciated! Thank you! Peter
  18. Awesome! That was it πŸ˜„ Thank you very much! πŸ™‚ So I'm basically selecting the field, and then adding an Option to it. If it exists it just overwrites the existing option and if it doesn't, it just adds it to the dropdown. Right?
  19. I tried something different. And while it doen't work either, at least something happens πŸ˜„ $wire->addHookBefore('InputfieldPage::render', function($event) { if($event->object->name == 'job_waehlen') { $event->object->set('defaultValue', '1033'); } }); I changed 'addHookAfter' to 'addHookBefore' and the method to 'InputfieldPage::render'. Now the Hook actually seems to trigger and so something. So then I found out that there's a value called 'defaultValue', which I was able to change, but it doesn't seem to have an effect on my Dropdown. It still doesn't preselect anything. πŸ˜•
  20. Hi flydev, thanks for your Feedback! It's not working for me. In my dropdown I have two pages. One has as a value '1033', the other '1036'. The Dropdowns name is 'job_waehlen'. Even when I put $event->return->value = $this->pages->get(1033); The Dropdown doesn't preselect anything.< Is my method ('InputfieldPage::processInput') possibly the wrong one for a dropdown input field? - Peter
  21. Hi πŸ™‚ I'm trying my hands on hooks and was hoping to figure out how to set the default value of a page-select-dropdown of a form, created with formBuilder, via a hook. I want it to be dynamic, so I don't want to set it fixed in the formBuilder Menu. I tried something like this, but I don't know what to set as method and whether I should return a page or an id: $wire->addHookAfter('InputfieldPage::processInput', function($event) { if($event->object->name == 'job_waehlen') { $event->return = '1036'; } }); Any hints and help are greatly appreciated πŸ™‚ Thanks! - Peter
  22. I have not been able to solve this properly. I cheated in order to stop losing images. I added a DB update and changed the file "last-edited"-Date in the module file (InputfieldSlider.module). Now everytime a slider is saved, it updates all temp image files to permanent files. Not a very clean way to do it, but it saves me from losing data for now This is what I added: $sql = 'SELECT `pages_id`,`data` FROM field_images WHERE created LIKE "1970-01-01 01:00:10"'; $query = $this->database->prepare($sql); $query->execute(); $rows = $query->fetchAll(PDO::FETCH_CLASS); $query->closeCursor(); foreach($rows as $row) { $path = $_SERVER["DOCUMENT_ROOT"].'/site/assets/files/'.$row->pages_id.'/'.$row->data; touch($path); } $sql = 'UPDATE field_images SET created=modified WHERE created LIKE "1970-01-01 01:00:10"'; $query = $this->database->prepare($sql); $query->execute();
  23. So, I compared this file with /wire/modules/Inputfield/InputfieldCKEditor/plugins/pwimage/plugin.js and couldn't find any discrepancies. So maybe the problem lies within a different file? It seems to call just an iframe, so I'm not sure why it would be different for ckeditor and te module...
  24. Hi I'm using a lightly modified Version of ProcessSlider on my PW page (3.0.42). But I'm having a problem with the file upload. It's using Ajax File upload to upload images, which is working fine at first, but the images are only uploaded temporarily (creation date 01.01.1970) when an image is uploaded and saved. When pressing the "save"-Button, this does not change. I'm guessing it's due to changes from PW 2 to 3? This is the js that is calling the iframe upload, I think I don't know what to do to amke it save correctly. Anybody who can give me a hint? /** * ProcessWire iFrameImagePicker plugin * * Light verision of InputfieldCKEditor/plugins/pwimage/plugin.js * * @return callback(src, width, height) * */ function loadIframeImagePicker(page_id, callback) { var page_id = page_id;//$("#Inputfield_id").val(); var edit_page_id = page_id; var file = ''; var imgWidth = 0; var imgHeight = 0; var imgDescription = ''; var imgLink = ''; var hidpi = false; var modalUri = config.urls.admin + 'page/image/'; var queryString = '?id=' + page_id + '&edit_page_id=' + edit_page_id + '&modal=1'; if(file.length) queryString += "&file=" + file; if(imgWidth) queryString += "&width=" + imgWidth; if(imgHeight) queryString += "&height=" + imgHeight; queryString += '&hidpi=' + (hidpi ? '1' : '0'); if(imgDescription && imgDescription.length) { queryString += "&description=" + encodeURIComponent(imgDescription); } if(imgLink && imgLink.length) queryString += "&link=" + encodeURIComponent(imgLink); queryString += ("&winwidth=" + ($(window).width() - 30)); // create iframe dialog box var modalSettings = { title: "<i class='fa fa-fw fa-folder-open'></i> " + "Select Image", open: function() { } }; var $iframe = pwModalWindow(modalUri + queryString, modalSettings, 'large'); $iframe.load(function() { // when iframe loads, pull the contents into $i var $i = $iframe.contents(); if($i.find("#selected_image").size() > 0) { // if there is a #selected_image element on the page... var buttons = [ { html: "<i class='fa fa-camera'></i> " + "Insert This Image", click: function() { var $i = $iframe.contents(); var $img = $("#selected_image", $i); $iframe.dialog("disable"); $iframe.setTitle("<i class='fa fa-fw fa-spin fa-spinner'></i> " + "Saving Image"); $img.removeClass("resized"); var width = $img.attr('width'); if(!width) width = $img.width(); var height = $img.attr('height'); if(!height) height = $img.height(); var file = $img.attr('src'); var page_id = $("#page_id", $i).val(); var hidpi = $("#selected_image_hidpi", $i).is(":checked") ? 1 : 0; var rotate = parseInt($("#selected_image_rotate", $i).val()); file = file.substring(file.lastIndexOf('/')+1); var resizeURL = modalUri + 'resize?id=' + page_id + '&file=' + file + '&width=' + width + '&height=' + height + '&hidpi=' + hidpi; if(rotate) resizeURL += '&rotate=' + rotate; if($img.hasClass('flip_horizontal')) resizeURL += '&flip=h'; else if($img.hasClass('flip_vertical')) resizeURL += '&flip=v'; $.get(resizeURL, function(data) { var $div = $("<div></div>").html(data); var src = $div.find('#selected_image').attr('src'); callback(src, width, height); $iframe.dialog("close"); }); } }, { html: "<i class='fa fa-folder-open'></i> " + "Select Another Image", 'class': 'ui-priority-secondary', click: function() { var $i = $iframe.contents(); var page_id = $("#page_id", $i).val(); $iframe.attr('src', modalUri + '?id=' + page_id + '&modal=1'); $iframe.setButtons({}); } }, { html: "<i class='fa fa-times-circle'></i> " + "Cancel", 'class': 'ui-priority-secondary', click: function() { $iframe.dialog("close"); } } ]; $iframe.setButtons(buttons); $iframe.setTitle("<i class='fa fa-fw fa-picture-o'></i> " + $i.find('title').html()); } else { var buttons = []; $("button.pw-modal-button, button[type=submit]:visible", $i).each(function() { var $button = $(this); var button = { html: $button.html(), click: function() { $button.click(); } } buttons.push(button); if(!$button.hasClass('pw-modal-button-visible')) $button.hide(); }); var cancelButton = { html: "<i class='fa fa-times-circle'></i> " + "Cancel", 'class': "ui-priority-secondary", click: function() { $iframe.dialog("close"); } }; buttons.push(cancelButton); $iframe.setButtons(buttons); } }); }
Γ—
Γ—
  • Create New...