Stephen Meehan Student

  • Member since Jan 29th 2019
  • Last Activity:
Posts
77
Likes Received
22
Points
577
Profile Hits
305
  • Stephen Meehan

    Thread
    Hi,

    I was hoping Perch Support (hi Drew) could clarify something for me regarding the Members app...

    Does the Members app allow multiple logins using a shared username and password?

    ---

    I've used the Members app to password protect a blog and all…
  • Stephen Meehan

    Replied to the thread Post Perch form to a CRM?.
    Post
    Hey, thanks for the replies.

    1. I'm trying to get my head around this, as I've not done this before.
    2. I actually have multiple forms throughout website, will I need an app per form?
    3. I want to use perch_forms to handle validation, redirects and spam.
    4. All
  • Stephen Meehan

    Posted the thread Post Perch form to a CRM?.
    Thread
    Hi,

    I need to post a Perch form to a CRM. Not sure how to approach it, as I've never done this before...

    If it was a standard contact form, I'd most likely generate the form in the CRM and use any form code provided.

    This is my current setup. I'm…
  • Stephen Meehan

    Replied to the thread Callback Functions with each?.
    Post
    Great stuff! Thanks for your help. Here's the working code incase anyone else needs to do something similar.

    (Code, 22 lines)

    :)
  • Stephen Meehan

    Replied to the thread Callback Functions with each?.
    Post
    Yes, that's right. Dates for each event are added via a repeater, there could be one date or multiple dates per event.

    I've got this half working

    (Code, 10 lines)


    id="list_event_date" is in events--listing.html and takes it's value from the first…
  • Stephen Meehan

    Thread
    Hi,

    I have a collection called Events, each item has perch:repeater id="event_dates" which can have multiple dates, that might not be in the desired reverse chronological order.

    events--listing.html needs to show the next upcoming date, I feel like…
  • Stephen Meehan

    Post
    Ah, I didn't know about _id, very useful.

    There's also another collection for event locations inside the event collection, I needed to grab the location associated with the event. I was able to do it using the same technique but on another collection.
  • Stephen Meehan

    Like (Post)
    (Quote from Stephen Meehan)

    In PHP, you need to fetch the item with perch_collection(). perch:related does this for you inside the template. If you skip the templating, you need to do this yourself:

    (Code, 13 lines)

  • Stephen Meehan

    Like (Post)
    Off the top of my head here so apologies for not showing code but could you use the 'each' option containing a collection function that calls a single related collection item with the related id using 'event._id'?

    You can then return the id from that…
  • Stephen Meehan

    Thread
    Hi,

    I have a hero banner, which allows admin to pick a featured event from a collection. It works but I need to do some other things with it.

    The events--hero.html template has this perch:related id="feat_event" tag, using perch_content_custom I need…
  • Stephen Meehan

    Post
    Ah, thanks. It's useful I can pull a variable out of a layout like that.
  • Stephen Meehan

    Like (Post)
    Hi Stephen,

    You can use PerchSystem::set_var() and PerchSystem::get_var():

    (Code, 2 lines)


    (Code, 2 lines)


    Note that set_var() makes the variable available for the template engine. You can always unset it if you no longer need it:

    (Code, 1 line)

  • Stephen Meehan

    Thread
    Hi,

    I get how to pass a variable into a layout, like this:
    (Code, 4 lines)

    Then inside head.php I'd use this:
    (Code, 3 lines)

    which would output THIS IS A DEMO. Great.


    Is it possible to do the reverse? Pull a variable out of perch_layout('head')?


  • Stephen Meehan

    Replied to the thread Category paths in an array?.
    Post
    Great stuff! Pipit is super useful.

    Here's how I used it.

    (Code, 15 lines)

    I can then do other stuff to $topic_selected, but the key thing is the category paths are output as paths not IDs

    Thanks!
  • Stephen Meehan

    Like (Post)
    Hi Stephen,

    You can use the pipit_category_get_path() function (from the Pipit app) to handle cases where you get category IDs instead of paths.
  • Stephen Meehan

    Posted the thread Category paths in an array?.
    Thread
    I have a category set called topics, within the topics category template, I have another perch:categories tag

    (Code, 6 lines)

    I need to get the category paths from set="content-type", I've done something similar elsewhere in the website I'm working on,…
  • Stephen Meehan

    Like (Post)
    The is an array with a single element (a string):
    (Code, 16 lines)



    This is an array of strings:
    (Code, 22 lines)


    Hope this helps.
  • Change your value to:
    (Code, 1 line)

    One string, comma separated and no spaces in between
  • I think its because you are using 'match' => 'eq', which is doesn't work with multiple items. you can try the following,

    (Code, 7 lines)

    I prefer using slug, as you've already passed the set in. If it still expects a string the following should work
  • Stephen Meehan

    Post
    Thanks andrewmman / Byron Fitzgerald

    Combining your suggestions did the trick!

    I stuck with catPath as I wanted to replace the hardcoded paths with an array that would contain the category paths.

    (Code, 8 lines)


    Further up in the template I…