Jump to content

Travo

Members
  • Posts

    15
  • Joined

  • Last visited

Everything posted by Travo

  1. I solved it like this: class Lookup { public static function COUNTRIES($pages) { return self::dictionaryFromField(self::getLookupPage($pages)->Lookup_Countries); } protected static function getLookupPage($pages) { return $pages->findOne('template=lookup-page, include=all'); } protected static function dictionaryFromField($fieldValue) { $returnDictionary = []; foreach (preg_split('/\R/', $fieldValue) as $line) { $explodedLine = explode(':', $line); $returnDictionary[trim($explodedLine[0])] = trim($explodedLine[1]); } return $returnDictionary; } } Obviously, I have a lot of other lookup lists besides countries there.
  2. Thanks. I went for what I initially had as well: a TextareaLanguage field on a page, containing a formatted list (one per list, key and value separated with a colon). I also implemented a translation strings file.
  3. How would I go about translating a long list of variables? For example, I have defined a list of all possible languages as a PHP dictionary, but writing each one down by hand would be too much work (I have about 500 entries in total, including languages and countries), Is there way to import the translation values from JSON? public static function LANGUAGES() { return [ "tk" => _x("Turkmen", "language"), "ku" => _x("Kurdish", "language"), "ht" => _x("Haitian", "language"), [.....snip.....] ]; }
  4. Same issue in ProcessWire 2.7.2 for me. Uhm? --- Edit: Fixed it: https://github.com/justonestep/processwire-simplecontactform/pull/4
  5. You don't need to thank me for using it... Thank YOU for making it! I guess I'll just wait for the next big update then. I currently have everything set up nice and it's working, so I can wait.
  6. Thank you for your work Kongondo! I have a slightly silly question: is there a way to keep up with updates even after changing some stuff in the module files? I reworked some of your blog functions return values to make it match my design (jalgrattur.eu/blog/).
  7. Thank you for the suggestion! Making a new textarea fixed my issue! And during the creation... I think I found what caused the issue, I will try to explain it in points: When you've created a textarea field and its input type is still 'Textarea', you have different settings available. (http://i.imgur.com/M27haJB.png) One of these settings is 'Strip tags', which removes all HTML tags. (http://i.imgur.com/oQO9YCU.png) When you check the setting and switch to CKEditor, the 'Strip tags' setting is still enabled in the background, but you can no longer see or edit the setting. That's what caused the problem for me. Sounds silly and frankly, even I don't know why I decided to enable it. Hi Kongondo, thank you for moving my topic and for your concern. Could you please delete the double post that happened due to the move of my post? Thank you in advance. PS: I love your Blog module! It is awesome in many ways and your work is greatly appreciated!
  8. Hello! I have encontered an issue where CKEditor seems to remove all formatting and spacing of my writings when I save the page. I've tried turning off all settings related to purifying the HTML. The issue persisted. Here are the before and after images: Before save: http://i.imgur.com/EycqKO9.png After save: http://i.imgur.com/SQn7gss.png The whole content becomes one paragraph (<p>everything</p>). ProcessWire version 2.5.3 (no idea how it got to 2.5.3 though, I downloaded 2.5.2).
  9. Hello! I have an issue where saving the page will remove ALL the formatting from the CKEditor textarea input field. I've gone through all 'HTML purifier' type of settings, disabling all, but the issue persists. What am I missing?! What's causing this?
  10. Thanks for your contribution, but you're wrong. I'll write it out as page locations. First menu item acts as the 'intro page'. Main/Andmebaas/Bicycles Main/Andmebaas/Bicycles/Roadbikes Main/Andmebaas/Bicycles/Mountainbikes ... In order to get the first page to display everything correctly I have to get its children pages directly ($page->children). If I am on the following pages (Roadbikes for example), I have to gets its parents' (Bicycles) children ($page->parent->children). I hope you understand.
  11. I hardcoded the page name and ended up with this, works fine: <?php $alalehed = $pages->get("/andmebaas/")->children; if ($alalehed->get("id=$page")) { $children = $page->children; $children->prepend($page); } else { $children = $page->parent->children; $children->prepend($page->parent); } foreach($children as $child) { $class = $child === $page ? " active" : ''; echo "<li class='sidesub$class'><a href='{$child->url}'>{$child->title}</a></li>"; } ?>
  12. Hello, I return for further assistance! I am currently facing an issue where I want to code something as simple as a menu, but fail to do so without it losing its flexibility (I don't want to hardcode any ID-s or names into it). I'll keep it short: The first menu item is the parent, all the others are its children. How would I go about retrieving the parent and its children information even when I navigate between the two? My current code is basically the same as the default one: retrieve children and add the parent as the first array item. And obviously, this breaks when I open the parent page. $children = $page->parent->children; $children->prepend($page->parent); foreach($children as $child) { $class = $child === $page ? " active" : ''; echo "<li class='sidesub$class'><a href='{$child->url}'>{$child->title}</a></li>"; }
  13. Hey! Currently, my menubar gets all the pages and lists them (almost the same way it was by default). When I hide the page in my settings, it really messes up my non-hardcoded menubar. To hide the 'first' page in the children pages list, I just hid the first entry, since by default, it is the first one and shouldn't really screw things up. ... As I was writing this, I could also make a check that would compare the child page names against the parents name and hide if true. Great support on this forum, thanks a lot! Glad I found ProcessWire. I previously tried WordPress (didn't really match my requirements theming-wise and was too cluttered with stuff my page would never use). I also tried ForkCMS (also didn't have the flexibility of ProcessWire).
  14. Thanks for the fast response guys! Redirect was in my mind, but I honestly thought there's a better way to do it. And to remove it from displaying in the menubar list I could just rewrite the code to ignore the first entry, yeah? Thanks again.
  15. Hello! I am new to ProcessWire (obviously) and need some guidance, as I don't even know how to put what I'm trying to do into phrases Google could understand. Basically, I have a structure like this: Main page --> Cars --> --> Volvo --> --> Iveco So, the Volvo and Iveco are both 'Cars' child pages. Following me? Ok, great! What my goal has been for the last hour is basically trying to make 'Volvo' the main page when 'Cars' is clicked. I'll try to make it simpler: When I click on 'Cars', I want to see 'Volvo'. I don't want 'Cars' to be a separate page. I want 'Cars' to be VOLVO and IVECO!
×
×
  • Create New...