Here is what is currently in use for the table that needs to be chronologically sorted (most upcoming first) by date of the event
{arijdatatable bPaginate="true"; iDisplayLength="5"; sPaginationType="full_numbers"; bAutoWidth="false"; oLanguage_sZeroRecords="No events to display." }
{arisqltable}
{arisqltablecolumns}
{arisqltablecolumn id="Image" hidden="true"}{/arisqltablecolumn}
{arisqltablecolumn id="Venue" hidden="true"}{/arisqltablecolumn}
{arisqltablecolumn id="Event" hidden="true"}{/arisqltablecolumn}
{arisqltablecolumn id="eLink" hidden="true"}{/arisqltablecolumn}
{arisqltablecolumn id="vLink" hidden="true"}{/arisqltablecolumn}
{arisqltablecolumn id="Date" hidden="true"}{/arisqltablecolumn}
{arisqltablecolumn id="Time" hidden="true"}{/arisqltablecolumn}
{arisqltablecolumn alias="When" virtual="true" pos="1"}
{coltemplate}{$Date} @ {$Time}{/coltemplate}
{/arisqltablecolumn}
{arisqltablecolumn alias="What" virtual="true" pos="2"}
{coltemplate}<img src="images/events/{$Image}" width="40" height="30" /><a href="{$eLink}">{$Event}</a>{/coltemplate}
{/arisqltablecolumn}
{arisqltablecolumn id="Summary" }{/arisqltablecolumn}
{arisqltablecolumn alias="Where" virtual="true" pos="4"}
{coltemplate}<a href="{$vLink}">{$Venue}</a>{/coltemplate}
{/arisqltablecolumn}
{/arisqltablecolumns}
{arisqltablequery}SELECT venue.venue_name AS Venue, venue.link AS vLink, events.event_name AS Event, events.summary AS Summary, events.link AS eLink, events.image AS Image, date_format(events.start, '%b %e') as Date, date_format(events.start, '%l:%i %p') as Time, venue.gpoint FROM #__ysg_events AS events INNER JOIN #__ysg_venue AS venue
ON events.vid = venue.id WHERE MBRContains( GeomFromText( 'POLYGON((<?php echo $western.' '.$southern.', '.$eastern.' '.$southern.', '.$eastern.' '.$northern.', '.$western.' '.$northern.', '.$western.' '.$southern; ?>))' ) , venue.gpoint ) {/arisqltablequery}
{/arisqltable}
{/arijdatatable}
____________________________________________
And this is for the table that needs to be sorted by distance column (shortest distance first)
{arijdatatable bPaginate="true"; iDisplayLength="10"; sPaginationType="full_numbers"; bAutoWidth="false"; oLanguage_sZeroRecords="No venues found."}
{arisqltable}
{arisqltablecolumns}
{arisqltablecolumn id="Image" hidden="true"}{/arisqltablecolumn}
{arisqltablecolumn id="Venue" hidden="true"}{/arisqltablecolumn}
{arisqltablecolumn id="Link" hidden="true"}{/arisqltablecolumn}
{arisqltablecolumn alias="Where" virtual="true" pos="1"}
{coltemplate}<img src="images/venues/{$Image}" width="40" height="30" /><a href="{$Link}">{$Venue}</a>{/coltemplate}
{/arisqltablecolumn}
{arisqltablecolumn id="Summary"}{/arisqltablecolumn}
{arisqltablecolumn id="Distance"}{/arisqltablecolumn}
{/arisqltablecolumns}
{arisqltablequery saveTags="true"}
SELECT venue.id, venue.venue_name AS Venue, venue.gpoint, venue.summary AS Summary, venue.link AS Link, venue.image AS Image, venue.lat, venue.long, FORMAT( 3956 *2 * ASIN( SQRT( POWER( SIN( ( <?php echo $location['latitude']; ?> - venue.lat ) * pi( ) /180 /2 ) , 2 ) + COS( <?php echo $location['latitude']; ?> * pi( ) /180 ) * COS( venue.lat * pi( ) /180 ) * POWER( SIN( (<?php echo $location['longitude']; ?> - venue.long) * pi( ) /180 /2 ) , 2 ) ) ) , 2 ) AS Distance
FROM #__ysg_venue AS venue WHERE MBRContains( GeomFromText( 'POLYGON((<?php echo $western.' '.$southern.', '.$eastern.' '.$southern.', '.$eastern.' '.$northern.', '.$western.' '.$northern.', '.$western.' '.$southern; ?>))' ) , venue.gpoint )
{/arisqltablequery}
{/arisqltable}
{/arijdatatable}
|