Jump to content

nabo

Members
  • Posts

    110
  • Joined

  • Last visited

Everything posted by nabo

  1. Sorry, maybe I was not too clear... $exhibitions = new PageArray(); foreach ($events as $event) { foreach ($event->event_exhibition as $exhibition) { $exhibitions->append($exhibition); } } $exhibitions->sort("event_first_date"); foreach ($exhibitions as $exhibition) { echo $exhibition->parent->title; } This change $exhibitions->append($exhibition->getForpage()); doesn't work. I think "parent" works for page but not for repeater
  2. Hi $exhibitions = new PageArray(); foreach ($events as $event) { foreach ($event->event_exhibition as $exhibition) { $exhibitions->append($exhibition); } } $exhibitions->sort("event_first_date"); each event use repeaters for exhibitions. I need to print all exhibitions but at the same time I need the title of the event... I tried $exhibition->parent->title.... but it's not working
  3. nabo

    Meta title

    Sorry... it was a problem with field access!!
  4. Someone has already asked but... no way for multi-language? I think that multi-language support should be the first thing to take care when developing a new module
  5. Hello I discovered a very strange problem I can not how to solve... I use this $meta_title = $page->meta_title!="" ? $page->meta_title : $page->title; In normal navigation everything work perfectly... but in private mode (incognito), system seems to ignore meta_title and writes the page title. Any idea??
  6. Hello is there a way to generate a different size image via api during the same process of import? product->setOutputFormatting(false); $product->images->add($file_url); $product->save();
  7. Hi all... i tried and searched (maybe not enough, sorry ) I've got an offer template with a multiple page reference with stores. I would like to get all offers associated with a store. Template: offer store -> page reference (multiple)
  8. Sorry all... found it!!!!!!!!!! I need to activate other languages for any single store! Is there a way to do a massive update?
  9. But strange thing.... the store url, in other languages than default, exists and it works
  10. Hello... I search a lot but no results I've got a simple selector $items = $pages->find("template=store"); I've got result with default language... no results with other languages
  11. Hi @Zeka very easy indeed!!! Thank you very much!
  12. Hi @Zeka thanks, but in this case I think I will find all pages that with template store and repeater_field.hours = 10. I come with an example. These are the fields in my repeater: days hours I'm in the store page and I want to find only hours related to the day, for example friday. The example you provide me is not what I need
  13. Hi I've got a template for a store and I use repeater for opening hours. When I'm on the store page I would like to search inside this repeater to find the hours related to a precise day. Is it possible with selectors?
  14. Hello I wrote a function that read files tree from a folder and rebuild the structure with PW templates. I tested it on a frontend template and it works perfectly. Now I'd like to call this function inside backend by simply clicking on a link on the main menu. How can I achieve this? thanks
  15. I meant, not create, but choose from a list like other attributes. Anyway I solved with class as you wrote.
  16. Hi I'm implementing uikit on a theme. It can be useful (and in my case necessary) the opportunity to add data-attributes to ProcessPageEditLink, with or without values. Example <a href="my-image.jpg" data-uk-lightbox>...</a> <a href="" data-uk-lightbox="{group:'my-group'}">...</a>
  17. Thanks for the tip, but I was not able to reach my goal. I edited LanguageFunction adding a new condition
  18. Hello is there a way to avoid default language in TRANSLATABLE STRINGS if the value of the language set in frontend is empty? $this->_("Hello"); If there's no translation in other language I wouldn't see "Hello"
  19. Solved!!! Hope can be useful This is the class class SeoTemplate extends WireData implements Module { public static function getModuleInfo() { return array( "title" => "SeoTemplate", "summary" => "Module for add seo_rules field to template.", "version" => "0.0.1", "autoload" => true ); } public function init() { $this->addHookAfter("ProcessTemplate::buildEditForm", $this, "appendFieldToForm"); $this->addHookBefore("ProcessTemplate::executeSave", $this, "saveSeoRuleField"); } public function appendFieldToForm(HookEvent $event) { $languages = $this->wire('languages'); $template = $event->arguments[0]; $form = $event->return; $field = $this->modules->get("InputfieldText"); $field->attr('id+name', 'seo_rules'); $field->attr('value', $template->seo_rules); if($languages) { $field->useLanguages = true; foreach($languages as $language) $field->set('value' . $language->id, $template->get('seo_rules' . $language->id)); } $field->label = $this->_('Seo rule'); $field->description = $this->_('If you want to add a custom rule to MarkupSEO'); $field->notes = $this->_('To define a variable use {title} syntax'); $form->insertAfter($field, $form->tags); $event->return = $form; } public function saveSeoRuleField($event) { $template = $this->templates->get($this->input->post->id); $template->set('seo_rules', $this->input->post->seo_rules); $languages = $this->wire('languages'); if($languages) { foreach($languages as $language) { $template->set('seo_rules'.$language->id, $this->input->post->{"seo_rules__$language->id"}); } } } }
  20. Thanks @kixe. New field is perfectly loaded after tags in advanced tab. But when I try to save I've got an error Error: Uncaught Error: Call to a member function set() on null on line $event->object->template->set('seo_rules', $this->input->post->seo_rules); Error: Uncaught Error: Call to a member function set() on null in
  21. thanks @kixe as you can see my code is very bad, thanks for suggestions
  22. Thank you @kixe! I've seen that hook and I begun to code a little snippet... public function init() { $this->addHookAfter("ProcessTemplate::buildEditForm", $this, "appendFieldToForm"); } public function appendFieldToForm($event) { $frm = $event->return; $field = $this->modules->get("InputfieldTextLanguage"); $field->attr('name', 'seo_rule'); $field->attr('value', $template->seo_rule); $field->label = $this->_('Seo rule'); $field->description = $this->_('If you want to add a custom rule to MarkupSEO'); // Description for field tags $field->notes = $this->_('To define a variable use {title} syntax'); $form = $frm->find('id=advanced')->first(); $form->insertAfter($field,"tags"); } But when I try to install, viewing a template return me an error on line 35 $field->attr('name', 'seo_rule').... maybe because field doesn't exist?! Don't know how to create
  23. Hello I would like to add a custom field to template to extend a functionality of MarkupSEO module. In that module there's a very nice setting that lets you configure a title structure for <title> tag, for example {title}, {sitename} etc. But this configuration is valid for every template. I thought that it would be better if I can configure this setting by template: in fact for product template I could use {title}, {category} and so on to create a dynamic title. I began to write a module, but I stopped early because of an error. I think this is why I am at the beginning of PW experience and I missed something. I was inspired by this module https://github.com/BitPoet/TemplateParent... the goal is to have two InputfieldTextLanguage (title and description) under the Advanced TAB in Edit Template. Any idea or suggestion are appreciated, thanks!
×
×
  • Create New...