Forum

Thread tagged as: Configuration, Api, Add-on-development

The Sample App

Hello

i have just downloaded the sample APP and wondering if there as any documentation for it

as im not sure how to display the items i have added onto the front end

thanks

Ant

Anthony Elleray

Anthony Elleray 2 points

  • 5 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

The documentation is the API docs, which start here: https://docs.grabaperch.com/api/

yh i have been looking there but not understanding it

is there no video on how to make / use a app

as i want to create a app to publish staff onto the site and then display the staff in different areas of the site

Hi Anthony,

If I am understanding correctly you can probably do what you want with core Perch functionality without making an app.

The Perch demo site here has a 'Team' section which shows staff members:

https://github.com/PerchCMS/perchdemo-swift

You could then use this data in different parts of the site using perch_content_custom()

ah ok that sounds good

could you help with showing me example code for displaying the content on another page

i want the staff to display on the staff page but then display 4 staff on the homepage

happy for you to add on skype live:anthony_5917

Thanks

Ant

Your best bet is to look at the docs here, there are a few examples:

https://docs.grabaperch.com/docs/content/perch-content-custom/

You basically specify a page and region to pull the content from, and then a template to display that content.

thanks i will have a look

im having a few small issues

i manage to get this working on one test site but i cant on another

so far i have this

my index.php has

<?php
    perch_content_custom('Launch Details', array(
        'page'=>'/launches/index.php',
        'template'=>'launch_details.html',
        'sort'=>'date',
        'sort-order'=>'DESC'
    )); 
?>

/launches/index.php has this

 <?php perch_content('Launch Details'); ?>

trying to get this data https://slbs.myboxproject.co.uk/launches/

to display on homepage but using a diffrent template

launch_details looks like this

<p><perch:content id="launch_details" type="textarea" label="Launch Details" markdown="true" editor="markitup" imagewidth="640" imageheight="480" /></p>

<p><perch:content id="launch_date" type="date" label="Launch Date" format="%d %B %Y" required="true" /></p>

<p><perch:content id="launch_time" type="text" label="Launch Time" required="true" title="true" /></p>

<p><perch:content id="recovery_time" type="text" label="Recovery Time" required="true" title="true" /></p>

<p><perch:content id="boats_launched" type="select" label="Boats Launched" 
options="Both, D Class, Mersey" allowempty="false" required="true" /></p>

<p><perch:content id="casualty_type" type="select" label="Casualty Type" 
options="Animal,Canoe/Kayak,Climber,Coasteering,Commercial Vessel,Dinghy,Diver/Dive boat,Jet Ski,Medivac,Missing person,Miscellaneous,Motor boat,Rambler/Walker,Swimmer,Windsurfer,Yacht" allowempty="false" required="true" /></p>

<p><perch:content id="location" type="text" label="Location" required="true" title="true" /></p>

<p><perch:content id="map" type="map" label="Lat & Long" width="400" height="300" zoom="15" /></p>

<p><perch:content id="wind_direction" type="select" label="Wind Direction" 
options="N,NE,E,SE,S,SW,W,NW" allowempty="false" required="true" /></p>

<p><perch:content id="wind_speed" type="select" label="Wind Speed" 
options="1,2,3,4,5,6,7,8,9,10,11,12+" allowempty="false" required="true" /></p>

<p><perch:content id="visibility" type="select" label="Visibility" 
options="Foggy,Good,Patchy Fog,Poor" allowempty="false" required="true" /></p>

<p><perch:content id="sea_state" type="select" label="Sea State" 
options="Smooth,Slight,Moderate,Rough,Very Rough" allowempty="false" required="true" /></p>

<ul>
    <perch:repeater id="ilb_crew" label="ILB Crew">
        <li><perch:content id="ilb_crew_member" label="ILB Crew Member" type="dataselect" page="/crew/index.php" region="Crew Members" options="crew_member_name" /></li>
    </perch:repeater>
</ul>
<ul>
    <perch:repeater id="alb_crew" label="ALB Crew">
        <li><perch:content id="alb_crew_member" label="ALB Crew Member" type="dataselect" page="/crew/index.php" region="Crew Members" options="crew_member_name" /></li>
    </perch:repeater>
</ul>



Drew McLellan

Drew McLellan 2638 points
Perch Support

What problem are you having?

the content does not display

Drew McLellan

Drew McLellan 2638 points
Perch Support

You're sorting by date but your field is called launch_date.

ok thanks

also whilst your here

the read more tag it takes you to the page where that item is displayed could it be adjusted to tak you to a page to show just that content

like a blog post when you click read more it would take you to that post rather than a page of posts

Drew McLellan

Drew McLellan 2638 points
Perch Support

thanks

ive managed to do that however both items link to the same post

https://slbs.myboxproject.co.uk/launches/

think i figured it out

i needed the slug to be the date rather than title

as im importing some old data that does not have a title

but looks like it has to be a title

Drew McLellan

Drew McLellan 2638 points
Perch Support

The slug can be pretty much anything.

i set it as the date field but wont work

<perch:content id="launch_date" type="date" label="Launch Date" format="%d %B %Y" required="true" />
<perch:content id="slug" for="launch_date" type="slug" suppress="true" />

Is this a bug or am I doing something wrong?

Thanks

Ant