Jump to content

yellowled

Members
  • Posts

    284
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by yellowled

  1. Current project has news posts which are supposed to be associated with one or more sections of the site. So the template news-posts uses a field news_sections, which uses the fieldtype Page/Multiple Pages.

    Now, on the index page of any given section (which are child pages of Home), I would like to emit a list of recent news posts associated with said section, limited to 5 posts. However, I can't figure out a way to use the news_sections field as a selector. The basic API call for this should be something like this:

    $news = $pages->find("template=news-post, limit=5");
    

    so my idea was to use something like

    $sectionId = $page->id;
    $news = $pages->find("template=news-post, news_section*=$sectionId, limit=5");
    

    but that doesn't work because the field type doesn't accept *= as a selector operator. Am I doing it wrong or is this fieldtype simply not meant to be used in a selector?

  2. At the moment it only supports all day events (as these are all I have dealt with) but I hope to add time based events soon.

    Any chance of adding this any time soon? :)

    My suggestion would be to point to this thread in the module documentation. It may be because I'm not a skilled PHP coder, but I got along much better once I read your posts here.

  3. The above sitemap template works well for a simple site. But what if you have some pages that have a "hidden" status? They won't appear in the sitemap, nor will any of their children. If you want them to appear, then you would want to manually add them to the what is displayed. To do this, retrieve the hidden page and send it to the sitemapListPage() function just like you did with the homepage:

    <?php
    
    // get the homepage and start the sitemap
    // (this line is included here just for placement context)
    sitemapListPage($pages->get("/"));
    
    // get our hidden page and include it in the site map
    sitemapListPage($pages->get("/some-hidden-page/"));
    
    

    While this works, it doesn't really include the hidden page in the sitemap but adds it to it, i.e. both the root page and the hidden page (including their children) are list items of the sitemap. In my case, the hidden page is technically a child page of the root page, so it should be included in the root pages list item as a child. (I know I could "simulate" this in terms of looks with CSS, but I prefer to have the "proper" markup.)

    Is there a way to achieve this?

  4. Small issue with this module: It assumes that jQuery is referenced in the <head> of the html, which quite a lot of people (including me :)) don't do. For perfomance reasons (and because it's the HTML5 boilerplates default), I like to reference jQuery before the closing </body>.

    I assume it would suffice to edit the FieldtypeGMap.module like this:

    $event->return = str_ireplace("</head>", "$css\n</head>", $out);
    $event->return = str_ireplace("</body>", "$js\n</body>", $out);
    

    (haven't tested it yet), but that's of course not safe in case of an update to the module. It would be more flexible to have this as an option in the module. Also, the script call in the content area should probably go there also.

    I'm fine with adding a Google Map manually if this is not feasible for the module as a general option, I just thought I'd mention it. :)

    • Like 1
  5. Okay, so I'm different. Usually, people want to exclude stuff from an automagically generated navigation – I would like to add stuff. :)

    Let's see if I can explain this: I have a primary navigation which this module is just perfect for. But the site also has a secondary navigation in the footer, so there should be an item in the primary nav which skips to said secondary nav in the footer. So basically, I would have to append an item to the nav generated by the module, technically another list item containing a link to an anchor on the same page.

    Conveniently, this "skip to service nav" item would be the last item of the primary navigation, so I came up with this:

    'outer_tpl' => '<ul class="clearfix">||<li><a id="skip-to-service" href="#service">Service</a></li></ul>'
    

    which works fine unless I'm on a page which has children (<li class="current has_children">). In that case, outer_tpl is "reset" to '<ul class="clearfix">||</ul>' or something, at least the "appended" list item is not rendered.

    Not being a PHP coder myself, I can't figure out if this is intended behaviour of the module or maybe a bug. (Although I'm aware I might be misusing 'outer_tpl' here.) I also thought about different approaches to realize that kind of nav item, maybe by using a "dummy page" or something, but I can't figure out how to do that. (Suggestions welcome, of course.)

    • Like 2
  6. See, this is what I love about ProcessWire.

    I was just in a meeting, and the question came up whether it was possible to export a list of events and dates as a calender, i.e. in iCal format. I wasn't sure about it, but I took a wild guess that there would be some way to do this. Back at home, checked the modules page, BAM, there you go.

    For someone like me who is not able to do "real" PHP coding, this is a life saver. Thank you so much. :)

    • Like 2
  7. Why? :) I've never had the feeling I need to edit them directly in the file.

    I actually did. Why? First of all, I prefer working with larger amounts of text or code in my favourite text editor over working in a web frontend any time. Second, using search/replace mechanism would've made it much easier to keep the translation consistent. There are quite a number of phrases in the translateable files which are used two or more times. (Which, by the way, is a bit inefficient.)

    I ended up not using my favourite editor (which can handle .json files) because the language .json files are minified and apparently use some kind of escaping for special characters (like German umlauts). I didn't want to risk losing work over some weird side effects of using an editor.

    • Like 2
  8. 2. What is the process for moving an exisiting html/css site into Processwire?

    Like with most CMS, you would convert your HTML into a PW template, basically replacing anything which will be generated dynamically by PW with PHP tags/PW API calls. There's a standard template in /site-default/templates/ of the PW download archive which you can use as a boilerplate. Have a look at the .php/.inc files in there. Basically, you need to reproduce your site's HTML structure there, replacing the parts which will later come from PWs database with the appropriate PHP tags/API calls. You can also replace references to the standard template's CSS and JS files with references to your own CSS/JS, or you can just leave the CSS/JS references and replace the content of those files with your own CSS/JS.

    As it is most of the time with PW, it's entirely up to you. (And that's great about PW, at least in my book.)

    Now, what's generated dynamically? Well, that really depends on what you want PW to do. Typically, all page content and the navigation are generated dynamically. You'll find examples for generating a navigation in the standard template, but there's also soma's excellent MarkupSimpleNavigation module. The standard template also has templates for a search function and a sitemap – you might or might not need those in your site.

    Hope that clears that part up a little. :)

    • Like 1
  9. Small hint to people using language packs. If you happen to have a custom admin theme installed, you need to add a translation for the /site/templates-admin/default.php to translate the admin top menu and profil, logout text.

    I realize it would mean some extra work for admin theme authors, but wouldn't it be possible to use language variable in the admin theme? Most of the admin themes I checked out seem to be older than the whole multi-language feature, so I just assumed what would be why they don't use translated variables …

    @yellowled the Translation/Language module itself seems missing, or is that not translatable yet? :) But so far great work!
    Found /wire/modules/LanguageSupport/ProcessLanguageTranslator.module
    That file has no translatable phrases
    

    Nope. :)

  10. I was aware that might be an issue, but I really don't like GitHub repos without any README notes. If anybody knows how to make GitHub exclude said README files from GitHub downloads, do tell. :)

    Other than that, great to hear it's not an issue with PW, I haven't gotten around to testing the GitHub zip on a fresh install.

  11. I had some time at hand and nothing else to do, so I went ahead and translated some more. All 70 language files translateable as of PW 2.2.2, to be exact. Someone please double-check these. I'm sure they're far from perfect, and I'll gladly accept any suggestions for better translations or hints to typos. I'll also continue to refine some of the translations, but after this little bulk translation marathon, I need a break. :biggrin:

    I also put them in a GitHub repo:

    https://github.com/y...wled/pw-lang-de

    • Like 5
  12. Since I'm going to need these in a project soon, I took the liberty of updating these a bit. I didn't edit any of Nico's translations, I just cleaned out some abandoned ones and filled in most of the blanks (not the ones which make perfect sense untranslated).

    For starters, it would be great if other German native speakers could check these out. I'm sure there's a typo here or there. :rolleyes:

    de-de_2012-05-26.zip

    • Like 1
  13. ProcessWire will call setlocale() for you if the locale is defined with the language pack. In your language pack, you can look in the translation file for /wire/modules/LanguageSupport/LanguageSupport.module, and it should be one of the translation lines in there.

    Doesn't look like it for the German language pack. I grepped across all (installed) files in /wire/modules/LanguageSupport/, which gives me this in LanguageSupport.module:

    $locale = $this->_('C'); // Value to pass to PHP's setlocale(LC_ALL, 'value') function when initializing this language
    // Default is 'C'. Specify '0' to skip the setlocale() call (and carry on system default).
    if($locale != '0') setlocale(LC_ALL, $locale);
    

    But, and I remember reading something about this in another thread regarding the datetime field, I'm on a Ubuntu machine, and apparently, Ubuntu uses some non-standard localeds. Setting it to "de_DE" for instance does not work, it has to be set to "de_DE.utf8" (which looks weird to begin with). Could be related to the fact that this is Ubuntu desktop, not server.

  14. However, attached is a template file (basic-form.php) that is ready to use as a basic contact form with the default site profile.

    Just so I don't get this mixed up: This example template is sort of a "standalone solution" for contact forms, right? It works without the the FormTemplateProcessor module?

    Edit: Yes, it does. Might not be the ideal solution for anyone, but works just fine for most of my purposes. (Although a form builder would still be a neat feature.) :)

  15. (Assuming the might become a FAQ.)

    I was just wondering: is there a list of PW modules not shipped with the core? Does anyone bookmark all of them in delicious or something? Because sometimes, especially when evaluating PW for a project, this might come in handy. It might also be a nice idea to categorize such a list, maybe add a status (alpha, beta, stable) for each module …

  16. I have to admit this is too much whitespace for me, but you probably get that a lot. :)

    Maybe developers approach the site differently than "usual" visitors. When I saw the index page, I was instantly wondering if something was broken or not loaded yet. It does, however, make you curious to explore the rest of the site, which is a good thing.

    Very nice idea for the design/development/cms credits.

×
×
  • Create New...