Jump to content

Hurme

Members
  • Posts

    89
  • Joined

  • Last visited

Posts posted by Hurme

  1. I would perhaps do it something like this:

    Create a page called "siteSettings" or something similar. Good place to keep things like website logo and other global stuff.

    Add page reference field that can have multiple pages and can be rearranged. Lets call it "navPages".

    Select pages in it you want to use in your navigations top level.

    For Resources page, create a page that has the same navPages field in it, and in this field you can choose the blog, case studies and so forth. Resources page doesn't need template file because it will never be visible in the frontend. Add Resources page into the siteSettings->navPages field.

    You'll need to write a function to render out siteSettings->navPages as the navigation.

    Write the logic so that for Resources page (and others using the same template) will build the drop down but wont actually create a link to the non-existing page.

    This will also let you easily add "uk-active" or similar in the navigation, because there is an actualy relation between Resources and Blog as an example.

    The logic in the foreach loop could be something like:
     

    if($page->children() || $page->navPages) {
    	// Keep adding levels to the navigation
    }

     

  2. Only moments after posting this it suddenly started to work. Although it's a little unclear why. In the example images in Ryans post the pages general access management was turned off, but I needed to turn it on before anything happened. Perhaps it's an inheritance thing.

    Next question... how can I make this work per page/user rather than template/role? Or at least per page/role?

  3. Hi,
    I'm experimenting with protecting files from users who haven't logged in.

    Using the $config->pagefileSecure works, but is site wide and I need something where I can set the access per user. Currently it seems you have to be superuser in order to see files secured with this, which isn't very useful.

    I'm running the latest dev version, so I tried the prevent direct access option in the page template. But it does not seem to do anything at all. With a clean installation, and playing around with the direct access settings I cannot make e.g. images non-accessible even when page is unpublished or trashed, or when user is not supposed to have access. It just doesn't seem to do anything at all.

  4. Just a short question about sanitizer->pageName.

    if I have a page title that has scandic letters in it. "Pääskynen" as an example, the pagename will be "paaskynen", but if I use sanitizer->pageName on it, I will get "pskynen" instead. 

    Would it be possible to get what the backend sanitizer does with page names, or is there another sanitizer that works in similar way (changing ä > a instead of dropping letters)?

  5. Well yes, your example is what I'm trying to do. But in this case I get an error when I'm trying to save the "child". I was assuming it was because PW couldn't save those two pages back to back in same operation, so I relegated creating and saving the child into a hook that takes place after the first page has been saved.

    But your example seems to work fine, so I'm just going to go back and check my code.

  6. I need to create a page and then add a children to it when user fills in a form.

    I can create the parent page by putting the code on the form page itself, and then the child by using a pages::added hook and bringing the needed information to the hook via session.

    Is there any more straightforward way of doing it or is this a good approach?

  7. I've always included a "path" to the field when including fields inside a repeaters or matrix fields. I'm not actually sure if it's really needed or if I've just been too meticulous about it.

    matrix_field.regular_field|matrix_field.repeater_field.regular_field

    Perhaps repeaters and matrix fields having their own template has something to do with it.

  8. Hello,
    Any advice on how to hook page, so its fields get populated by something else than the actual saved content?

    The below works fine for frontend (it's in ready.php), but has no effect in front-end editing or backend, and that is the problem here.

    $this->addHookBefore('Page::render', function($event) {
      $page = $event->object;
      $page->exampleField = '123';
    });

    The information doesn't need to be saved into PW itself. It's been fetched and then on save, delivered to another database.

  9. Hey,

    I know there has been lots of discussion on this subject already, but I feel like I need some clarification on the subject, especially in the light of the new $pages->has('selector').

    So lets say we have a site with a couple of million pages and we need to find one or more pages from that pile.

    1) Usually direct database search would probably be recommended at that point, but does the $pages->has('selector') speed things enough to be considered a serious alternative?

    2) If I wish to load a list of all the Names with say one extra field from all the pages, will PW always load the whole page (times million), or is it possible to only get the fields I'm looking for and nothing more?

  10. Yes, that would be nice. Especially since the philoshophy of PW for pretty much everything else is so streamlined.

    Right now it looks like I'll try to manage with the PW's own <edit> functionality or cook up my own solution. Neither of the modules I linked earlier really did anything useful in this case.

  11. Hi @Ivan Gretsky,

    Yes I noticed the iframe now. That's an even bigger bummer.

    Ideally I would like an inline view of the wanted fields, without any kind of modal or iframe at all, so I could customize them as I see fit, while still retaining the drag&drop functionality and other nice features.

    That's probably a pipedream.

    I'm currently looking into these:
    http://modules.processwire.com/modules/front-end-edit-lightbox/
    http://modules.processwire.com/modules/admin-bar/

     

  12. Hello,
    I'm building a site where frontend editing is integral part (you could say the only part) of the sites function.

    Is there any way at all, to humanely customize the frontend editing modals? I've found out that it wont work properly with new jQuery (which is something we use) which is bit of a bummer, but can be solved with jQuery migrate (see link below).

    The modal also looks sort of fugly compared to rest of the site and overriding the appearance with css alone, while not impossible, is a major pain in the ass.

    jQuery issue link:

    https://github.com/processwire/processwire-issues/issues/609

    If customization isn't an option, the next step is probably to build our own forms, but for images and files especially, it would be nice to use the existing tools.

  13. I'm running into an error using the 1.1.4. version.

    In field input settings:
    Inputfield type = "text" and value type = 8 digits.

    In actual page where I'm using this:
    If I try to use #ff000000 I get HTML 5 field error stating "Please match the format requested" and saving the page fails.
    If I try to use #000000 I get "InputfieldColor: Does not match required pattern: /#?[a-fA-F\d]{8}/"

    So something is stopping me from using it with alphavalues. If I go back to using 6 digit hex value it works fine.

    EDIT: It would be awesome if I could use RGBA(0,0,0,0) as input value as well. Using the hex value I'll have to google the value each time instead of just typing it out. Another great thing would be, if I could choose "empty" as default value. The forced #000000 may not print anything, but looks very confusing because it looks like someone has typed a value in the field.

  14. Edit, solved using Bitpoets suggestio below.

     

    Hello,
    Lets say I wish to split navigation into primary and secondary navigation in the header area, but then in the mobile navigation I wish to have all the pages visible at the same spot.

    I make two new pageArrays, first one includes:

    Home, Products, Services

    and the second:

    Query, Media, Contact

    I create the mobile navigation using a yet another pageArray in the simplest way I know:

    $mobile_menu = new PageArray();
    
    $homepage = $pages->get(1);
    $mobile_menu = $homepage->children;
    $mobile_menu = $mobile_menu->prepend($homepage);
    
    // Lets render the whole thing
    echo renderNav($mobile_menu);

    But instead of spitting out all the pages, it only outputs:

    Home, Product, Services

    Shouldn't a new pageArray "begin from scratch" instead of inheriting something from another pageArray?
    Do I need to do a removeAll after each use of a pageArray or is there some standard way of going about this that doesn't get so messy?

×
×
  • Create New...