Jump to content

mr-fan

Members
  • Posts

    848
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by mr-fan

  1. Great - thank you very much! The query and if statements are never a real problem since i like to try out how it works and dig into - but sometimes i don't find the right hook or methode that i have to jump on (ProcessPageSearch::executeFor). Thank you for the hint - i will provide a complete snippet if it works. (Just some little offtopic - i place this kind of hooks until now in my admin.php - i don't get the whole difference between ready.php and admin.php...it's not really documentated where i should run/setup different little hooks/tasks better)
  2. I was afraid that... Configuration for now is a have page /contentblocks/ as hidden parent with no edit rights to the editors group /contentblocks/xxxxx/ childpages with edit/view rights for editors The parent is under a normal /settings/ page in the pagetree. Would it be better if the blocks are under the admin branch of the tree - may this is my issue?
  3. yes - i know this is a bit tricky there.. on a page field where i link "see also" kind pages i have full control about the ouput. But on the PW Link plugin all pages are there - pagetable pages, too... The search suggestion should don't show something like this: Term: >about< Autocomplete: /about/something/ /about/ /contentblocks/about-us/ while contentblocks is a hidden parent page for the contentblockpages - that for shure not hidden. I've searched the forum - i had some experience in changing the PWImage plugin to bind it to a specific parent page (for central image handling) but with help from adrian. Can you give me a hint where to hook/start right? Best regards mr-fan
  4. mr-fan

    PW IDE

    http://komodoide.com/komodo-edit/
  5. One Question on PW Link Dialog - How could i prevent that PageTable Items like part_text, part_image ...get listed in this dialog. I've a kind of blockbuilder running with PageTable and have the Pages under a hidden Parent in the tree. But pages are listet. Could i hook in the link dialog and exclude the PageTable Templates? Best Regards mr-fan
  6. With PageTableExtended you have a setting for sorting from a field (no no more drag and drop) in the Details tab...prerendering could set to false so it works as normal PageTable, too. I always use PageTableExtended no regardless of using the render feature or not. Best regards mr-fan
  7. Had the same Problem on some Installations - what camera produce the images - happen this with all images only with client's images?
  8. Again and again i've to write how awesome this module works....thank you Martijn.. it's a kind of JS/CSS captain hook for the admin! Here a little example for a easy solved problem at least for me: Have a events page that works like a timeline - and the event template itself contains the data and provide a .ics format file on the URL of the "page" there is no kind of single view and the template works as iCal generator for the event itself. So the little big Problem is if a user/autor clicks in the backend on "View" he get the eventxyz.ics file and not to the frontend page for the events.... so i need one line in the PageProcessEdit.js that solves this issue with a breeze of jquery. $("a#_ProcessPageEditView[href*=events]").attr("href", "/event-overview-page/"); best regards mr-fan
  9. I don't can confirm this since i ever rename the admin path /processwire/ on installation..what version you use?
  10. You could set two image fields - one for the CKE main content block and separate image fields for stuff like gallery... Here is a example screenshot and the question on the upload field buttons in CKE: https://processwire.com/talk/topic/11516-is-it-possible-to-specify-an-image-upload-field-for-uploading-images-in-ckeditor/ In general you have to assing a imagefield on the template and then the image should uploaded to that field while using it in CKE... https://processwire.com/blog/posts/processwire-core-and-profields-updates-2.5.22/ regards mr-fan
  11. https://processwire.com/talk/topic/3429-how-to-set-text-linecharacter-limits-in-templates/#entry33748 regards mr-fan
  12. better solution from better dev's with array_chunk(): https://processwire.com/talk/topic/7803-implement-array-chunk/?p=75579 best regards mr-fan
  13. //set counter $count = 0; //divider //$anzahl from your $page->count() $div_one = $anzahl / 3; // for example 7 $div_two = $div_one * 2; // for example 14 $div_three = $anzahl; // for example 21 //loop and check $counter foreach ($kunden as $tag) { $counter++; switch ($counter) { case ($counter >= $div_one): echo "html output with $tags for div one"; break; case ($counter >= $div_two): echo "html output with $tags for div two"; break; case ($counter >= $div_three): echo "html output with $tags for div three"; break; } } this is untested written in the browser....but it should give you a option. regards mr-fan
  14. I'm stucked again... before i waste my time on diving into the module code to get this complex thing done (get "smart" images as seo_image from pagetable templates)...i tried to setup a saveReady Hook in admin.php to test if it works...and now i have very strange output. her is my simply (and/or stupid function): /** * Hook for changing seo_* fields if empty on Page Save */ $pages->addHookAfter('saveReady', null, 'changeSeoFields'); function changeSeoFields(HookEvent $event) { $page = $event->arguments[0]; //for this template only if($page->template == 'basic_page') { // check if seo_image exists and if it is empty if (!$page->seo_image) { //is there a main content block as pagetable field pt_inhalt? if(count($page->pt_contents)>0) { $first_i_item = $page->pt_contents->get("template=part_image|part_text_image_left|part_text_image_right|part_gallery"); if ($first_i_item) { //two variation of templates with single image if ($first_i_item->template->name == 'part_image' || $first_i_item->template->name == 'part_text_image_left' || $first_i_item->template->name == 'part_text_image_right') { $first_i_url = $first_i_item->image->httpUrl; //or a little gallery with images } elseif ($first_i_item->template->name == 'part_gallery') { $first_i_url = $first_i_item->images->first()->httpUrl; } else { $first_i_url = ""; } } //set seo_image on publishing $page->set ('seo_image', $first_i_url); //messages to debug $page->message('Pfad '.$first_i_item->image->httpUrl); //gives me nothing image->url too $page->message('SeiteID '.$first_i_item); //gives me the id of the PT Page for example 1178 $page->message('SeiteID '.$first_i_item->name); //gives me the name of the PT Page for example 1178 but ->bild->name is not there, too... } } } } I get a "page with this function and this page == the pagetable item with a image ....but i can't get the image itself and the url??? I don't wanna parse the whole DOM for the first image url...since all the PW data is there but something i miss here. regards mr-fan
  15. today i read this: http://blog.ioactive.com/2016/01/drupal-insecure-update-process.html since i'm not that security pro i'm asking how the upgrade module works or verifies versions and packages....yes i know man in the middle only works in the same (most unsecure) network and for me a update is not something that a trigger via mobile in a public wifi place just for fun... regards mr-fan
  16. I have to change some of the MarkupSEO code to adapt the right og: images from my pages... The problem is that i use PageTableExtended to build my blocks with text, images and so on. So i have a single "image" field and a "images" field for small galleries....so far the content building works with rendering the single pagetable parts...but How get i the images from the single parts (like a block with text right and single image left or first image of a block of a gallery)? I've manged to change the code from the module that i've a better fallback solution in the modul. It was no ideal solution that in the original module if you set a defaul image in the settings and actived the smartimage option....always the default image path was used...not that great deal. i changed this lines and switched the if statements - and it works as expected: case 'image': //first check for smartimages if($configData['imageSmart'] && count($page->get(implode('|', $configData['imageSmart']))) > 0) { $imageFields = $page->get(implode('|', $configData['imageSmart'])); try { $pageData['image'] = $page->get(implode('|', $configData['imageSmart']))->first()->httpUrl; } catch (Exception $e) { $pageData['image'] = $page->get(implode('|', $configData['imageSmart']))->httpUrl; } //no smartimage there use default image from module settings } elseif($configData['image']) { $pageData['image'] = $configData['image']; } How could i get the first image from all pagetable items of the $page? $page->get(implode('|', $configData['imageSmart']))->first()->httpUrl; I've no good idea right now... regards mr-fan
  17. What was the question? You used no single >?<.... Ok on the menu thing - Processwire is ment to have this pagetree stuff - so you could build your content in this order and use some kind of Markup Module to create a menu a good menu tool is https://processwire.com/talk/topic/1036-markupsimplenavigation/ You build your own menu builder with a pagefields for example. https://processwire.com/talk/topic/2296-confused-by-pages/ http://wiki.processwire.com/index.php/Page_Field If you mean ProcessMenuBuilder from kongondo i can't find any issue from you. http://modules.processwire.com/modules/process-menu-builder/ Important tip use google to search the forum... https://processwire.com/talk/topic/7298-google-custom-search-for-your-browserbookmarks/ @all after this some tips in german only to make things short ============================================= - Kein Fragezeichen - Keine Frage - Kein Problem - Processwire ist ein wenig anders als andere CMS - Module sind mehr oder weniger nur optional - und nicht wie bei anderen CMS nötig um ans Ziel zu kommen. - Versuche immer exakte Fragen zu formulieren und dein Ziel möglichst genau zu beschreiben. - Verlinke auf verwendete Module und Quellen damit diese nachvollziehbar sind. - Kein Englisch + Deutsch - das sollte ein englisches Supportforum bleiben. - Es wird auch bei schlechtem Englisch geholfen. Best regards mr-fan
  18. As a novice in real PHP programming (not this coding trial&error thing...) i've to say this kind of documentation is not that great, too. The great API overview don't really help if you need a advice how to create a specific thing with a module. You have to search for a similar module and study how this is done in this module....then you find out that there are more than once possibilities and i don'T know which is the best/actual option...and so on. Ryan's blog entries are great stuff to read....but it is all like a puzzle to start with a own bigger module...small ones are written fast and straight with one or two simple functions/methods that output some markup or a textformatter. But if i take a look on the project of GM with the forum part i could feel a little bit what this topic causes... @GM - but the October CMS builder is nothing you search for - it is more like building inputfields and forms for datasets....and this is what PW does per default...set a special template, fields, userrights and relations via pagetable and your backend UI is ready to use - no module creation needed! THIS is one of the biggest reasons why i switched to Processwire i could create so much without create a proprietary module! You look for a documentation about module creation and a actual collection of best practice. But you are right just two (1, 2) official resources of docs for module creation and some links on other modules as examples are a all a good PHP developer need, but someone that is familiar with the frontend usage of API and has some experience with basic hooks and this stuff, that is willing to go one stepp further - this step is a bigger one in the PW universe... Not that i missing something - if i would need a forum i would probably go the hard way with templates, fields, and some frontend magic - but to have this a module like kongondo's great blogmodule would be a real good alternativ and much faster setup for sure. To get something really positive from this threat we could define a short list what kind of things are need a better documentation or better examples maybe we can collect a link list of best practice code from some github repos and a little description on them? Best regards mr-fan
  19. @Olli like LostKobrakai wrote somas code is complete and use striptags PHP function. Please provide more information. Have you debug mode on? Have you tried it with only wordLimiter($page->body, 160); ? and/or only ripTags($page->body); ? regards mr-fan
  20. Usecase would be you have one element under a specific parent (children are pagetable pages) and in a process for example a review or some kind of sorting so you could have a hook or module that switch the parent if some options are set or some process happens... Usually i've a hidden parent for all normal pageelements but sometimes pagetable childpages are fit better.
  21. You should strip or rip the tags before using the output with a text formatter or direct in the template... /** * Wordlimiter cuts a textarea only after complete words not between * used in admin.php for seo function and in some templates */ function wordLimiter($str = '', $limit = 120, $endstr = '...'){ if($str == '') return ''; if(strlen($str) <= $limit) return $str; $out = substr($str, 0, $limit); $pos = strrpos($out, " "); if ($pos>0) { $out = substr($out, 0, $pos); } $out .= $endstr; return $out; } /** * Alternative with regex for striptags function * used in admin.php for seo function and in some templates */ function ripTags($string) { // ----- remove HTML TAGs ----- $string = preg_replace ('/<[^>]*>/', ' ', $string); // ----- remove control characters ----- $string = str_replace("\r", '', $string); // --- replace with empty space $string = str_replace("\n", ' ', $string); // --- replace with space $string = str_replace("\t", ' ', $string); // --- replace with space // ----- remove multiple spaces ----- $string = trim(preg_replace('/ {2,}/', ' ', $string)); return $string; } //usage in template like $default_desc = ripTags($page->shorttext); $default_desc_out = wordLimiter($default_desc, 160); //or short $default_desc = wordLimiter(ripTags($page->shorttext), 160)); regards mr-fan
  22. The new repeater is awesome in design and function! I use PageTableExtended for a similar feature like repeater matrix but with prerendered output like a contentblock builder on every page where you can put in text, text with image, galleries, maps and so on - for such complex things rendering the single templates is much more easier to maintain but more complex to setup. Also PTE works like a preview of the builded contentblocks and on other things you could create a own view for backend and frontend... I'm very exited about the new features, but Pagetable would take his place i think.
  23. Just a update to present the whole function - may useful for others. No more ->find just some ->count 's are running in a preset scope of years...much better now. Thank you very much Jan for your example! It renders a archive navigation like 2015 (12) 2014 (4) 2013 (10) .... i changed Jan's example to sort the years in descending order. It's great a great example about the for loop (most ignored by me) function renderArchive() { //check for url segments (using URL segments for the years like /2000/ $seg1 = wire('sanitizer')->pageName(wire('input')->urlSegment1); //get homepage url for the links to build them absolut since relative wont work with URL segments $homepageurl = wire('pages')->get('/')->httpUrl; //get article root page for links $artikel_root = wire('pages')->get(1068); //get year list $out = '<h4 class="subtitle">Archiv</h4>'; $out .= '<div class="listbox1"><ul>'; //loop trow years and count pages for ($i = date('Y'); $i >= 2007; $i--) { //get start and enddate $start = "$i-01-01"; $end = "$i-12-31"; //count pages from the year $c = wire('pages')->count("template=artikel, publish_from>=$start, publish_from<=$end"); if ($c > 0) { //check if year was active $class = $i === $seg1 ? " active" : ''; //output listitem $out .= '<li class="'.$class.'"><a href="'.$homepageurl.$artikel_root->name.'/'.$i.'/">'.$i.' ('.$c.')</a></li>'; } } //close list $out .= '</ul></div>'; return $out; } Best regards mr-fan
  24. Looks great but, could you run a pagereload on saving the modal via JS? So the option is already there. Users are most not very familiar with browser reloading (having a actual problem with some UI things that users don't get with pagetables...and modals...and saving Very good improvment so far! Best regards mr-fan
  25. Thank you very much for the input! Best regards and best wishes for 2016 - mr-fan
×
×
  • Create New...