OLSA

Members
  • Content Count

    118
  • Joined

  • Last visited

  • Days Won

    1

OLSA last won the day on August 10

OLSA had the most liked content!

Community Reputation

132 Excellent

About OLSA

  • Rank
    Sr. Member

Profile Information

  • Gender
    Male

Recent Profile Visitors

2,709 profile views
  1. @Mustafa-Online probably you use Fontawsome v4 and get that situation because ProcessWire also use Fontawesome icons v4 and override module css inclusion. If you go with some other font icons (or FA version v5, Fontelo, IcoMoon...) that would works. Also switch off option "Repeater dynamic loading (AJAX)" for repeater field. Regards.
  2. Hi, this is one of examples how can be used ConfigurationForm module. 1. Create field "translate", fieldtype ConfigurationForm Fieldtype 2. In field setup create desired fields what would store translations (eg. textLanguage fields: readmore and submit, and textareaLanguage fields error and success) Please note how to setup these fields: There is no image for success field setup, but it is the same like for the "error note" (textarea, type: textareaLanguage, name: success). 3. In Actions tab, add "translate" field to desired template (eg. Home). 4. Press ProcessWire Save button (ignore blue Save button). 5. After, on Homepage, you will get this: 6. Write desired translations, please note to language switcher on inputfields right side. Press page Save button. How to render translations? 1. call field->subfield and echo it (subfield name). <?php // get main field (container where are all translations) // our translations are on Homepage $translate = $pages->get(1)->translate; //Submit echo $translate->submit; // Read more echo $translate->readmore // etc... ?> With this you can get elegant solution to store all needed translations, easy to add new and easy to administrate. Also if someone forget to write some translation, output would be default translation content. Regards.
  3. Hello, if page reference field is on user template, then you can try this: $stores = new PageArray(); $users = $pages->find('template=user'); foreach($users as $user){ $stores->add($user->stores); // "stores" is page reference field name on user page } // now $stores contain desired stores pages, check with var_dump or foreach()... // pagination $pagination = $stores->renderPager(); There is option to go with direct sql query, but I'm not sure how that would be "clean" (readable) plus for that need to do some preparation (also using queries). I'm still with PW 3.0.98, but if you are using some of latest dev. versions (>3.0.98) try to find text about new functionality that has been added to page reference field. Maybe that can helps to find some another approach. Regards.
  4. Hi Dragane, sorry for the delayed response (I am on vacation until September 1st). If that's JS errors are in Chrome console inside field setup, that might be in relation with required attribute and Chrome browser (here are more details), but if you insert any values in setup "form" fields maybe you can "skip" that and PW will save field and it's subfields? Also, as a result of the first , maybe you have "empty" field (without subfields), and that cause second error (never noticed before, but I'll investigate that). Here is one important detail that you probably didn't notice, and my fault because I didn't mention, required attribute is not in use in current version. There are few options and buttons what are not in use and I didn't remove because my first plan was to use them all for fields (eg. "Required", "Limit access..." ) or for new features.
  5. OLSA

    @gmclelland thanks, yes that is ProcessWire. Ok I will try to describe and share how I works. In that I use "widgets" and "widgets manager" field. Widget is custom content block, and it has template and fields, and at the end it is a PW page. Also, widget can hold shareable content. Widget "lives" inside independent page tree "Addons". Example of widgets: slider, sidebar news, call to action... Widget manager is a field, and as it's name says, it is used to manage widgets. Manager provide options to select desired widget, set it's template position, ordering (when widgets share the same position), visibility rules, etc... Widgets manager field can be used in different ways, but in my case, I place it on parent pages (Home, categories, sub-categories) using visibility options: "default" (parent+children), "only children", "this page only". How I use all this: 1) build all needed widgets, initial content, very easy, very fast 2) create hidden page tree "Addons" and there place all widgets (sometimes categorized) 3) place widget manager on parent pages and select desired widgets (previously created) What administration can do on parent page (eg. Home)? 1) Place/add new widget from Addons tree. 2) Clone or copy existing widget, edit, and get another (same type, different content). 3) Drag and drop to change on page position (ordering). 4) Switch off desired widget(s) etc... with all of that, they can easily change page visual appearance. Rendering Page ask "do I have widgets?", and that "question" it can ask itself, parent, grandparent... until root parent. After all, here is last step where page itself check for widgets inside some position: // on page widgets call <?php if(isset($pos['body'])):?> <?php renderWidgets($pos['body']);?> <?php endif; ?> Some screenshots: "Addons" page tree and "Widgets manager": Some widgets examples: "Slider" and "Featured" Slider: repeater with 3 fields (image + 2 configuration form fieldtype) Featured: 2 fields (configuration form fieldtype). Here are few demos: miq5, builderfox, restaurant, prteam... In short that's it, please feel free to ask if there is anything that is not clear or need more details. Regards.
  6. Zdravo Dragane, I totally agree with you, and I'm aware of all imperfections, but I use it last 2 years in all my projects (multilanguage) and it's play important role in all of them. News is that I am started with development of different version of that module and it's possible that I will include all suggestion in that version, or will do that in next release of current version, and after it post it to Github and in PW module directory. Inputs like text and textarea are multilanguage, but labels are not because that part depends on jQuery FormBuilder plugin (in my case, I write labels in administration default language). I really appreciate all the suggestions to make this module better and thanks for that!
  7. OLSA

    Hi, this is not so clear to me in part "pass variable to hidden input"? If need to save image path value to hidden input, than maybe it's better to go with hook in backend (after page save or other). Another option coud be to save image path value to hidden input in runtime (???), if that is the case, than try something like this: <?php foreach($page->dev_repeater as $repeater) { $image_field = $repeater->image_field; foreach($repeater->dev_child_repeater as $url) { // some other stuff, link etc... // check and save hidden_field value inside runtime (???) if($url->hidden_field == ""){ $url->of(false); // $url->save(); uncomment if save on second reload $url->hidden_field = $image_field->url; // <= this? $url->save('hidden_field'); } else { // hidden_field has some value echo $url->hidden_field; } } } ?> But also if there is any option to avoid nested repeater that would be better, and also try to think about using hooks in backend to avoid save in runtime. To me it's ok when need to save "page view counters" or some other events triggered by front-end users/vistors. Sorry if I don't understand your question well. Regards.
  8. Hello gingebaker, in that situation, until the issue will be resolved, you can copy core module to site/modules and there change it to get working temporarily solution. If you want to do that, here are steps: 1) copy core ProcessPageSearch module from wire/modules/Process/ProcessPageSearch to site/modules/ 2) after it configure PW to use that variant (administration, Modules->Configure->PageSearch...). 3) inside ProcessPageSearchLive.php, execute() do small changes: public function execute($getJSON = true) { /** @var WireInput $input */ $input = $this->wire('input'); $liveSearch = $this->init(); if((int) $input->get('version') > 1) { // version 2+ keep results in native format, for future use $items = $this->find($liveSearch); } else { // version 1 is currently used by PW admin themes $items = $this->convertItemsFormat($this->find($liveSearch)); } $result = array( 'matches' => &$items ); // --- START if(count($result['matches'])){ foreach($result['matches'] as $key => $match) { if($match['template_label'] == "templateX" || $match['template_label'] == "templateY") { // add vorname and nachname to title $matchPage = $this->pages->get($match['id']); $result['matches'][$key]['title'] = $match['title'] .' - '.$matchPage->get('nachname').' '.$matchPage->get('vorname'); } } } //--- END return $getJSON ? json_encode($result) : $items; } Regards.
  9. Hello, I had used comments fieldtype and it works perfect. Just right now compared what I had used and there are few differences, but first please check did you have on page Comments css and js files: <link rel="stylesheet" type="text/css" href="<?php echo $config->urls->FieldtypeComments;?>comments.css" /> <script type='text/javascript' src='<?php echo $config->urls->FieldtypeComments;?>comments.min.js'></script> And call: <?php echo $page->comments->render(array( 'headline' => '', 'commentHeader' => '<span class="comment-by">{cite} <span class="date">{created}</span> {stars}{votes} </span>', 'useVotes' => 1, 'useStars' => 1, 'upvoteFormat' => '<span class="rate-review"><i class="sl sl-icon-like"></i> Helpful Review {cnt}</span>', 'downvoteFormat' => '<span class="rate-review"><i class="sl sl-icon-dislike"></i> Dislike Review {cnt}</span>' ));?> Please check and Comments settings inside admin where you can define stars rating (need to fill form or not). Regards.
  10. OLSA

    Hello, here is example from one of my projects and don't know if that can help you. That example show AVG of 4.6, and below is copy/paste how I get that. I believe that only what you need is to set "use stars", and this call: $page->comments->renderStars(true, array('schema'=>'microdata','partials'=>true)); Or more details, where I use that: <?php if($page->comments->count):?> <div class="star-rating"> <div class="rating-counter"> <a href="#listing-reviews"> <?php echo $page->comments->renderStars(true, array('schema'=>'microdata','partials'=>true));?> </a> </div> </div> <?php endif;?> If that is interesting, here is and Comments configuration to use Font Awesome icons. CommentStars::setDefault('star', '<i class="fa fa-star"></i>'); //<= star item using fontawesome icon Regards.
  11. Dragane, odlicno, samo da je malo manje vruce ;) CompactView is html table view and idea for that type of layout was to use it in cases where are inputs closely related (eg. some contact details), and inside repeaters because don't take too much space (can open few repeater items, and at the same time, view fields in all of them). I missed to write in notes that PW Width value is not used inside CompactView layout. Sorry but it's possible that I skiped to write and some other notes, and feel free to ask me anything that is not clear or confusing. Fields what I used in almost 90% are: select, text, textarea, page and link. Radio and checkboxes very, very rarely (can't remeber), and in that case I prefer to use select. Please can you try to add to the end of module css file (module directory... site/modules/FieldtypeConfigForm/assets/css/admin.css) this few lines: .CompactView .InputfieldCheckboxesStacked, .CompactView .InputfieldRadiosStacked {list-style:none;padding-left:0;} .CompactView .InputfieldCheckboxesStacked input, .CompactView .InputfieldRadiosStacked input {margin-right:10px;} , and after it refresh browser page (CTRL+F5) and check if it will be better? Thanks and regards!
  12. OLSA

    Hello for all, my opinion about integration of some popular "page builders" into PW is not a good option. All respect for developers, but "page builders" are like a "box" with "toys" inside of it. Problem is that every website is different and very soon you would noticed that you need to prepare some new element because you don't have it in a "box". Before few days I find some page builder with 170 predefined blocks, but noticed that there were not blocks what I needed for my last project (demo, slow host). Inside "box" with 170 content blocks were not any with "large text in the corner of the frame". I believe that right solution are tools for building "page builders" right on place, and that is why PW profields (Repeater Matrix Fields) are good option (or my custom what I had made before few years, part of it is here). I really like to hear new ideas to make things better but I am sure that integration of popular page builders are not a way to go. Regards.
  13. Here are more details and some news about this module. What's new (14. August 2018.): - fix small bug - search by subfields - different layouts per-template basis Examples: 1) 1 single field for configuration and setup instead 7 PW native fields On "Home" administration page want to have global config options (stylesheet, development or production mode), and SEO settings fields. On category pages need to have options to change number of children in list, provide option to select different layouts, and SEO settings fields. Conclusion, need to have 7 fields: stylesheet (select), development (select or check), SEO fields (eg. title, description and robots), limit, layout. Create field "setup" with all needed subfields: But also want to have different field layout inside Home and category pages. For that we use "Compact view" inside template setup. Result, same field but with different inputs and layouts. On site are dozen of categories and want to find where are used grid and where list layout. Or, website is in still development mode and want to find NOINDEX categories, etc... 2) Multiple different textareas on "basic-page" and "basic-page-2" templates using 1 single field Task: - textarea1, textarea2 and textarea3 on basic-page template - textarea1, textarea4, textarea5 on basic-page-2 template - all that with 1 PW field Create field "content" with 5 textarea field types (textarea1...textarea5) Set Visibility condition like this: basic-page=textarea1, textarea2, textarea3 basic-page-2=textarea1, textarea4, textarea5 Inside Action tab add field to templates basic-page and basic-page-2. Later in page administration are only desired textarea inputs. Search: find all pages where textarea1 contain word "Toronto" $items = $pages->find('content.textarea1*=Toronto'); Or in admin backend using lister: In front side: $selector = 'content.textarea1*=Toronto'; $items = $pages->find($selector); if($items->count){ echo "<h2>Find items: {$items->count}</h2>"; echo "Selector:<pre>$selector</pre>"; foreach($items as $item){ echo $item->title .', template: '. $item->template->name; echo '<br />'; } } Note: this example is only for demostrations and I didn't test this in case of few thousands pages.
  14. OLSA

    DarsVaeda sorry your project task It's not perfectly clear to me, but answer on last question is that repeaters create pages. That pages you can find deep inside Admin page tree (under title "Repeaters"). Repeater field has own table just like other PW fields and changes are happen inside cell "data" (rewirite when adding new repeater items), but also when we press "Add new" that add rows inside table_pages. Or, in short, repeaters also create nested pages. To get content from some repeater field PW need to get data from more rows inside more tables. Because of its complexity repeaters use more resources. ---- "...you generate one field but are able to use that one field several times.." I think that someone write about commercial, here is textareas maybe that? ----- I read this topic few times, and still it's not clear to me what you want to get, but if I want to get less fields (less database tables) and if that task about number of text-areas is static/fixed and never changed (eg. 15 textareas inputfields) I would go with custom fieldtype (eg. with columns "text_area_1", "text_area_2"...). On the other side, if that number is not fixed, and need flexibility, I would go with custom JSON field type. JSON is great in many cases, and as example you can on the fly create "columns/cells", or change/add new atributes, etc... ---- There is and one alternative solution, in theory I think that would work. In short, there is always option with PW to create fields using pages. If this is confused, concept is that inside pages tree, eg. "Fields types" we store pages with "field-types" definitions (eg: textarea-type-1: name, label, placeholder, maxchar, notes, pattern...), later using custom module (to add desired "fields" to "form-template") and through foreach dynamically - on page - create input fields / interface. After submit content could go to some textarea+markup divider in text format, or different, stored in JSON format. Regards.
  15. OLSA

    Hello for all, here is module what I just posted in forum module section. It can store/hold multiple fields values in JSON format, and because of that it can help to reduce total number of fields in project, total number of queries at front-side, and reduce DB storage space. Regards.