Jump to content

adrian

PW-Moderators
  • Posts

    10,901
  • Joined

  • Last visited

  • Days Won

    348

Everything posted by adrian

  1. PS, Have a read of this to learn more about image fields: http://processwire.com/api/fieldtypes/images/
  2. As Ozwim eluded to: $page->main_image->getThumb('thumbnail');
  3. This should do it. Replace eq(0) with the number of the image in the main_image field. echo $page->main_image->eq(0)->getThumb('thumbnail');
  4. Hi Raul, Not sure if I completely understand your needs and it sounds like you know what you are doing so I might be missing your point, but is this what you are looking for? <option name="subject" value="subject1" <?php echo ($input->get->subject == 'subject1' ? '' selected="selected"' : ''); ?>></option> I am not sure how you are building the contact form and the select options, but likely you will be generating all of the option lines dynamically via a foreach, or maybe you are letting PW take care of it with something like $form = $modules->get('InputfieldForm');. Maybe something like this would work for you: foreach($subjects as $subject) { $selected = $subject->name == $input->whitelist->subject ? " selected='selected' " : ''; echo "<option$selected value='{$subject->name}'>{$subject->title}</option>"; } Hopefully something there will be of use. If not, let us know in more details exactly what you need to do and I am sure someone can help.
  5. Hey Ryan, The only render call in the template is for the pager. Not using URL segments. No manual pager options. I figured out the problem - I have a form on that page that allows a guest user to submit a new child page (unpublished of course). The form code was setting the page template to that of the child page, which was why $allowPageNum = $this->options['page']->template->allowPageNum; was returning false. Sorry for not figuring this out sooner!
  6. Have you seen this thread: http://processwire.com/talk/topic/3392-emulate-natsort/ The code I mention in the last post worked well for me.
  7. Actually I am curious about that if statement in the module to show the url with ?page=n if allowpagenum is off. What is the scenario where you would want that? Sorry if I am missing something obvious.
  8. Yep, I am talking about the MarkupPagerNav module. I simplified my code down to something that still causes the issue to appear. $results = $page->children('limit=10');$out .= $results->renderPager();I have a few different sections on the site like:training >training-items teaching > teaching-items publications > publication-item These represent the parent and child pages and the template names. Some of them work without page number option being on in the child template and some don't. The code is otherwise identical from what I can see.
  9. Comment from Ryan that I think is appropriate: http://processwire.com/talk/topic/1176-hiding-uneditable-pages-from-users/?p=10436
  10. Fantastic enhancement Ryan. I was trying to pass some custom variables to render today and couldn't - found this post, upgraded to dev, and voila! Made things so much easier
  11. I have never used it, but I don't see why not - it has been listed as stable and if it's doing what you want you should be fine. Soma will have a better idea though
  12. I had forgotten about that module. If you want to go the route of adding new fields to the user template, that is easy. Just go to templates and click on filters and show system templates. Then you can add any new fields you want to the user template. @slkwrm - your edit stole my thunder
  13. Ok, I saw some other posts from you about this. Did you end up using some of the code from this post: http://processwire.com/talk/topic/126-anybody-did-user-registrationlogin/?p=4812 Depending on your needs, you could add additional fields to the user template, rather than needing a separate page. Regardless, when the form is submitted you need to check for the existence of the username. If it already exists, return the error and get them to enter a different name. If it doesn't exist, save the user and if you need, add the new page using their new username for the page name. Probably stating the obvious here though. I assume you already have the front-end user registration form working? It sounds to me like you might be better served by extending that to add the page, rather than using the FormTemplateProcessor module. Maybe if you post the code you currently have it might make it easier to add the required functionality.
  14. Does the person creating the page need to have an existing username? That would avoid the need to check. If not, less us know - there are options, but don't want to go too far down that road if you will be using the username of an already logged in user.
  15. A couple of things to consider. Take a look at the sanitizer options for page names: http://processwire.com/api/variables/sanitizer/ One concern with using the title for the page name is name uniqueness. Take a look at this thread for more details/options: http://processwire.com/talk/topic/3262-create-non-duplicate-page-name-via-api/
  16. I haven't used that module, but it looks like it is focused on processing a contact form. So the name of the page is being autogenerated as a datetime stamp ($this->contact->name = date('y-m-d-H-i-s-u');) so it is unique to each user's contact submission - the title is not really relevant for this purpose as I see it. If you want to save user generated content as a page, I would recommend this as a starting point: http://processwire.com/talk/topic/59-module-want-form-builder/?p=11639 You can use the title that the user enters and use it for the page's name. Hope that helps.
  17. This is my second site using pagination. The first worked without a hitch. Now, setting it up on various sections of a new site and all was seeming straight forward until I came across a couple of pages on the site (not all) that needed to have Allow Page Numbers turned on for the child template (the one the holds the items to be paginated) as well. If it's not on, then the links appear as ?page=n. These links don't work (they load the first page), and if you manually enter /page2 as the URL, it works fine. The following lines in the module are what's relevant: $allowPageNum = $this->options['page']->template->allowPageNum; /////////////////// if($allowPageNum) { if($slashUrls === 0) $url .= '/'; // enforce a trailing slash, regardless of slashUrls template setting $url .= "$pageNumUrlPrefix{$item->pageNum}" . $this->queryString; } else { $url .= $this->queryString . ($this->queryString ? "&" : "?") . "$pageNumUrlPrefix=" . $item->pageNum; } It doesn't really matter - I just allow page numbers in the child template too and everything works as expected, but curious why it is happening. Anyone have any ideas?
  18. Makes sense. So you need to somehow capture the page number the users comes from. Not sure how your are linking the user to watch a gallery, but you could append the page number as a GET variable to the link to the gallery so that the back to the overview link includes the page number. Does that sound ok?
  19. I am not sure how a parent page can have a current page number. $page->pageNum will get you the page number of the current page. Perhaps you want the number of pages that would be generated when rendering the parent of the current page? Can you explain your structure and needs in a little more detail?
  20. @Wanze, I wasn't thinking about the first time the front end page was viewed. I guess it is the view of a page with lots of new thumbnails at once that is causing the timeout problem. @Titanium I thought I mentioned the idea of making a proportional option for the thumbnails module somewhere, but can't seem to find the post. Seems to me like it would be very useful and not hard to implement. @diogo I agree, but experience tells me that people are lazy and also can't follow instructions
  21. Although, I thought things like $image->width(1000) were supposed to be cached: http://processwire.com/talk/topic/10-how-do-i-interact-with-the-image-field-in-processwire/?p=20 So I don't know why you are getting the timeout issue. Maybe someone else can enlighten us
  22. This module should take care of what you need: http://mods.pw/1b
  23. Well it sounds to me like you probably only want to be able to filter against things like land_area, living_space, number of rooms, number of bedrooms, number of baths, and price. I think you'll have to do something custom for this. I am still not sure if you have seen the search.php file from the skyscrapers demo, so I have attached it. You should be able to modify that for your needs. In particular, look at the section starting with: foreach(array('height', 'floors', 'year') as $key) { Hope that gives you a starting point - sorry you went down the road of trying out my code - good for what it does, but won't work out of the box for your case. search.php
  24. Well no, not really. It looks like you need to add the name of the images field you are using to the $myfields array. You should also add any other fields that are not page fields. The skyscrapers site has a series of dropdowns that are page fields. Is this what you are looking for? I have attached what I see with my code. To get the search term field you need to uncomment those two sections in my last version above and make sure that you change: $field->attr('id', 'Inputfield_body'); $field->attr('name', 'body'); to match the name of the field you want to search for those keywords. If you don't want the keword search, you can leave as is. It looks to me like the fields that are showing up in your screenshot are not Page fields. EDIT: Alternatively if this is all seeming too hard, then you could download the files from the skyscraper example and use that code. The reason I like my option is that it is reusable throughout different sections on a site and on different sites - no need to define the filter search form for each usage scenario.
×
×
  • Create New...