Jump to content

Jan Romero

Members
  • Posts

    612
  • Joined

  • Last visited

  • Days Won

    15

Everything posted by Jan Romero

  1. You could redirect the images to a php file that decides which version to serve. That way you can serve the same cached version of the page to everyone, but when the browser requests the image file, the login check is performed. However, are the images really the only difference between signed-in users and guests?
  2. I assumed $feature to be the variable from the foreach you posted above. I don’t know the blog module you’re using, though. Do you know the PHP syntax at work in that line? The curly braces are optional for readability. As you probably know, a $-sign indicates a variable. In the case of $feature, it holds one of your categories. So for each of the categories you fetched, it finds 2 pages with that category. Categories are not a “built-in” feature of ProcessWire. The selector I posted assumes your pages have a page-reference field called “category”.
  3. Excellent question. I’ve been having this problem as well. So far I haven’t found a better way than disrupting markdown with zero-width non-breaking spaces, e.g. ***⁠*This is bold****. Edit: note how I was going to use a zero-width non-breaking space inside the entity above to keep that from rendering, but decided against it so you could just copy it. So be aware if you use this method, your users won’t be able to copy your example code from your field description and try it out in the field.
  4. Well you seem to have pretty much formulated the selector you want already You can get the most recent entries by using the built-in “created” field. And because you want the creation dates in descending order, you prefix that with a hyphen: sort=-created, limit=2. Like you said, you can repeat this selector 3 times, or maybe you want to foreach over the categories you have already fetched, for a more dynamic approach. In your example: category={$feature}. $pages->find("template=post, category={$feature}, sort=-created, limit=2";Or if the posts are children of their categories, you may want to do it even more simply: $feature->children("template=post, sort=-created, limit=2";If you have more questions on selector strings, have a look at the docs: http://processwire.com/api/selectors/
  5. I’d say give the current dev version a whirl and update when 2.5 is released. Check out the dev branch thread in the announcements forum. A bunch of people are already running dev on production sites, as it seems. https://github.com/ryancramerdesign/ProcessWire/tree/dev https://processwire.com/talk/topic/3768-processwire-dev-branch/page-13 edit: eh, beaten. Copy and paste is a bit tedious on mobile
  6. You should really think about keeping the markup constant and only changing the CSS. Preferably you would toggle a single class on your container (a <ul> probably) via JS and save the preference to $session through AJAX. Of course, I don’t know your requirements, but all this seems really complex. Even if you really do need to change all the markup (do you want to display different data or do you want to display the same data differently?), you might want to build it entirely in JQuery using AJAJ data or something.
  7. It depends on what you have. If you have the specialty as a string, you can select for the page’s title field like so: $pages->find('template=physician, specialty.title={$search}'); If you know the specialty’s page-id or path, that should work as well. For example on a specialty page, you would want to list all physicians that have that specialty: $pages->find('template=physician, specialty={$page->id}');
  8. You can create a template called something like “category” and use that to predefine your tags. Then you use a page field to select from those. You can find pages that reference a specific page via a page field by using a selector such as $pages->find("categories=$page"); If you put this line in your category-template for example, you would get all pages that reference that category in their page field called “categories”. Alternatively, you can use a simple text field for tags, then split that up into an array of individual tags and link each to a search page that selects pages by doing a full-text search on the same field.
  9. For anyone curious, Nico is referring to this thread. It’s a good read.
  10. Thanks for the reply! I don’t know exactly what the problem was, but I think I got it running. I var_dumped through modules.php until I found the place and the module that were causing the problem. Thankfully it was only the fourth or fifth module (LanguageSupportPageNames). The point where it broke was if($module instanceof Module) in getModuleInfo(), so I added a condition that called getModuleInfoExternal() specifically for LanguageSupportPageNames. With that, PW ran fine and built the module cache. Now I’m running the unmodified wire folder without any problems. I’m guessing it was something I caused, though I’m not sure how. My PHP version is 5.3.28. The upgrade is great, by the way. I’m acting very ungrateful here. Really, I couldn’t be happier with ProcessWire
  11. Not sure if I should make a new topic for this, but yesterday I tried to install the latest dev branch on a site and broke it completely. No errors, no HTTP status, just the my browser’s “connection reset” page. I tried different versions and found this to be the earliest non-working commit. I noticed System Update 7 didn’t run, but changing the DB manually didn’t help. I’m also running a different site on the same server configuration, which accepts the upgrade just fine. It seems to be something to do with the 3rd-party modules I didn’t uninstall. It’s a multi-language site with the Textareas profield. Any pointers would be greatly appreciated!
  12. From what I understand, OR-groups are not needed here, since we only want to OR two values in the same field. Selecting login_end=1406930400|1416524400 works, so why doesn’t login_end=0|1416524400? 0 on its own matches empty datetime fields. The SQL error is "not unique table/alias", so that looks more like a bug. LostKobrakai’s solution is the best anyway, though.
  13. If you want to display the images in the admin page tree, this module should be what you're looking for. Or are you asking how to render images on your site? Try <img src="<?php echo $page->MyImageField->url; ?>" />. We will be able to help you better if you explain your template setup and your goal in more detail.
  14. Note that users are pages in processwire. You can see them in the page tree under Admin › Access › Users. The API shows you how to create a new user programmatically at the bottom of this page. If you want to attach more info to a user, you can probably modify the user template directly from the admin backend. Under templates, select Show system templates from the filter menu. Hope this helps you get started! edit: whoops, I somehow expected this to be markdown formatted
  15. Mmmh, I might have to buy one of those prints one day. The bold black and yellow reminds me of http://next.fontshop.com/. Very cool. Edit: although I must say, it's kind of annoying having to constantly move the mouse pointer out of the way when browsing the work pages. A more subtle mouseover would probably work better with images that big. Also, this page doesn't seem to work for me: http://www.nordenswansiirila.fi/en/work/vatt/
  16. Pages can hold references to other pages that go beyond the primary tree relationships with the field type "pages". You can think of them as foreign keys.
  17. The easiest way to link to one specific page would be by ignoring PW entirely and just typing href="/service/" in your template file. Slightly more complex, but giving you powerful advantages would be to grab the page with $pages->get(). You can pass the get function either the page's path as above, or its numeric ID, or a full blown selector string. Then you can use ->url on the resulting page object. At first sight this may seem like an overcomplication when you can just link to the path, but since it gives you the full page, you can make your link text multilingual or display whatever fields alingside it.
  18. The links you generated with <a href="<?=$property->url;?>"> don't go there? Where do they go then? Does the template "properties" have a php file associated with it? That's where you would echo the details using something like echo $page->myDetail;.
  19. I take it you're using UrlSegments for the categories in the parent template? The theory seems sound. There is probably some minor mistake in your parent template. If you post the relevant code that finds the child pages, we can have a look.
  20. Can you show the selector you use to get the pages that belong to one category? I'm not sure what your problem seems to be exactly. It looks like your content pages have a page field to select one or more categories, in which case you can filter by that field like so, where "categories" is the name of the field and $category is the category, whether it's a page object or an ID: $pages->find("categories~=$category"); If no page belongs to that category, nothing will be shown. You could also filter by the categories' titles like find("categories.title~=$string"). Also, you should probably use $category->url instead of $category->name in your category list.
  21. As a workaround, it’s possible to set Minimum Value to 0.1, since the field is actually an InputfieldFloat. This will allow values of 0 but no negative ones. Edit: as a matter of fact, changing the modules used for Min and Max in InputfieldInteger.module to InputfieldInteger (seems sensible anyway?), makes it work as desired, as far as I can tell. 0 values don’t disappear when set and the validation within templates works fine as well. Maybe this change is all that’s necessary?
  22. I get the same error when I try to $cal->find() a month that has an event spanning into it: Error Cannot break/continue 1 level (line 340 Events that continue beyond the loaded timespan are fine. That line goes as follows, and, judging from the comment, I don't want that functionality anyways, so I commented it out. Now my output looks good, although I'm not very comfortable with messing with the code... // filter out events that started before the requested time // these will be multi-day events that span into the requested time if($from && $a->from < $from) continue; The point in my code that throws the error: $items = $Calendar->find("from=$year-$month-1, to=$year-$month-$numdays, sort=date"); Otherwise everything is going super swell, thanks a lot for ProcessWire!
×
×
  • Create New...