Jump to content

alxndre

Members
  • Posts

    155
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by alxndre

  1. Instead of repeaters, you can use a multiselect Page Reference field, along with the ConnectPages module to synchronize the connection.

    With this, your genre fields on your movie page, and vice versa, will be visible and always updated, and if you prefer you can display the field in a separate tab using fieldset.

     

  2. 2 hours ago, Hurme said:

    This produces a fatal error, why?
    $notes->set('He's a dude');

    But this works
    $notes = 'He's a dude';

    Because at this point, $notes is only a string. $dude->notes returns the contents of the field notes, not the field itself.

    Why do you need to assign the field to another variable?

    In most cases this should be enough.

    $dude->notes = "He's a dude";
    $dude->set('notes',"He's a dude");
    $dude->save();
    
    //or 
    
    $dude->setAndSave('notes',"He's a dude");

     

    • Like 1
  3. On 9/2/2019 at 4:01 PM, Sebi said:

    In my version, BasicAuth is the preferred way to request a jwt-token. After that, you have to add the token to each request.

    @Sebi, I'm trying out both the single and double JWT auth methods. Double JWT works fine in my tests.

    With single JWT, it seems that when Bearer token is being ignored if it is not supplied. Meaning, if I submit a request with only an API key (no JWT token), the request is accepted. At the same time, if I submit the request with a wrong Bearer token, it responds appropriately with error 400. In my understanding, both scenarios should return a 400.

    I'll perform more tests to verify and report if it really is the case or if I'm missing something.

    • Like 1
  4. This reminded me of endless hours making my Geocities site look perfect. And your the site looks awesome! 

    And then I proceeded to spend an hour learning about shoelaces. ? Fascinating stuff! ?

    • Haha 2
  5. 5 minutes ago, Robin S said:

    This works for me (using the core "pass" field in the user template)...

    
    $u = $pages->get("template=user, pass=$hash");

    Alternatively there's nothing wrong with using a SQL query to match data from the password field table directly if that suits you better.

    I think his problem is how to get the value for $hash.

    // $hash = ????;
    $hash = howToHashThePlain('password1337');
    $u = $pages->get("template=user, pass=$hash");

    I'm trying to figure it out as well but most of the related things (salts, functions matches and hash) are set to protected, so I'm thinking this could not be done without touching the core modules, or extending/duplicating them to support generating the hash for the field on-the-fly. I'll perform more tests when I could. ?

    On a side note, I could not imagine a practical use case where you -should- be using the password field to search for members given that passwords are not meant to be unique or indicative of anything. So if OP could enlighten us on how he's using this, maybe we could be motivated to work on it more. ?

     

  6. Do you mean in the page editor? I'll look if there are modules for this because I'm not sure.

    But you can also do this via the api:  

    $home = $pages->get('/');
    echo date("d M Y", $home->published) . PHP_EOL; // 21 Feb 2017
    echo date("d M Y", $home->created)  . PHP_EOL; // 21 Feb 2017
    $home->published = strtotime("February 21, 2016");
    $home->created = strtotime("February 21, 2016");
    $home->save();
    echo date("d M Y", $home->published) . PHP_EOL; // 21 Feb 2016
    echo date("d M Y", $home->created)  . PHP_EOL; // 21 Feb 2016

    Edit:

    My bad. The changes doesn't seem to persist.

    Turns out, published, created, and modified are not "fields" per se, but rather are properties built-in to the page. This might be a good candidate for a quick module for those who need to edit the values. 

    • Like 1
  7. 15 hours ago, h365 said:

    Another Way is to create a Page for Each Flight with those 6 fields, but then sill i cant create and edit child pages directly from that TOUR page, i would need to create it first and then link to it from the TOUR Page.

    I'm pretty sure ProFields: PageTable allows creation of new pages from from within the page being edited.

     

    Quote

    PageTable

    This is one of the ProFields that is available for free (thanks to Avoine sponsorship) on the ProcessWire dev branch. Meaning, it'll be available for everyone to use as part of the core in ProcessWire 2.5. And you can use it now if you don't mind running the dev branch. PageTable has all the flexibility of repeaters, but with lower overhead from the admin/input perspective. Rather than trying to bundle all the inputs on one screen, PageTable shows you a table of items and you click on the item to edit it in a modal window. This enables it to be a lot more efficient from the admin UI perspective. It's also more flexible than repeaters are in terms of where you store your items. PageTable lets you choose where they should live, whether as children of the page being edited, or as children of some other parent page you designate. They might be a little more work to setup than repeaters, but I think that most situations where you need the flexibility of repeaters may be better served by PageTable. PageTable still can't compete with the speed and efficiency of Table or Multiplier, but consider using PageTable anywhere that you might have used Repeaters before. Repeaters and PageTable are fundamentally different from the admin UI/input perspective, so you'd want to compare them yourself to see what suits your individual input needs better. PageTable involves more clicking to create and edit items, making Repeaters potentially faster for entering data rapidly. But PageTable will scale much further in the admin UI than Repeaters will, so I would personally favor PageTable in more situations than Repeaters.

     

    • Like 1
  8. I dunno why yet, but can confirm the weird behavior. The function works when fed with strings but gives weird results when input is taken from the array.

    // output looping through getDateFormats()
    l, j F Y : %A, $-d %B %Y
    j F Y : $-d %B %Y
    d-M-Y : $d-%b-%Y
    dMy : $d%b%y
    d/m/Y : $d/$m/%Y
    d.m.Y : $d.$m.%Y
    d/m/y : $d/$m/%y
    d.m.y : $d.$m.%y
    j/n/Y : $-d/$-m/%Y
    j.n.Y : $-d.$-m.%Y
    j/n/y : $-d/$-m/%y
    j.n.y : $-d.$-m.%y
    Y-m-d : %Y-$m-$d
    Y/m/d : %Y/$m/$d
    Y.n.j : %Y.$-m.$-d
    Y/n/j : %Y/$-m/$-d
    Y F j : %Y %B $-d
    Y-M-j, l : %Y-%b-$-d, %A
    Y-M-j : %Y-%b-$-d
    YMj : %Y%b$-d
    l, F j, Y : %A, %B $-d, %Y
    F j, Y : %B $-d, %Y
    M j, Y : %b $-d, %Y
    m/d/Y : $m/$d/%Y
    m.d.Y : $m.$d.%Y
    m/d/y : $m/$d/%y
    m.d.y : $m.$d.%y
    n/j/Y : $-m/$-d/%Y
    n.j.Y : $-m.$-d.%Y
    n/j/y : $-m/$-d/%y
    n.j.y : $-m.$-d.%y

    Will investigate more.

     

    Edit :

    https://github.com/processwire/processwire/blob/master/wire/core/WireDateTime.php#L86

    The code actually has those $ symbols. Submitted as an issue.

    • Like 1
×
×
  • Create New...