Jump to content

landitus

Members
  • Posts

    181
  • Joined

  • Last visited

Everything posted by landitus

  1. Good point Soma. I've done the following, still no luck! $item = $pages->get('/contacto'); echo "<ul>"; foreach ($item->fields as $field) { echo "<li>"; $item->setOutputFormatting(false); $user->language = $languages->get("pt"); $pt_field = $item->$field; echo "Pt: ".$pt_field. "<br />"; $user->language = $languages->get("default"); echo "Sp: ".$item->$field. "<br />"; $item->$field = $pt_field; $item->save(); echo "Result: ".$item->$field; echo "</li>"; } echo "</ul>"; The result is still the same: Pt: Contato Sp: Contacto Result: Contacto
  2. I've tried this with only one page, to simplify it and it doesn't change anything. I've never used the fields api so maybe I'm doing something wrong... $page = $pages->get('/contacto'); echo "<ul>"; foreach ($page->fields as $field) { echo "<li>"; $page->setOutputFormatting(false); $user->language = $languages->get("pt"); $pt_field = $field; echo $pt_field . "<br />"; $user->language = $languages->get("default"); $field = $pt_field; echo $field; $field->save(); echo "</li>"; } echo "</ul>";
  3. Diogo, that thought crossed my mind but have no idea how to accomplish it! It would be nice because I only need the portuguese fields. The site will be only in portuguese I'll give it a try!!!
  4. I have a very unique user case. I have a multilingual site in spanish and portuguese. I managed navigation with the wonderful "Generate and parse localized URL" module. I need know to completely remove the default language (spanish) and instead leave portuguese as the default. This poses multiple challenges I've changed the default language for the guest to portuguese. All the info I need is on the portuguese fields, but I don't mind having the default fields in the admin (for now). I need the urls to be "site/portuguese-title. So no "/pt" or any prefix. I've tried to solve this changing the default language in the URLs plugin but it gets confused somehow... so I've removed the "Generate and parse localized URL" module to try something else. I've activated the new "Languages Support - Page Names" module. Maybe I can change all page names and be done with it. I almost worked!! but now I have spanish and portuguese URLs working at the same time. So I only have to disable the default url and presto! But... I've downloaded the latest dev branch and replaced the "wire/modules/LanguageSupport" folder but I still can't see any checkboxes. I have 2 questions after all this I am doing this the right way? The best way would be to make the portuguese fields the default language and have only one language. Otherwise, I would have to re-enter the info on all pages (+200)... I guess that If I disable the default URL (with the checkboxes) this would be solved. Is there a way to set the "Generate and parse localized URL" module to work with a non-default language (portuguese) and not use any prefix? Thanks a lot!
  5. Thanks Soma! That was it, I really appreciate everybody's help!
  6. yep, both. Actually, "Data" outputs [] and "data" outputs nothing
  7. Thanks for the suggestions, but I still get a [] in the console with this code: <form id='top-search-form' action='<?php echo $pages->get('/busqueda')->url ;?>' method='get'> <ul> <li> <label><?= __('Buscar') ;?></label> <input type='text' name='q' id='search_query' placeholder='<?= __('Buscar') ;?>...' value='<?php echo $input->whitelist('q'); ?>' /> <button type='submit' id='search_submit'><?= __('Buscar') ;?></button> </li> </ul> </form> $("#search_query" ).autocomplete({ source: function( q, response ) { $.ajax({ type: "GET", url: "/busqueda", Data: { 'q' : q}, dataType: "JSON", success: function( data ) { console.log(data); } }); } }); /** * Search template * */ if($config->ajax) { $resultsArray = array(); if($input->get->q) { $q = $sanitizer->selectorValue($input->get->q); $results = $pages->find("title*=$q, limit=50"); foreach($results as $p) $resultsArray[$p->id] = $p->title; } echo json_encode($resultsArray); } else { ... working search code }
  8. Mmm, I tried to add a data option: $("#search_query" ).autocomplete({ source: function( q, response ) { $.ajax({ type: "GET", url: "/busqueda/", data: q, dataType: "JSON", success: function( data ) { console.log(data); } }); } }); But I still get "[]" in the console. I've noticed that "?term=ferr" shows up in the network tab. I guess there's no q for jquery, but uses "term". I haven't found a way to modify this, yet. Does this mean I have to replace "term" for "q" in the search function?
  9. I'm following the code above to make an autocomplete enhancement to a search form using jquery ui 1.8. I made the search template using the same code but I'm having trouble making it to work. I think I'm making a mistake in the js code: $("#search_query" ).autocomplete({ source: function( q, response ) { $.ajax({ type: "GET", url: "/busqueda", dataType: "JSON", success: function( data ) { console.log(data); } }); } }); I'm reading the jquery UI docs but I can't extrapolate a single example to my needs.
  10. I'm trying a similar logic but with Alternate language fields. I have a technical PDF per language and would like to test out if a translation for that file exists and display de language of the PDF with a badge. How should I approach this? I don't want to test a specific field, cause with multiple languages, I don't know how many languages the client will add. I just need to know if the field "pdf_file" is in a certain language and which language is being displayed in. Does this makes sense?
  11. Thanks to Soma and to Michael Murphy for sorting this out!! I've tested the pagination with the module and works!
  12. Hey all! I'm having trouble using the module with templates that support pagination. Once the module is activated, pagination stops working. This is my pagination code: // Pagination $pagination = $proyectos->renderPager(array( 'nextItemLabel' => 'Siguiente', 'previousItemLabel' => 'Anterior' )); But the urls are generated ok, but I'm stuck on page 1. The url shows "http://site/pt/proye...s/page2/page2". I must be missing something, right?
  13. Ryan, I understand that there's a way to have multi-language site using the same url. But I found it interesting that PW generates new urls with the PageTitleLanguage field. I really like this as it's very user readable and friendly. The only drawback I wanted to point out with my message, is that there's no apparent way to refine or change the slug/name for other languages. That would be awesome! Maybe it's something useful and could be added in future versions. Btw I'm checking the Language Localized URL module and posting my findings on the forum as well.
  14. Sorry Soma, but It was a cache thing!! Disregard my last post. I'll try to mold some page titles to see if the plugin works for me.
  15. I get what you mean Soma I'm trying to mold the site to work like the module does, and changed some page names to match the page titles. I had a page name of "featured" (/products/featured/) and a page title of "Featured products". I realize that to make things work I should edit the page name to (/products/featured-products'). Now the problem is those links are no longer generated by the module and are blanc/useless. Tell me if you need some further explanation.
  16. Thanks for the reply Soma. I didn't understand you correctly, thought, I'm sorry The main problem I get is that translated urls are generated with titles and not by reading the page name. I guess this is the one issue I'm getting. Other than that, the disable the default language segment seems useful, at least to me and it's been working for me. Edit: I recently noticed that changing a url slug (name) in a page after the module is activated won't index the link correctly.By what you're saying, the translation URLs can't be generated from the page name, is this correct? So my only solution is to always match the name and titles, it seems. I'm guessing, by the thread that it's not an easy thing to do It seems more logical to use the page name (that is the url) and not the title as sometimes, SEO practices tend to make small differences between them. This is why I'm asking. Please tell me if I understood your response correctly!
  17. Thanks for the reply Soma. I didn't understand you correctly, thought, I'm sorry The main problem I get is that translated urls are generated with titles and not by reading the page name. I guess this is the one issue I'm getting. Other than that, the disable the default language segment seems useful, at least to me and it's been working for me. By what you're saying, the translation URLs can't be generated from the page name, is this correct? So my only solution is to always match the name and titles, it seems. I'm guessing, by the thread that it's not an easy thing to do It seems more logical to use the page name (that is the url) and not the title as sometimes, SEO practices tend to make small differences between them. This is why I'm asking. Please tell me if I understood your response correctly!
  18. Oh! I found what's bugging me. The pages that give me 404's are pages that have differences between the name (url) and title. So it seems that, with the module on, the urls on the anchor links are constructed using the title and not using the name field? I was getting 404's because indeed that page didn't exist. So the problem lies in the anchor link. Do I make any sense?
  19. Hi all! I've been eager to try this module and now I've got 2 projects in the works. I've been having problems with the latest PW (2.2.7). Once activated, I check the 'Disable sub-folder for default language' and now, my original site gets random 404's o some pages (most of them, but not all) while the new translated url work perfectly. I've tried this same logic on another site yesterday running PW 2.2.3 and this worked perfectly. Maybe I missed something, but maybe you can help me out!
  20. It worked with 2.2.7! Thanks a lot for the answer. On another subject, I realized that using the PageTitleLanguage field for titles automatically creates new urls for the languages. But there's no apparent way to refine this, I guess. Check this example: Original field (Spanish) > URL Atención al cliente > /atencion-al-cliente/ New field in portuguese: Atenção ao Cliente > /atenc-ao-ao-cliente/ I would like to refine the portuguese URL to "atencao-ao-cliente". I guess the "name" field should have a translation field below, as well.
  21. It says 2.2.3. And btw, the repeater field is inside a fieldsettab also. Maybe it helps!
  22. Ryan, I've just started with a site translation and stumbled upon this: When using a repeater field that has a title field inside, PW won't save the value of the translation in the title field. Is using a title field inside a repeater allowed? The title is now a PageTitleLanguage field. I'm attaching a screenshot for reference.
  23. I was wondering if multi-language support works with image description fields already, because I have to decide wether to use the image field or a repeater to store image captions.
  24. Hi Soma, Thanks for the module! I've been testing the slider and was wondering if it's possible to make 0.5 (half) increments. It would be nice to have a score Range field and let the user select between 1-5 and half increments (4.5 stars).
×
×
  • Create New...