Posts by Byron Fitzgerald

    There is no easy way to set a conditional in that manner. You could use skip-template => true then check the date of the returned event and then user perch_template() to output the right template, though you'll need to use the perch:content namespace if you approach this way. So you might do something like this.



    It would be easier and cleaner to use perch:if tags in the template to then include either layouts or templates to get the desired result, like in my previous examples.

    Code
    1. <perch:if id="eventDateTime" match="lt" value="{today}" format-both="U">
    2. <perch:template path="events/past-detail">
    3. <perch:else/>
    4. <perch:template path="events/future-detail">
    5. </perc:if>


    Lastly you could run two queries, using a date filter as well. This works as the template is not shown if no event is found. I wouldn't recommend this though as you are making two calls to the database instead of one.

    Your event detail html template should look something like this

    Then your detail php page should look something like this

    PHP
    1. <?php
    2. // Sets a global variable today so we can use in the perch template
    3. PerchSystem::set_var('today', date('Y-m-d'));
    4. perch_events_custom([
    5. 'filter'=>'eventSlug',
    6. 'match'=>'eq',
    7. 'value'=>perch_get('s'),
    8. 'template'=>'listing/event-detail.html'
    9. ]);

    Ah sorry I misread the question, thought it was for single event pages not the archive. You'll probably want to make to perch_events_custom calls, one for future events and one for past events. Then just swap the templates you are using.

    If you want to combine it all together in one perch_event_custom call you can use my previous code in the listing/custom-listing-day file like follows. Where the future template shows your current template and your future template will show the results

    Something like this should work, where today is a passed in data variable. Using U for the format will convert them to Seconds since the Unix Epoch for a better comparison.

    Code
    1. <perch:if id="eventDateTime" match="lt" value="{today}" format-both="U">
    2.     <perch:template path="events/past">
    3. <perch:else/>
    4. <perch:template path="events/future">
    5. </perc:if>

    This is what we use to add a leading paragraph option, and a quote option to the formatting list. Should be found in addons/plugins/editor/config.js


    The important stuff is in the get function, which actually adds it to redactor, the load function lets you add some styles to format the editor. Rest should be documented in the link you provided.

    Fair enough, only other suggestion would be to make you own field type that uses a text field but sets the disabled attribute. Otherwise like you suggested JS might be the only other way if you don't want to change the field type.

    Hi All


    I've created an initial release for an update to Perch Shop to let stripe take 3DS2 payments. You can find the repo here. Everything you need should be there, and the README provides an overview of the changes and what you need to do to get it up and running.


    I've tested this locally but have yet to use this live, so I'd hold off on production use for now. If I could get your feedback on whether you guys can get it working that would be great. I've got some more tests myself to do and once everything is looking good I'll create a production ready release.


    You can also just grab the download here

    If you use the no-index attribute on your content templates, as well as reduce the undo buffer, that should help keep the index table down a bit.


    As for the duplicating items, do you know when the items are being duplicated? Is it after you save/update items? Do you have scheduled tasks setup? I wouldn't delete anything straight from the DB, but if you fetch the ID's you should be able to write a script to find the content items in question and use the factory methods to safely remove them for the time being.