by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Sonja Broda
    @texnixe
    Yes, but it will stop working as soon as you make it invisible via the Panel.
    Sonja Broda
    @texnixe
    As I said, it's not a bug, it's just not possible, at least not reliably.
    I have proposed to use a dot instead of a dash to separate the visibility flag from the UID (or anything different to a dash). Let's see what happens in the future.
    Pascal Küsgen
    @Pascalmh

    Wasn't there an option to get a URL to Files that are added to the Panel without the page numbers?

    So https://your-domain.com/content/somepage/something/myfile.pdf instead of https://your-domain.com/content/01-somepage/03-something/myfile.pdf

    Flo Kosiol
    @flokosiol
    Pascal Küsgen
    @Pascalmh
    Ha! I knew it was possible just couldn't find it anymore - thank you Flo!
    Ian Cox
    @ian-cox
    does anyone know how to do a foreach loop on the images found in the assets folder?
    I can echo a single image by it’s path but I’m not sure how to get a files object from that path.
    Sonja Broda
    @texnixe

    You could read the folder using dir::read():

    $files = dir::read($kirby->roots()->assets() .'/images');

    Then you could loop through the resulting array and create a new Asset Object from each file.

    Ian Cox
    @ian-cox
    hmmm interesting
    Note that you have to pass the complete path to the file ('assets/images/etc') to the constructor.
    Ian Cox
    @ian-cox
    trying it now, may need some help creating the object inside of the foreach loop
    we’ll see
    Sonja Broda
    @texnixe
    $files = dir::read($kirby->roots()->assets() .'/images');
    foreach($files as $file) {
        $asset = new Asset('assets/images/'.$file);
        echo $asset->resize(150)->url();
    }
    Ian Cox
    @ian-cox
    that looks great and seem to be working
    do you know how i’d add those files to an object rather than echoing them out?
    Sonja Broda
    @texnixe
    What do you want to achieve? You can add each asset to a Collection or an array.
    Ian Cox
    @ian-cox
    I think a collection, so that I can filter things out easily
    I have a .gitignore in my assets/images/
    and I want to be able to use some other kirby functions on the object later
    essentially, I’m looking for something that behaves like $page->files() but from the assets/images/ folder.
    Sonja Broda
    @texnixe
    $files = dir::read($kirby->roots()->assets() .'/images');
    $collection = new Collection();
    $count = 0;
    foreach($files as $file) {
        $asset = new Asset('assets/images/'.$file);
        $collection->append($count, $asset);
        $count++;
    }
    Then you can filterby whatever:
    dump($collection->filterBy('filename','*=', 'something'));
    Ian Cox
    @ian-cox
    oh wow, thanks this is all very helpful
    Sonja Broda
    @texnixe
    Or even shorter:
    $files = dir::read($kirby->roots()->assets() .'/images');
    $collection = new Collection();
    
    foreach($files as $key => $file) {
        $asset = new Asset('assets/images/'.$file);
        $collection->append($key, $asset);
    }
    dump($collection->filterBy('filename','*=', 'something'));
    Ian Cox
    @ian-cox
    thanks so much, this is working perfectly!
    chriscubellis
    @chriscubellis
    does anyone use this anymore?
    i'm trying to upgrade to v3, but getting a 500 error :(
    not sure where i'm going wrong, cause the debug panel isn't even showing
    chriscubellis
    @chriscubellis
    the starter kit is running fine, so i know it's not my dev environment. i've been following the migration steps, pretty sure i've followed everything in steps 1, 2, & 3...for 4, i wasn't sure if anything's actually supposed to be changed in config.php? and i removed all of the old plugins...
    Niels Nübel
    @nielsnuebel
    Hi, how do I get the panel to run in the example getkirby.com ? i add to the config.php panel install true
    i get the following message Unexpected token < in JSON at position 0 😭
    Samuel Cardoso
    @R3D2
    I'm actually building a plugin and can't get the values to be saved in files like the default behavior...
    Does someone have an exemple in mind of a plugin that add a custom form to a blueprint ?
    drackmas
    @drackmas
    Does anyone have an example of how to use the cards component with UIKit with kirby code to display an image. It feels foreign to work with in comparison to something like bootstrap.

    just looking at an area here:

    <div class="uk-background-cover uk-height-medium uk-panel uk-flex uk-flex-center uk-flex-middle" style="background-image: url(images/dark.jpg);"> no idea how I'd properly use kirby instead of how the image is written out