
Sten
Members-
Posts
68 -
Joined
-
Last visited
Everything posted by Sten
-
InputfieldPageName phonetic support to create slugs
Sten replied to Sten's topic in Multi-Language Support
@Robin S Yes good idea. OK I understand why it is better haver easySlugger inside the module. Besides I have written to Javier Eguiluz to inform him about our work. -
InputfieldPageName phonetic support to create slugs
Sten replied to Sten's topic in Multi-Language Support
@netcarver Yes sure, this is the aim with help of @Robin S -
InputfieldPageName phonetic support to create slugs
Sten replied to Sten's topic in Multi-Language Support
@Robin S thank you, I tested your module, it works very well with Hebrew. I only put the Javier Reguiluz' app inside the vendor directory to be able to update it with composer. I'll test it more and tell you. Yes I saw it too. I am grateful for your work. -
InputfieldPageName phonetic support to create slugs
Sten replied to Sten's topic in Multi-Language Support
Hello, I began by creating a simple module to slugify the page name. <?php include $_SERVER['DOCUMENT_ROOT']."/vendor/javiereguiluz/easyslugger/src/SluggerInterface.php"; include $_SERVER['DOCUMENT_ROOT']."/vendor/javiereguiluz/easyslugger/src/Utf8Slugger.php"; use EasySlugger\Utf8Slugger; class SlugifyExplicit extends WireData implements Module { public function init() { $this->addHookAfter("Pages::added", $this, "slugifyExplicit"); } public function ___slugifyExplicit($event) { $pages = $event->object; $page = $event->arguments(0); $page->name= Utf8Slugger::slugify($page->title); $event->return = $page; } } The name is OK but is is not saved in database. Someone has an idea ? -
Thank you Rick, your tip helped me much. I used $page->cat->id; Now it works ?
-
Thank you Dragan, I do that then i want to transform data to display in my template : $view->set('categorie',${"cats_".$lang}[$page->cat]); Here I have an array for each language. $page->cat displays an integer, I tested it. If I replace $page->cat with an integer to test, it works but with the expression as a key, it does not work.
-
Hi, I have a lot of difficulties with getting a field value. First I created a template, inside I created several fields two fields are a dropdown select box So I have a value and a label for each line. Then I want to get the field value in _init.php or in the template to display it. How can I get the value of a field for the page ? I need to understand the flow through which data goes. Could someone help me ? Thank you
-
InputfieldPageName phonetic support to create slugs
Sten replied to Sten's topic in Multi-Language Support
Thank you Robin for your help, I will follow your advice and see the Adrian's code to create this module this month. -
Hello, I still did not solve my problem about Hebrew letters. In fact, it is ok for Russian for example to have a transliteration of characters (one to one) but in languages like Hebrew, Arabic, it is better to slugify with phonetic like here : use EasySlugger\Utf8Slugger; $slug = Utf8Slugger::slugify('日本語'); // slug = ri-ben-yu $slug = Utf8Slugger::slugify('العَرَبِيةُ'); // slug = alrbyt $slug = Utf8Slugger::slugify('עברית'); // slug = bryt So I am planning to insert https://github.com/javiereguiluz/EasySlugger Should I create a module or just add a hook ? I am a PW newbie. Thanks for your help
-
Russian titles translated into names with latin letters but not Hebrew
Sten replied to Sten's topic in Multi-Language Support
Great! Thank you Zeka. This CMS is great! -
Russian titles translated into names with latin letters but not Hebrew
Sten replied to Sten's topic in Multi-Language Support
Well I saw about /module/edit?name=InputfieldPageName So has someone a list for Hebrew transliteration in latin letters ? Thank you -
Hello, This is not directly about language module but I think I can get information from you. Can I add a vendor module to have all languages written automatically into name? I used this vendor module which is good with any language (hebrew, arabic...). How could I add it, so admin interface can use it ? Thank you
-
Yes Thank you Wanse. Yes it works. Well I will use this way.
-
Hello Jmartsch and Wanze, It is great to be assisted, thank you ?. I changed my config to have the global file field empty. So I put all my *.twig files in the views directory. I created partials directory for parts included in base.twig. So I keep home.twig and engagement.twig in views. in home.twig I have {% block home %} <div id="corps"> <div id="titres"> <div id="titre">{{ page.title }}</div> </div> <div class="hr"></div> <br> {% block engagement %}{% endblock %} {% endblock %} In engagement.twig, I have {% extends 'home.twig' %} {% block engagement %} <p>His cognitis Gallus ut serpens adpetitus telo vel saxo iamque spes extremas opperiens et succurrens saluti suae quavis ratione colligi omnes iussit armatos et cum starent attoniti, districta dentium acie stridens adeste inquit viri fortes mihi periclitanti vobiscum.</p> <p>Mensarum enim voragines et varias voluptatum inlecebras, ne longius progrediar, praetermitto illuc transiturus quod quidam per ampla spatia urbis subversasque silices sine periculi metu properantes equos velut publicos signatis quod dicitur calceis agitant, familiarium agmina tamquam praedatorios globos post terga trahentes ne Sannione quidem, ut ait comicus, domi relicto. quos imitatae matronae complures opertis capitibus et basternis per latera civitatis cuncta discurrunt.</p> {% endblock %} But still engagement block is not displayed.
-
Hello @Wanse and all of you, This plugin is a must, thank you Wanse. For 2 days I have been searching, I guess I have a pattern problem with my twig templates. My global template is base.twig Inside I have {% block home %}{% endblock %} and several includes parts. Nothing from this block is displayed. It works only if I keep my global template file field empty. In my home.twig I have {% extends 'base.twig' %} {% block home %} <div id="corps"> <div id="titres"> <div id="titre">{{ page.title }}</div> </div> <div class="hr"></div> <br> {% block engagement %}{% endblock %} {% endblock %} What do you think ? In my base.twix I have all my html code... Thank you
-
Hello Sephiroth, Thank you for your tutorial, it is very precious although this code above does not work for me. I had {% block content %} {% endblock %} which had no problems but did not display the block content. Thank you for any help. Sten
- 11 replies
-
- processwire
- twig
-
(and 1 more)
Tagged with:
-
Hi, Is it possible for home.twig or any other template to be inserted inside a other larger template which is like an empty enveloppe, a template parent ? And at the same time to have placeholder from several part ? Thank you