Jump to content

OLSA

Members
  • Posts

    151
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by OLSA

  1. I have working solution on PW 3.09 with this inside Extra Allowed Content: div(*)[*]{*} iframe(*)[*]{*} But my opinion is that HTML Purifier strip some tags (like "data-oembed-url" and others) and to get working solution HTML Purifer need to be off. Also edit works (2 clicks, open popup with url input).
  2. Hello, yes that needs to be done to get visible plugin button inside CKEditor toolbar (sometimes it's problem to find right "call"/"trigger", eg. plugin name "btgrid", but to get toolbar button need to insert/write "Btgrid"). To solve problem with cleaning divs write this below inside Extra Allowed Content: div(*)[*]{*} Or next example will allow to use <p class="...">, <a class="...">, <div class="...">. p(*)[*]{*} a(*)[*]{*} div(*)[*]{*} All this examples also works if ACF or Purifer switched on. Regards.
  3. Hello abmcr, for that I created few modules and try many options to get best result. But also here is example with PW default: 1. create independent page tree structure (eg. "Widgets/Addons" or...) 2. In that structure categorise widgets/addons as child of "blank" template Widgets (template: addons) |- Sliders (template: blank) -- Some slider (template: slider-1) -- Some another slider (template: slider-2) |- Call To Actions (template: blank) -- Some Call To Action widget (template: call-to-action-1) |- Banners (template: blank) -- Some banner (template: banner) |- Text and Image (template: blank) -- Some Text and Image block (template: text-image-1) -- Some another Text and Image block (template: text-image-2) Etc... NOTE: Use nice Bernhard module TemplatePreviewImages, or here is link to version where I added few additions. 3.1. Go to your main pages (Home, Category etc...) and add field type page with name "widgets" or "addons", parent page for that field set as page "Widgets" (from 1). With this option you can add rows of widgets to your main pages. OR 3.2. If you want to use positions (top, left, right, bottom etc...) than on your main pages (Home, Category etc...) add field type repeater "Blocks" with fields : "position" (select), "widgets" (page field, 3.1), "show" (select, with options: only-this, only-childs, default (this and childs)). Also all this examples need some logic, and at the end, in your templates you can call widgets like in this example: <?php if(isset($pos['left'])): ?> <div class="col-md-3 columns"> <?php renderWidgets($pos['left']); ?> </div> <?php endif; ?> Regards.
  4. Hello for all, but first thanks to Bernhard for this module! I also created something for similar usage (layout switcher, first image), but also do some additions to this nice module (second image). Here in attachment is TemplatePreviewImages module version where I added some options: thumbnails creation (before usage need to create "thumbs" folder eg: "template/images/TemplatePreviewImages/thumbs) can use any kind of image extension (jpg, jpeg, gif, png) zoom option to preview (using PW integrated jQuery UI ) can restrict module to works only inside desired page tree Regards. TemplatePreviewImages.zip
  5. Hello for all. I am also having same problem with multilanguage in PW 3.0.17. Translation of static strings doesn't work if "view" file is in subfolder. But one thing what I really don't like is template compilation - that gives me more problems in development than benefits. Also when I do this: $config->templateCompile = false; or $config->moduleCompile = false; or switch off template compilation in template settings, I get this : "Call to undefined function __()" or "Call to undefined function _x()" Also there is one old topic about "PW slow in backend" and that is my problem after ~2.7 upgrade. Because all of that probably I will back to PW 2.6 ... 2.7 System: localhost, win7 64b, wamp 3.0.0, apache 2.4.17, php 5.6.16 Regards.
  6. I had this problem today and solved it. In my case I had multiple pages with children, and want to show parent pages titles as group labels, and their child pages as group options. // $f = $this->modules->get('InputfieldSelect'); /* here we have some array of pages and foreach loops */ /* inside inner foreach fill $group_options array */ $f->addOption( $group_label, // $parentpage->title (I had troubles here, use var_dump to check that value!) $group_options, // $group_options[$childpage->id] = $childpage->title $opt_attr // array for option attributes ); If this is confused, here is part from some my custom field module where parent pages use "blank" template: $f = $this->modules->get('InputfieldSelect'); $opts = wire('pages')->get(1078)->children(); foreach($opts as $opt){ if($opt->template->name == 'blank' && $opt->numChildren()){ $group_options = array(); foreach($opt->children as $option){ $group_options[$option->id] = $option->title; // <= main part to get group options } $group_label = $opt->title . ''; $f->addOption($group_label, $group_options, array()); } } $f->attr('name', $name . '_widget[]'); $f->attr('value', $widget); Regards.
  7. Hello Christophe, old topic, but today one my client asked me the same question, and my answer was - insert caption at the end, as last step in content edit. Insert image(s), write some text, and when finish all, go back to image(s) and select and in popup check caption and write captions. Short answer: insert captions at the end. regards
  8. I have the same problem, PW 2.7.0 very slow in backend (>25 sec.) when editing or save (Win7, Wamp, PHP 5.4). Regards.
  9. Just checked with few online scanners and all everything is ok, except BitDefender checks (third on the list below). Here are some links: 1) safeweb.norton.com 2) virustotal.com 3) trafficlight.bitdefender.com/info?url=[your url]
  10. Hello for all. Maybe it's only me, but when I build some website in my native language (one language non-english website) I do not use/install "Language support" modules - do you do the same or it's only my wrong practice? In that case, all my development is "fixed" (eg. can't share some scripts/code with the community, or some custom module etc.), or if I install some "frontend" module from PW repository than, also, have to install and "Language support" modules, or do ugly job (rewrite module static phrases). Right now I found some solution (write it here) but in that case "Language Support" module installed (2 more database table, 1 template, 1 page, indexing, checking, processing etc...), but with hook addition inside "wire/core/LanguageFunctions.php" all that can be avoid. Also in that case all PW standard translation procedures stay the same, but also we get new custom translation options (like in one-language non-english websites I will use that principle, but in multilanguage will use native and fast PW principle). Thanks and regards for all. p.s. if this is a "spam" question (because write almost the same things here) then please administration to delete one of these two topics.
  11. Hello for all. This is not a topic about multilanguage websites, but mostly about one-language web sites and translation methods. In one-language none-english projects I don't install "Language Support" modules, but still use static English phrases in files ("Read more"...), and later translate that phrases using some of many options (eg. method + arrays). To simplifie this topic: if you build website in one none-english language (eg. Germany, Russian etc.) and, as example, want to use wonderfull "Pollino" Soma module, than you have to install "Language Support" module, or you will have "Vote" button at the form. And that's ok. But how to translate that module phrases without using "Language Support" modules? <- was my first idea. Also, all this is in connection with my custom development where I want to standardise some things, like translation of static phrases. Target: Leave, and respect native PW call for all phrases in English (__("Some text")) and use that standard principle in all projects (one language, or multilanguage). Idea: use hooks inside __() call and at the beginning, stop all next calls and procedures, and do some compare and replace job Problem: there is no hookable method for that job ("wire/core/LanguageFunctions.php") Currently working solution (example): // _func.php // prepend // Call Language Support module // You can comment next line if you have installed module // , or this will do the same job $module = wire('modules')->get('LanguageSupport'); // Here we rewrite response from module function translation( HookEvent $event ){ $event->return = translate( $event->arguments(1) ); } // These is the example where we do "find and replace" job // You can use different variant, like include dict. file function translate( $phrase ){ $dictionary = array( 'Read more' => 'Opširnije', 'Total votings:' => 'Ukupno glasova: ', 'Vote' => 'Glasaj', 'Name' => 'Ime i prezime', 'Message'=> 'Poruka', 'Subscribe' => 'Pošalji', 'Missing required value' => 'Ovo polje je obavezno', 'Next' => '>>', 'Prev' => '<<' ); return isset($dictionary[$phrase]) ? $dictionary[$phrase] : $phrase; } // This is the main part where we hook wire()->addHookAfter('LanguageTranslator::getTranslation', null, 'translation'); I didn't avoid "Language Support" installation, but with this I can translate all website phrases in one place (good if you need to translate 20 - 30 views with repeatable phrases, eg. "Read more"). Also with this no need to use custom translation methods (use default PW call (__("Some text")). p.s. also there is idea to hook append same 'textdomain' for all files/views Regards, Sasa
  12. Hello. You can try to switch off ACF ("No") and check what you get. But also here is another working solution (in two 2 steps): 1. in site/modules/InputfieldCKEditor create newstyles.js with content: CKEDITOR.stylesSet.add( 'newstyles', [ { name: 'Left aligned', element: ['address', 'p', 'ul'], attributes: { 'class': 'left' } }, { name: 'Right aligned', element: ['address', 'p', 'ul'], attributes: { 'class': 'right' } }, { name: 'Read more button', element: ['a'], attributes: { 'class': 'button' } } ]); 2. inside field settings need to set this: - Use ACF: No - Custom Editor js Styles Set: newstyles:/site/modules/InputfieldCKEditor/newstyles.js NOTE: After this, you will see dropdown list of additional classes only when you inside editor select tag from the list (address, p, ul, a). Regards.
  13. Thanks Horst for reply. PHP 5.4.1, but also same message on shared host (Linux, PHP >5.4) sorry it's mistake writing it here (there I have one variable), yes also try all options single/double quotes
  14. Hello for all. Just want to inform about "warning" (not error) in core/Pageimage.php, line 312. Scenario: 1. set debug mode (config.php, $config->debug = true;) 2. crop image with api in template with additional "cropping" params: $small_image = $page->image->size(200, 120, $options['cropping'] = '50%,40%'); You will get this message (example is from my localhost, MS Windows): Warning: strpos() expects parameter 1 to be string, array given in ...\wire\core\Pageimage.php on line 312 If you use this format "50%x40%" ("x" separated, not with comma ",") than there is no warning message. For interested, reason for that (if using comma separated values) is on line 277, 278. Possible temporary fix solutions: 1. additional check inside "if" statement if(!is_array($options['cropping']) && strpos($options['cropping'], 'x')... // line 312, core/Pageimage.php or 2. using error control operator in "if" statement (line 312, core/Pageimage.php) if(@strpos($options['cropping'], 'x') === 0 && preg_match('/^x(\d+)[yx](\d+)/', $options['cropping'], $matches)) or ... Regards.
  15. Thanks LostKobrakai! There is still too many PW secrets for me, read almost all documentation but couldn't find this what you write here. I will remember this: Pagination can make "troubles" because it can be in correlation with other MySQL queries ($pages->find) on the same page. Thank you! EDIT 27.09.2015: Thanks @SiNNuT I find where Ryan write about this (Avoiding pagination pitfalls, 25.09.2015.):
  16. Hello for all, Please before read, just one note here - in problem description I use word "article" for child pages. I have category "News" with about 700 articles. Because on every News page are list with 5 articles, pagination goes from 1 to 141 pages. On sidebar I render "widget" where are 3 articles from another category ("Projects"). Projects articles: a, b, c, d, e, f, g, h, i, j, k... Problem: News page 1, widget Project shows: a, b, c - correct News page 2, widget Project shows: d, e, f - wrong (need to show a, b, c) News page 3, widget Project shows: g, h, i - wrong (need to show a, b, c) And same principle on other pages... Widget render articles using $pages->find call: $items = $pages->find("parent={$page->parent_page->id}, limit={$page->num_of_articles}, sort=-date_end"); Any help? Thanks.
  17. Thank you all for fast answers! LostKobrakai thank you for answer and sorry because I didn't write here all "things", and this is only small part of all my "problems" with PW. I am with ProcessWire last few months and I am trying to find best concept (and some "standardisation") for settings and configuration: "widgets"/"blocks" (managments, rendering options...), category list settings (layout, show/hide...), most visited and downloads hits (cache... (or externall services)) etc, etc... As example, in one project has ~40 templates and >50 fields (with many settings options (fields and pages)) and because of that resources and speed are very important for me. Also want to use same concept on small and big projects (for global values). Thanks.
  18. Hello for all. What is your suggestion, or your practice to store global shared values (eg. contact details)? Example (this small test website): In footer you can see "summary" from "About us", and in right footer column "body" from "Contact" page (address), but also link to client Twitter and Facebook page. Also in top navigation you can find telephone number. Problem is that what if client want to add and another telephone(s), or few new social links (Google Plus, Linkedin etc...), or second, third... office location etc. There is many options: 1. hardcoding (eg. store some values in config.php) Pros: fast rendering Cons: all others 2. use independent fields + repeatable fields (eg. for social networks, or more office locations) Pros: user friendly Cons: more fields (database rows, resources) 3. use only few fields with special syntax and parsing (eg. textarea and in "one row one value", or any other values separator, or hanna code, shortcodes...) Pros: fast to render, only one field for all values Cons: not user friendly 4. build some "configuration" module with repeatable and sortable options (fields) and store values in JSON format 5. use native PW pages and later Page Select field Cons: 10x slower than 3 (tested) What is your suggestion or practice to get the best for users (admin) and for the system (PW resources, fast rendering...)? Thanks, Sasa
  19. Thank you LostKobrakai! That selector works. My idea was to create field where they can store/type parents id like : "2025|2230"... and later in search template "has_parent!={...}". Thanks and regards.
  20. Hello, my question is the same: how to hide page tree, or only parent is hidden and want to hide from search results and all it's children? Tried with selector "parent != hidden", "has_parent != hidden" etc. but without success (not logged in). Also option with id works but I need flexible options (for adminstrations / clients). Thanks.
  21. Hello, in my project I have about 20 different content types eg: - basic item - news item - publication (image, description, view restriction etc.) - gallery - video file - document (file pdf, docx...) - project (project start date, project end date...) - manager profile (image, CV, position...) - company (company profile, products category...) - event (event date, location ...) - etc... Also there are shared content with additional templates ("widgets/blocks") where I have about 15 types of widgets (weather module, image banner, text banne, slider, header, link button, notification popup etc...). To reduce number of templates I create "category" template (for main content), and category template can show "list of news", "list of publications", "list of documents", "list of galleries" etc... Also category can have as child another category. Problem is that on some "list" need to show or hide some fields, need different number of items/per-page, need different sorting etc. If I use Ryan "Skyscrapers" concept and create pairs of templates eg: news -> news_item events -> event notifications -> notification galleries -> gallery videos -> video documents -> document publications -> publication projects -> project managers -> manager companies -> company discounts ->discount etc... In that case I will have very big number of templates/files (~40) but don't need many switches/flags. I really like option with "category" template, because it reduces number of templates, but on the other need to have switches ("show date", "sort (front) by..." "number of items"). Also additional "price" for that is bigger number of fields (page select). Also as small note, I don't use "hard core" checks in code (eg. by ID, template name, parent etc..) because I want to avoid administration mistakes/errors, and also to get much as possible flexible management in backend. What is your suggestion to reduce number of templates when you have many totally different content types? Right now I can see these options: 1. templates without files and "include/layouts"concept -> "fat logic" / "_func.php" 2. use files for everything -> "fat templates folder" 3. combination 1+ 2 -> chaotic (my current situation) Thanks and regards, Sasa
  22. Thank you LostKobrakai.
  23. Hello, I had a problem with this part of code: $field = $modules->get("InputfieldSelect"); $field->label = $el['label-children']; $field->attr('id+name','children'); //=> this line was a problem $field->attr("wrapClass", "large-4 columns"); $options = array('0','1','2','3','4','5','6','7','8','9','+10'); foreach($options as $k => $v) { $field->addOption($k, $v); } $form->append($field); and later in some loop I had a trouble foreach( $form->children as $f ) { ... } Because I am still learning Processwire maybe it would be nice to have some kind of "List of reserved words". My mistake was that I didn't give importance about "children" in this part: $field->attr('id+name','children'); because I was thinking: ok it will create select field with id="children" and name="children" But that was wrong Regards, Sasa
  24. Thanks @Sérgio for link, and great thanks to Horst and his job, but right now as I understand it's late for me to use it (I have finished all structure, imported all content in few steps...). Probably I will stay with parent page setup (sort child by "created") and add "featured" field to child pages. I like this behaviour only in the beginning of pages tree creation (for parent pages only) - but later in next step - for child pages - I like to get pages tree in "reverse" order. I was confused in all this because I was thinking - it's only view - and probably we can do something to "reverse" JSON response, but that's it and need to finish this project because my deadline is so close. Thanks.
×
×
  • Create New...