Wordpress integration

Wordpress integration

ModestyModesty Posts: 4Questions: 0Answers: 0
edited November 2010 in General
Hi!
I really love what DataTables can do and would love to integrate it with my wordpress site... I have tried everything but I just can't seem to get it working... here is the code that produces the table I'd like to 'dress-up':

[code]



<?php if ( !empty($caption) ) : ?>
<?php echo $caption; ?>
<?php endif; ?>
<?php if ( $options['list-headers'] ) : ?>

<?php foreach ( $show_fields as $field ) : ?>
<?php echo $listFields[$field]; ?>
<?php endforeach; ?>

<?php endif; ?>

<?php foreach ( $gigs as $gkey => $g ) : ?>
<?php foreach ( $g->performances as $key => $p ) : ?>

<?php
if ( $key == 0 ) {
$fields = array(
'city' => '{' . $g->cityState . '}',
'country' => '{' . $g->country . '}',
'venue' => '{' . $g->name . '}',
'eventName' => '{' . $g->eventName . '}',
'date' => '{' . $g->date . '}',
'time' => '{' . $p->time . '}',
'shortNotes' => '{' . $p->shortNotes . '}',
'tickets' => ( $upcoming ? '' . ( !empty($p->link) ? '' : '') . '' : '' ),
'map' => '' . ($g->mapLink ? '' : '') . '',
);
} else {
$fields = array(
'city' => '',
'country' => '',
'venue' => '',
'eventName' => '',
'date' => '',
'time' => '{' . $p->time . '}',
'shortNotes' => '{' . $p->shortNotes . '}',
'tickets' => ( $upcoming ? '' . ( !empty($p->link) ? '' : '') . '' : '' ),
'map' => '',
);
}
echo dtcGigs::selectFields($fields, $g);
?>

<?php endforeach; ?>
<?php endforeach; ?>


<?php if ( empty($gigs) && $upcoming ) : ?>
<?php echo $options['no-upcoming']; ?>
<?php elseif ( empty($gigs) ) : ?>
<?php echo $options['no-past']; ?>
<?php endif; ?>

[/code]

Now, what method would you suggest me to use? I have tried the basic stuff but it doesn work i.e. I cant manage to get the sorting or search options swow up on the page...

tnx in advance

m.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    It looks like your code will produce html which means the requirements for DataTables ( http://datatables.net/usage/#prerequisites ) - I presume it does? So what happens when you do $('#example').dataTable(); like in the zero config example: http://datatables.net/examples/basic_init/zero_config.html ?

    Allan
  • ModestyModesty Posts: 4Questions: 0Answers: 0
    Acctually - nothing.

    That was the first thing I've done - but with no results

    n.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Can you link us to an example so we can see what might be happening please?

    Allan
  • ModestyModesty Posts: 4Questions: 0Answers: 0
    here it is: http://teatar.hr/kalendar/
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    There are a couple of Javascript errors on the page (have a look with Firebug) which isn't going to help :-)

    > TypeError: Result of expression '$' [undefined] is not a function.

    which doesn't look good - no jQuery. Actually it looks like you are trying to include jQuery twice, which is a bit odd as well. I'd try to see if you can address that.

    Allan
This discussion has been closed.