Forum

Thread tagged as: Question, Problem

Custom Content from events page

Hi

If you stare at a problem for too you can see what you are looking at.

I am trying to take the date and activity form the events page and display those in a slider on the home page. The code on the home page calling the information from the events.php is:


<?php $opts = array( 'page'=>'/activelifestyles/events.php', 'template'=>'_events_list.html', 'sort'=>'heading', 'sort-order'=>'ASC', 'count'=>3 ); perch_content_custom('dates', $opts); ?>

template for the display on the home page is called _events_list.html


<perch:if exists="heading"> <div class="eventshome"> <br /> <p class="date"><perch:content id="heading" type="date" label="Day Date Month" format="%d %B %Y" required="true" /></p> <perch:content id="activity" type="text" label="Activity" textile="true" editor="markitup" required="true" /><br /> </div> </perch:if>

The region that the events page is dates

The code on the events.html template is


<perch:repeater id="date_act_dis" label="Events" max="15"> <perch:before> <table> </perch:before> <tr> <td class="posdate"> <perch:content id="heading" type="date" label="Day Date Month" format="%d %B %Y" required="true" /> <td> <td class="spacer1"> <perch:content id="activity" type="text" label="Activity" textile="true" editor="markitup" required="true" /> </td> <td class="spacer"> <perch:content id="discription" type="textarea" label="Discription" editor="markitup" required="false" /> </td> </tr> <perch:after> </table> </perch:after> </perch:repeater>

Can anyone see that the problem is???

Many Thanks,

Paul

Paul Quillin-Creamer

Paul Quillin-Creamer 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What is the problem you're seeing? What should it be doing that it's not?

Hi

I am trying to get the date and the activity imputted on the events page to display in the sidef onnyhr home page.

Like sèe below.

20July 2015 Guest speaker

Drew McLellan

Drew McLellan 2638 points
Perch Support

What output do you get?

Hi

I dont get any out put with this code that is on the home page.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You're sorting by a field called heading but that field doesn't exist.

Try date_act_dis.heading instead.

Ive changed the index.php code to:


<?php $opts = array( 'page'=>'activelifestyles/events.php', 'template'=>'_events_list.html', 'sort'=>'date_act_dis', 'sort-order'=>'ASC', 'count'=>8 ); perch_content_custom('dates', $opts); ?>

it still is not displaying????

Drew McLellan

Drew McLellan 2638 points
Perch Support

Did you try the value I suggested?

Hello

No, it made no difference at all on the home page.

The events.php page has the following code on the page to call the template below


<?php perch_content('dates'); ?>

This uses the template events.html


<perch:repeater id="date_act_dis" label="Events" max="15"> <perch:before> <table> </perch:before> <tr> <td class="posdate"> <perch:content id="heading" type="date" label="Day Date Month" format="%d %B %Y" required="true" /> <td> <td class="spacer1"> <perch:content id="activity" type="text" label="Activity" textile="true" editor="markitup" required="true" /> </td> <td class="spacer"> <perch:content id="discription" type="textarea" label="Discription" editor="markitup" required="false" /> </td> </tr> <perch:after> </table> </perch:after> </perch:repeater>

The home page has the following php code


<?php $opts = array( 'page'=>'activelifestyles/events.php', 'template'=>'_events_list.html', 'sort'=>'date_act_dis', 'sort-order'=>'ASC', 'count'=>8 ); perch_content_custom('dates', $opts); ?>

_events_list.html template is


<perch:if exists="heading"> <div class="eventshome"> <br /> <p class="date"><perch:content id="heading" type="date" label="Day Date Month" format="%d %B %Y" required="true" /></p> <perch:content id="activity" type="text" label="Activity" textile="true" editor="markitup" required="true" /><br /> </div> </perch:if>
Drew McLellan

Drew McLellan 2638 points
Perch Support

What does work? Have you tried removing the sort options? What have you done so far to narrow it down?

Hello

Ive tried to change the "perch_content_custom('dates', $opts);" to various 'headings' instead of 'dates'.

Ive tried changing the 'sort'=>'date_act_dis', to variouse 'heading', 'dates', instead of 'date_date_act'

Ive tried adding other activities to the events page but it still will not work.

I am sure that the elements of the php on the index.php page that calls the date and activity form the events page is correct.


<?php $opts = array( 'page'=>'activelifestyles/events.php', 'template'=>'_events_list.html', 'sort'=>'date_act_dis', 'sort-order'=>'ASC', 'count'=>8 ); perch_content_custom('dates', $opts); ?>

I seem to be getting nowhere or at least going round in circles.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you try removing the sort option?

Hello

I have stripped it back to


<?php $opts = array( 'page'=>'activelifestyles/events.php', 'template'=>'_events_list.html', ); perch_content_custom('dates', $opts); ?>

it still will not display the two items.

Dose the _events_list.html template look ok to you???


<perch:if exists="heading"> <div class="eventshome"> <br /> <p class="date"><perch:content id="heading" type="date" label="Day Date Month" format="%d %B %Y" required="true" /></p> <perch:content id="activity" type="text" label="Activity" textile="true" editor="markitup" required="true" /><br /> </div> </perch:if>
Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, that looks fine.

If you turn on debug, what does it output?

Hi

Debug showed up the following on the page:

Debug Message
SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch2_content_regions WHERE regionKey='dates' AND (regionPage='events.php' OR regionPage='*')
No matching content regions found. Check region name (dates) and page path options.
SELECT * FROM ( SELECT idx.itemID, c.regionID, idx.pageID, c.itemJSON, idx2.indexValue as sortval FROM perch2_content_index idx JOIN perch2_content_items c ON idx.itemID=c.itemID AND idx.itemRev=c.itemRev AND idx.regionID=c.regionID JOIN perch2_content_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='_order' WHERE idx.regionID IS NULL AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID ORDER BY sortval ASC LIMIT 0, 4
Using template: /templates/content/_events_list.html
SELECT regionKey, regionHTML FROM perch2_content_regions WHERE regionPage='/activelifestyles.org.uk/index.php' OR regionPage='*' ORDER BY regionPage DESC

The region is correct as that is the one that that I click when I have selected te page. I click dates as the region. The path is correct as events.php is in the same root folder as the folder for perch.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Make sure your page path is root-relative, e.g.

'page'=>'/activelifestyles/events.php',

Hi

It's still displaying the same error message adding '/activelifestyles'

SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch2_content_regions WHERE regionKey='dates' AND (regionPage='/activelifestyles/events.php' OR regionPage='') No matching content regions found. Check region name (dates) and page path options. SELECT * FROM ( SELECT idx.itemID, c.regionID, idx.pageID, c.itemJSON, idx2.indexValue as sortval FROM perch2_content_index idx JOIN perch2_content_items c ON idx.itemID=c.itemID AND idx.itemRev=c.itemRev AND idx.regionID=c.regionID JOIN perch2_content_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='_order' WHERE idx.regionID IS NULL AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID ORDER BY sortval ASC LIMIT 0, 4 Using template: /templates/content/_events_list.html SELECT regionKey, regionHTML FROM perch2_content_regions WHERE regionPage='/activelifestyles.org.uk/index.php' OR regionPage='' ORDER BY regionPage DESC

Drew McLellan

Drew McLellan 2638 points
Perch Support

Perch seems to think your current page is /activelifestyles.org.uk/index.php is that correct?

If so,

'page'=>'/activelifestyles.org.uk/events.php',

Hello

I have reloaded the perch 2.8 and renewed the data base. I have reentered the information in the Perch regions.

The site is currently with Heartinternet and is on a server with the tempory address, as the DNS has not been changed. In the perch licences I have them pointing to https://176.32.230.9/ and https://176.32.230.9/activelifestyles.org.uk/

I am not sure what else I have to do to get this to work.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I don't recommend going back to Perch 2.8. I can only really help with the latest version.

Hi sorry I missed the 8.8 off the end.