Forum
Using Slug part 2
Following on from another thread I have new templates that I am trying to use which may explain what I am trying to do:
<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="slugs" for="code" type="slug" />
</td>
<td>
<perch:content id="state" type="select" label="State" options="ACT, NSW, NT, QLD, SA, TAS, VIC, WA" label="States" suppress="true" allowempty="true" />
<perch:if id="state" value="ACT">ACT</perch:if>
<perch:if id="state" value="NSW">NSW</perch:if>
<perch:if id="state" value="NT">NT</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="TAS">TAS</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="date" label="Date" format="%A, %e %B %Y" />
</td>
</tr>
</perch:repeater>
</tbody>
</table>
and
<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="coded" label="Code" type="dataselect" page="/courses/course/1index.php" region="Scheduled" options="slugs" />
</td>
<td>
<perch:content id="state" type="select" label="State" options="ACT, NSW, NT, QLD, SA, TAS, VIC, WA" label="States" suppress="true" allowempty="true" />
<perch:if id="state" value="ACT">ACT</perch:if>
<perch:if id="state" value="NSW">NSW</perch:if>
<perch:if id="state" value="NT">NT</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="TAS">TAS</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="date" label="Date" format="%A, %e %B %Y" />
</td>
</tr>
</perch:repeater>
</tbody>
</table>
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.
Thank you.
So are the slugs meant to only be used in the same page, i.e. across templates accessed via the same .php file or can they be used anywhere?
I have been using dataselect between templates accessed via the same php file, albeit via includes but with slug it seems simpler however I still need a way to duplicate content easily.
I will try it without a repeater and report back.
They can be used anywhere. They're simply a URL-safe version of some other content like a title.
I removed the repeater and set true as per the following:
it works but it's an incredible amount of labor for something I merely want to duplicate without further ado and quite frankly, the slug "feature" does little more than allow adhoc variables to be created whereas using dataselect alone produces literally the same result.
New feature perhaps?
I'm not sure how the slug relates to dataselect use. You've lost me!