Forum
Problem displaying list archives on Perch Runway site
I’ve setup the MailChimp app and successfully integrated it with a contact form - it works great.
I’d like to be able to display an archive list of email campaigns on my website, but I can’t get it to work?
I’ve Moved the MailChimp folder into templates > pages
and removed the perch runtime line from each page template (campaign.php, campaigns.php and subscribe.php).
I've setup two pages. /campaign
and /campaigns
using the page templates below:
campaigns.php the page displays, but no archives are listed?
<?php
// Include the header. You can find this in templates/layouts/global
perch_layout('global/header', [
'body-class' => 'campaigns',
]);
// An editable content region
perch_content('Main heading');
// Main navigation
perch_pages_navigation([
'levels'=>1
]);
//show an archive on a page
perch_mailchimp_campaigns();
// Include the footer. You can find this in templates/layouts/global
perch_layout('global/footer’);
campaign.php
<?php
perch_mailchimp_campaign_content(perch_get('s'));
I’ve changed the location of the detail page under MailChimp settings in the Perch control panel:
//Campaign archive page path
/campaigns
Back on the MailChimp website I’ve made sure campaigns are marked as public.
- There are no error PHP logs
- Debug is on and there are no errors on /campaigns
- I’m sure the MailChimp app is configured right because the contact form integration works great.
Are there any gotchas that I might be missing?
Can you see your campaigns in the control panel?
I can see all the sent campaigns on my /campaigns page, using
perch_mailchimp_campaigns();
This bit works :)I'm having problems viewing a single campaign though.
This is how I've got my pages setup:
The template for /campaign (campaign.php) only has this in it, I've made sure there's no whitespace.
I’ve changed the location of the detail page under MailChimp settings in the Perch control panel to:
When I click a link on the archive list (on /campaigns) it takes me to /campaign and the page is blank, apart for the debug message.
This is the debug message on that page:
All the
href
in the archive list look like this:I'd of expected each one to have a unique URL? Maybe something to do with
campaignSlug
?There's no PHP errors logged.
Hi
I figured out the URL in MailChimp settings in the Perch control panel needs to have
{campaignSlug}
on the end :This adds the campaign slug to each
href
in the archive list.When I click any of the links I get a 404. I know I need to add a URL pattern, but I can't find any documentation for MailChimp URL Patterns?
You don't need specific documentation for creating the route - it's the same as anything else.
This should work:
Bingo! Thanks Drew.