Posts by Byron Fitzgerald

    I'm more than happy for Drew (or anyone) to use my solution and adapt it as he sees fit.


    The main issue is testing the other gateways as Omnipay needed to be bumped up to v3, along with all the Gateway drivers. Whilst probably not too difficult I can imaging it would be extremely time consuming. As I haven't had any experience with using the other gateways, my change didn't take into consideration them.

    As it looks like some people missed my original post, I'll stick it here as well.


    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, though I have yet to experience any problems. If I could get any 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.

    This is what I normally use for allowing code in text areas


    The template file

    Code
    1. <!--* Fields *-->
    2. <perch:content id="embed_code" type="textarea" label="Embed Codes" help="Used to place tracking codes"/>
    3. <!--* ./Fields *-->

    Then in your php page/layout

    Code
    1. <?= html_entity_decode( perch_content_custom('Embed Code', [
    2. 'template' => 'shared/embed_code',
    3. ], true)) ?>

    You'll need to use a custom field type to do this. I've made one in the past which I use on most of our sites. Here is a link to a gist of it. You'll need to create a folder in perch/addons/fieldtypes/ and call it page_list. Copy the page_list.class.php file into the new folder and you should be able to use it in your templates now.


    There's a few examples on how to use it in the gist as well

    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.