Forum

Thread tagged as: Question

Using Slug

Hi,

I have tried to follow the dataselect tutorial:

https://solutions.grabaperch.com/templates/how-do-i-reuse-content-in-a-select-list

since I am trying to use data in one page on another page and according to a response to a previous post I made, this is possible however when I use the slug it displays the data on the page where supposedly I am trying to retrieve data from.

I'd have thought that in the first instance, it (slug) would be hidden but what it actually does is removes any capitalisation which is for a start worrying.

Secondly, in the .html template where I am using the dataselect "tag" nothing comes up in the list.

Here is the template for the page I am storing data in:

<table id="ScheduleTable">
    <thead>
        <tr>
            <th>Code</th>
            <th>Location</th>
            <th>State</th>
            <th>Dates</th>
        </tr>
    </thead>
    <tbody>
        <perch:repeater id="Course" title="Course">
        <tr>
            <td><perch:content id="code" type="text" label="Course Code" /><perch:content id="slug" for="code" type="slug" /></td>
            <td><perch:content id="venue" type="select" label="Venue" options="Syd, Can, Bris, Adel, Mel, Per" label="Venues" suppress="true" allowempty="true" /><perch:if id="venue" value="Syd">Sydney</perch:if><perch:if id="venue" value="Can">Canberra</perch:if><perch:if id="venue" value="Bris">Brisbane</perch:if><perch:if id="venue" value="Adel">Adelaide</perch:if><perch:if id="venue" value="Mel">Melbourne</perch:if><perch:if id="venue" value="Per">Perth</perch:if></td>
            <td><perch:content id="state" type="select" label="State" options="NSW, QLD, SA, VIC, WA" label="States" suppress="true" allowempty="true" /><perch:if id="state" value="NSW">NSW</perch:if><perch:if id="state" value="QLD">QLD</perch:if><perch:if id="state" value="SA">SA</perch:if><perch:if id="state" value="VIC">VIC</perch:if><perch:if id="state" value="WA">WA</perch:if></td>
            <td><perch:content id="date" type="text" label="Date" /></td>
        </tr>
        </perch:repeater>
    </tbody>
</table>

and here is the code for the template I am wanting to import data into:


<table id="ScheduleTable"> <thead> <tr> <th>Code</th> <th>Location</th> <th>State</th> <th>Dates</th> </tr> </thead> <tbody> <perch:repeater id="Course" title="Course"> <tr> <td><perch:content id="code" label="Code" type="dataselect" page="/course/index.php" region="Schedule" options="code" /></td> <td><perch:content id="venue" label="Venue" type="dataselect" page="/course/index.php" region="Schedule" options="venue" /></td> <td><perch:content id="state" label="State" type="dataselect" page="/course/index.php" region="Schedule" options="state" /></td> <td><perch:content id="date" label="Date" type="dataselect" page="/course/index.php" region="Schedule" options="date" /></td> </tr> </perch:repeater> </tbody> </table>

Thank you for any help offered.

Garth Holmes

Garth Holmes 1 points

  • 6 years ago

Upon other tests, I am getting the following output:

Code Location State Dates ra-d41d-cd98 ra-d41d-cd98 ra-d41d-cd98 ra-d41d-cd98

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you post your diagnostic report?

Perch: 2.8.5, PHP: 5.4.39, MySQL: mysqlnd 5.0.10 - 20111026 - $Id: c85105d7c6f7d70d609bb4c000257868a40840ab $, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (2.8.5), assets (2.8.5), categories (2.8.5), perch_backup (1.2)
App runtimes: <?php include(PERCH_PATH.'/core/apps/content/runtime.php'); ?>
PERCH_LOGINPATH: /perch
PERCH_PATH: /home/sitemaster/public_html/perch
PERCH_CORE: /home/sitemaster/public_html/perch/core
PERCH_RESFILEPATH: /home/sitemaster/public_html/perch/resources
Image manipulation: GD
PHP limits: Max upload 32M, Max POST 64M, Memory: 128M, Total max file upload: 32M
Resource folder writeable: Yes
DOCUMENT_ROOT: /home/sitemaster/public_html
HTTP_HOST: 
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Drew McLellan

Drew McLellan 2638 points
Perch Support

I think this could be an issue with slugs inside repeaters, which is a scenario I've not seen before. I'll run some tests.

To stop a tag outputting, use the suppress="true" attribute.

Hi Drew,

I may be confused as to the purpose of dataselect and slug however I am able to get a content tag to repeat but only in the original page if that makes any sense.

Thanks for your help.